Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upLLVM assertion with `-C lto -g -O` on static lib #23566
Comments
jdm
added
A-debuginfo
I-ICE
labels
Mar 20, 2015
This comment has been minimized.
This comment has been minimized.
|
I reduced the test case to: #![crate_type = "staticlib"]
pub fn set1(x: &mut u32) { *x = 123 }
pub fn set2(x: &mut u32) { *x = 123 }The compiler options are the same ( |
This comment has been minimized.
This comment has been minimized.
|
@rprichard Thanks for the reduced test case!
Yeah, I was under the impression that this may be the cause.
Could be, I'm not familiar with LLVM to confirm this. @dotdash ^^^ do you know if LLVM has an optimization pass that does that? |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Yes, the mergefunc pass does that. The problem here seems to be that mergefunc turns After optimizations: define void @_ZN4set120h703cb75c1e01d663eaaE(i32* noalias nocapture dereferenceable(4)) unnamed_addr #0 {
entry-block:
tail call void @llvm.dbg.value(metadata i32* %0, i64 0, metadata !14, metadata !20), !dbg !21
store i32 123, i32* %0, align 4, !dbg !22
ret void, !dbg !21
}
define void @_ZN4set220h34cbfe792e780cc1paaE(i32* noalias nocapture dereferenceable(4)) unnamed_addr #0 {
tail call void @_ZN4set120h703cb75c1e01d663eaaE(i32* %0)
ret void
}After LTO: define void @_ZN4set120h703cb75c1e01d663eaaE(i32* noalias nocapture dereferenceable(4)) unnamed_addr #0 {
entry-block:
tail call void @llvm.dbg.value(metadata i32* %0, i64 0, metadata !14, metadata !20), !dbg !21
store i32 123, i32* %0, align 4, !dbg !22
ret void, !dbg !21
}
define void @_ZN4set220h34cbfe792e780cc1paaE(i32* noalias nocapture dereferenceable(4)) unnamed_addr #0 {
tail call void @llvm.dbg.value(metadata i32* %0, i64 0, metadata !14, metadata !20), !dbg !21
store i32 123, i32* %0, align 4, !dbg !22, !alias.scope !24
ret void
}Relevant metadata: !4 = !{!"0x2e\00set1\00set1\00_ZN10issue235664set1E\002\000\001\000\000\00256\001\002", !5, !6, !7, null, void (i32*)* @_ZN4set120h703cb75c1e01d663eaaE, !2, null, !13} ; [ DW_TAG_subprogram ] [line 2] [def] [set1]
!21 = !MDLocation(line: 2, scope: !4)So both functions claim to have the scope of Changing pub fn2(x: &mut u32) { set1(x) }Triggers the inlining even without mergefunc, and we get: define void @_Z4set2Pi(i32* nocapture %x) #0 {
tail call void @llvm.dbg.value(metadata i32* %x, i64 0, metadata !14, metadata !18), !dbg !26
tail call void @llvm.dbg.value(metadata i32* %x, i64 0, metadata !27, metadata !18), !dbg !29
store i32 123, i32* %x, align 4, !dbg !30, !tbaa !21
ret void, !dbg !31
}I suppose the re-declaration of For now, I suppose that it would be sensible to disable mergefunc when compiling with debug information. |
dotdash
referenced this issue
Apr 9, 2015
Closed
Assertion DISubprogram(Scope).describes(MF->getFunction()) failed #24220
petrochenkov
referenced this issue
May 10, 2015
Closed
Test run-pass\sepcomp-lib-lto.rs fails with ODR violation in debug mode #25270
dotdash
referenced this issue
May 19, 2015
Closed
sepcomp-lib-lto test fails with --enable-llvm-assertions #25617
This comment has been minimized.
This comment has been minimized.
|
This no longer causes an assert on nightly, so closing as fixed. Yay! |
japaric commentedMar 20, 2015
STR
Output
cc @michaelwoerister Same error message as #17677, but I don't know if it's the same bug, this one needs
-O.