-
Notifications
You must be signed in to change notification settings - Fork 13.3k
LLVM assertion with -C lto -g -O
on static lib
#23566
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
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 ( |
@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? |
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. |
This no longer causes an assert on nightly, so closing as fixed. Yay! |
The crash that happened in rust-lang#23566 doesn't happen anymore with the LLVM mergefunc pass enabled and it hugely reduces code size (for example it shaves off 10% of the final Servo executable). This patch reenables it.
Reenable the MergeFunctions pass The crash that happened in #23566 doesn't happen anymore with the LLVM mergefunc pass enabled and it hugely reduces code size (for example it shaves off 10% of the final Servo executable). This patch reenables it. For those wondering, [here are the docs from LLVM about this pass](http://llvm.org/docs/MergeFunctions.html).
The crash that happened in rust-lang#23566 doesn't happen anymore with the LLVM mergefunc pass enabled and it hugely reduces code size (for example it shaves off 10% of the final Servo executable). This patch reenables it.
Reenable the MergeFunctions pass The crash that happened in #23566 doesn't happen anymore with the LLVM mergefunc pass enabled and it hugely reduces code size (for example it shaves off 10% of the final Servo executable). This patch reenables it. For those wondering, [here are the docs from LLVM about this pass](http://llvm.org/docs/MergeFunctions.html).
STR
Output
cc @michaelwoerister Same error message as #17677, but I don't know if it's the same bug, this one needs
-O
.The text was updated successfully, but these errors were encountered: