llvm-project
llvm-project copied to clipboard
InstructionCombine error when monolithic LTO used
Monolithic LTO bug results in call to f() being erased by InstCombinerImpl::visitUnreachableInst
// File f.c
extern void __attribute__((noreturn))f();
extern volatile int b,c,d,e;
int main() {
if (b) {
c = 1;
} else {
d = 2;
}
e = 1;
e = 2;
e = 3;
f(); // CALL IS DELETED
e = 5;
return 0;
}
// file g.c
volatile int b=1,c,d,e;
void __attribute__((noreturn))f() {
while(1) {
c++;
}
}
Sorry, saved lto somehow erroneously deleted llvm:instcombine label - will fix
Could you clarify what the issue is? The fact that the call to f() is removed?
@markschimmel would it be possible to extract the LLVM IR module before instcombine removes the call, e.g. using -mllvm -print-before=instcombine -mllvm -print-module-scope? Depending on what linker you use you may have to thread them through to the LTO plugin using -Wl or something like that.