llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

[REGRESSION] Compiler aborts in LTO

Open llvmbot opened this issue 10 years ago • 14 comments

Bugzilla Link 30509
Resolution FIXED
Resolved on Nov 07, 2018 00:17
Version trunk
OS Linux
Depends On llvm/llvm-project#29716
Reporter LLVM Bugzilla Contributor
CC @arpilipe,@pcc

Extended Description

Compiler aborts while building one of our internal benchmarks with following build error:

trunk/llvm/lib/LTO/LTO.cpp:335: llvm::Error llvm::lto::LTO::addRegularLTO(std::unique_ptrllvm::lto::InputFile, llvm::ArrayRefllvm::lto::SymbolResolution): Assertion `ResI != Res.end()' failed. clang-4.0: error: unable to execute command: Aborted (core dumped)

I shall try to come up with a test case.

The regression is introduced in r281853.

llvmbot avatar Sep 24 '16 06:09 llvmbot

Verified! Thanks to all.

llvmbot avatar Oct 03 '16 19:10 llvmbot

283117

llvmbot avatar Oct 03 '16 17:10 llvmbot

I didn't manage to reproduce it locally with ToT and the last example. Here is the output in my case: ld.lld -o t2 1.bc 2.bc entry symbol _start not found, assuming 0 But it produces the output file successfully.

Rafael, I'm willing to review the patch.

Thanks. It is at https://reviews.llvm.org/D25184

llvmbot avatar Oct 03 '16 14:10 llvmbot

I didn't manage to reproduce it locally with ToT and the last example. Here is the output in my case: ld.lld -o t2 1.bc 2.bc entry symbol _start not found, assuming 0 But it produces the output file successfully.

Rafael, I'm willing to review the patch.

arpilipe avatar Oct 03 '16 14:10 arpilipe

I think I have a patch that at least avoids the LTO issue.

llvmbot avatar Oct 03 '16 14:10 llvmbot

This reduces to just

file1.llvm.ll: target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu" %foo = type { } declare <4 x %foo*> @​llvm.masked.load.v4p0foo.p0v4p0foo(<4 x %foo*>, i32, <4 x i1>, <4 x %foo>)

and

file2.llvm.ll target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu" %foo = type { } declare void @​foo( %foo* )

which crashes with

ld.lld -o t2 file2.llvm.bc file1.llvm.bc

llvmbot avatar Oct 01 '16 02:10 llvmbot

I'll take a look.

arpilipe avatar Sep 29 '16 10:09 arpilipe

I'm removing my name from this bug, since my commit only triggered an existing bug in address space casting of "masked.load" intrinsic. Artur should, probably, take it.

delena avatar Sep 29 '16 08:09 delena

The problem is that the second input's symbol table differs depending on whether we load it into a context on its own or into a context with the first input already loaded. In the latter case "%struct.sv" in the second input is renamed to "%struct.sv.1" because of a conflict with the "%struct.sv" in the first input. That causes us to take the branch at http://llvm-cs.pcc.me.uk/lib/IR/AutoUpgrade.cpp#179 and we rename the intrinsic to "masked.load.v4p0struct.sv.p0v4p0struct.sv.old", which causes the symbol table to change since that is not the name of an intrinsic function.

Most likely what needs to happen is that the "masked.load.v4p0struct.sv.p0v4p0struct.sv.old" function needs to be removed rather than being left in the module.

I am copying Artur Pilipenko, the author of the autoupgrade code for this intrinsic (https://reviews.llvm.org/D17270).

pcc avatar Sep 27 '16 20:09 pcc

Reproduced. Adding Peter who owns/developed the new LTO API where this is failing and is most familiar with it.

llvmbot avatar Sep 27 '16 16:09 llvmbot

I added LTO people to CC. Can anybody say me what's wrong with the input ll files? I'm trying to build llvmgold.so meanwhile.. Thank you.

delena avatar Sep 27 '16 16:09 delena

Yes, please provide a test case. It may be an unrelated bug in LTO, since I did not touch LTO in this patch at all.

delena avatar Sep 25 '16 13:09 delena

assigned to @arpilipe

llvmbot avatar Sep 24 '16 06:09 llvmbot