Skip to content

New test from #119056 fails on LLVM 18, might be okay? #119193

Closed

Description

@durin42

The new test from #119056 (tests/codegen/overaligned-constant.rs) is broken on LLVM 18, and I'm having trouble telling if it's actually a problem or just over-constrained output. Sample failure:

tests/codegen/overaligned-constant.rs:20:12: error: CHECK: expected string not found in input
 // CHECK: %b.1 = load i32, ptr getelementptr inbounds ({ i32, i32 }, ptr @0, i32 0, i32 1), align 4
           ^
build/x86_64-unknown-linux-gnu/test/codegen/overaligned-constant/overaligned-constant.ll:140:35: note: scanning from here
 %b.0 = load i32, ptr @0, align 4, !range !6, !noundef !5
                                  ^
build/x86_64-unknown-linux-gnu/test/codegen/overaligned-constant/overaligned-constant.ll:141:2: note: possible intended match here
 %b.1 = load i32, ptr getelementptr inbounds (i8, ptr @0, i64 4), align 4
 ^
full output here ``` Input file: build/x86_64-unknown-linux-gnu/test/codegen/overaligned-constant/overaligned-constant.ll Check file: tests/codegen/overaligned-constant.rs

-dump-input=help explains the following input dump.

Input was:
<<<<<<
.
.
.
40:
41: ; std::rt::lang_start::{{closure}}
42: ; Function Attrs: inlinehint nonlazybind uwtable
43: define internal noundef i32 @"ZN3std2rt10lang_start28$u7b$$u7b$closure$u7d$$u7d$17h509a9dffb4969685E"(ptr noalias noundef readonly align 8 dereferenceable(8) %_1) unnamed_addr #2 {
44: start:
45: %self = alloca i8, align 1
46: call void @llvm.lifetime.start.p0(i64 1, ptr %self)
47: %_4 = load ptr, ptr %_1, align 8, !nonnull !5, !noundef !5
48: ; call std::sys_common::backtrace::__rust_begin_short_backtrace
49: call void @_ZN3std10sys_common9backtrace28__rust_begin_short_backtrace17hbe21c0cb3c3b090eE(ptr noundef nonnull %_4)
50: ; call <() as std::process::Termination>::report
51: %0 = call noundef i8 @"ZN54$LT$$LP$$RP$$u20$as$u20$std..process..Termination$GT$6report17h98723923612101fdE"()
52: store i8 %0, ptr %self, align 1
53: %_6 = load i8, ptr %self, align 1, !noundef !5
54: %_0 = zext i8 %_6 to i32
55: call void @llvm.lifetime.end.p0(i64 1, ptr %self)
56: ret i32 %_0
57: }
58:
59: ; core::ops::function::FnOnce::call_once{{vtable.shim}}
60: ; Function Attrs: inlinehint nonlazybind uwtable
61: define internal noundef i32 @"_ZN4core3ops8function6FnOnce40call_once$u7b$$u7b$vtable.shim$u7d$$u7d$17h33be9ae6ef9d2796E"(ptr noundef %_1) unnamed_addr #2 {
62: start:
63: %_2 = alloca {}, align 1
64: %0 = load ptr, ptr %_1, align 8, !nonnull !5, !noundef !5
65: ; call core::ops::function::FnOnce::call_once
66: %_0 = call noundef i32 @_ZN4core3ops8function6FnOnce9call_once17hadf2b987a2452c12E(ptr noundef nonnull %0)
67: ret i32 %_0
68: }
69:
70: ; core::ops::function::FnOnce::call_once
71: ; Function Attrs: inlinehint nonlazybind uwtable
72: define internal void @_ZN4core3ops8function6FnOnce9call_once17h59a5b54d5316c601E(ptr noundef nonnull %_1) unnamed_addr #2 {
73: start:
74: %_2 = alloca {}, align 1
75: call void %_1()
76: ret void
77: }
78:
79: ; core::ops::function::FnOnce::call_once
80: ; Function Attrs: inlinehint nonlazybind uwtable
81: define internal noundef i32 @_ZN4core3ops8function6FnOnce9call_once17hadf2b987a2452c12E(ptr noundef nonnull %0) unnamed_addr #2 personality ptr @rust_eh_personality {
82: start:
83: %1 = alloca { ptr, i32, [1 x i32] }, align 8
84: %_2 = alloca {}, align 1
85: %_1 = alloca ptr, align 8
86: store ptr %0, ptr %_1, align 8
87: ; invoke std::rt::lang_start::{{closure}}
88: %_0 = invoke noundef i32 @"ZN3std2rt10lang_start28$u7b$$u7b$closure$u7d$$u7d$17h509a9dffb4969685E"(ptr noalias noundef readonly align 8 dereferenceable(8) %_1)
89: to label %bb1 unwind label %cleanup
90:
91: bb3: ; preds = %cleanup
92: %2 = load ptr, ptr %1, align 8, !noundef !5
93: %3 = getelementptr inbounds i8, ptr %1, i64 8
94: %4 = load i32, ptr %3, align 8, !noundef !5
95: call void @llvm.lifetime.end.p0(i64 16, ptr %1)
96: %5 = insertvalue { ptr, i32 } poison, ptr %2, 0
97: %6 = insertvalue { ptr, i32 } %5, i32 %4, 1
98: resume { ptr, i32 } %6
99:
100: cleanup: ; preds = %start
101: %7 = landingpad { ptr, i32 }
102: cleanup
103: %8 = extractvalue { ptr, i32 } %7, 0
104: %9 = extractvalue { ptr, i32 } %7, 1
105: call void @llvm.lifetime.start.p0(i64 16, ptr %1)
106: store ptr %8, ptr %1, align 8
107: %10 = getelementptr inbounds i8, ptr %1, i64 8
108: store i32 %9, ptr %10, align 8
109: br label %bb3
110:
111: bb1: ; preds = %start
112: ret i32 %_0
113: }
114:
115: ; core::ptr::drop_in_place<std::rt::lang_start<()>::{{closure}}>
116: ; Function Attrs: inlinehint nonlazybind uwtable
117: define internal void @"_ZN4core3ptr85drop_in_place$LT$std..rt..lang_start$LT$$LP$$RP$$GT$..$u7b$$u7b$closure$u7d$$u7d$$GT$17h767efc4c10aaa433E"(ptr noalias noundef align 8 dereferenceable(8) %_1) unnamed_addr #2 {
118: start:
119: ret void
120: }
121:
122: ; <() as std::process::Termination>::report
123: ; Function Attrs: inlinehint nonlazybind uwtable
124: define internal noundef i8 @"ZN54$LT$$LP$$RP$$u20$as$u20$std..process..Termination$GT$6report17h98723923612101fdE"() unnamed_addr #2 {
125: start:
126: ret i8 0
127: }
128:
129: ; overaligned_constant::main
130: ; Function Attrs: nonlazybind uwtable
131: define internal void @_ZN20overaligned_constant4main17he5ab63a0a863ce51E() unnamed_addr #1 {
132: start:
133: %_5 = alloca %SmallStruct, align 8
134: %s = alloca i32, align 4
135: call void @llvm.lifetime.start.p0(i64 4, ptr %s)
136: store i32 1, ptr %s, align 4
137: store i32 3, ptr %s, align 4
138: call void @llvm.lifetime.start.p0(i64 32, ptr %_5)
139: call void @llvm.memcpy.p0.p0.i64(ptr align 8 %_5, ptr align 8 @0, i64 32, i1 false)
140: %b.0 = load i32, ptr @0, align 4, !range !6, !noundef !5
check:20'0 X~~~~~~~~~~~~~~~~~~~~~~~ error: no match found
141: %b.1 = load i32, ptr getelementptr inbounds (i8, ptr @0, i64 4), align 4
check:20'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
check:20'1 ? possible intended match
142: %0 = getelementptr inbounds %SmallStruct, ptr %_5, i32 0, i32 1
check:20'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
143: %c.0 = load ptr, ptr %0, align 8, !nonnull !5, !align !7, !noundef !5
check:20'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
144: %1 = getelementptr inbounds i8, ptr %0, i64 8
check:20'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
145: %c.1 = load i64, ptr %1, align 8, !noundef !5
check:20'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
146: call void @llvm.lifetime.end.p0(i64 32, ptr %_5)
check:20'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
147: call void @llvm.lifetime.end.p0(i64 4, ptr %s)
check:20'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
148: ret void
check:20'0 ~~~~~~~~~~
149: }
check:20'0 ~~
150:
check:20'0 ~
151: ; std::rt::lang_start_internal
check:20'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
152: ; Function Attrs: nonlazybind uwtable
check:20'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
153: declare noundef i64 @_ZN3std2rt19lang_start_internal17h5487a73e9bd0fa19E(ptr noundef nonnull align 1, ptr noalias noundef readonly align 8 dereferenceable(24), i64 noundef, ptr noundef, i8 noundef) unnamed_addr #1
check:20'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
154:
check:20'0 ~
155: ; Function Attrs: nonlazybind uwtable
check:20'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
156: declare noundef i32 @rust_eh_personality(i32 noundef, i32 noundef, i64 noundef, ptr noundef, ptr noundef) unnamed_addr #1
check:20'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
157:
check:20'0 ~
158: ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
check:20'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
159: declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #3
check:20'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
160:
check:20'0 ~
161: ; Function Attrs: nonlazybind
check:20'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
162: define i32 @main(i32 %0, ptr %1) unnamed_addr #4 {
check:20'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
163: top:
check:20'0 ~~~~~
164: %2 = sext i32 %0 to i64
check:20'0 ~~~~~~~~~~~~~~~~~~~~~~~~~
165: ; call std::rt::lang_start
check:20'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~
166: %3 = call i64 @_ZN3std2rt10lang_start17ha9b08249fb3fc026E(ptr @_ZN20overaligned_constant4main17he5ab63a0a863ce51E, i64 %2, ptr %1, i8 0)
check:20'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
167: %4 = trunc i64 %3 to i32
check:20'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~
168: ret i32 %4
check:20'0 ~~~~~~~~~~~~
169: }
check:20'0 ~~
170:
check:20'0 ~
171: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
check:20'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
172: declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #5
check:20'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
173:
check:20'0 ~
174: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
check:20'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
175: declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #5
check:20'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
176:
check:20'0 ~
177: attributes #0 = { noinline nonlazybind uwtable "probe-stack"="inline-asm" "target-cpu"="x86-64" }
check:20'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
178: attributes #1 = { nonlazybind uwtable "probe-stack"="inline-asm" "target-cpu"="x86-64" }
check:20'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
179: attributes #2 = { inlinehint nonlazybind uwtable "probe-stack"="inline-asm" "target-cpu"="x86-64" }
check:20'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
180: attributes #3 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
check:20'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
181: attributes #4 = { nonlazybind "target-cpu"="x86-64" }
check:20'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
182: attributes #5 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
check:20'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
183:
check:20'0 ~
184: !llvm.module.flags = !{!0, !1, !2}
check:20'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
185: !llvm.ident = !{!3}
check:20'0 ~~~~~~~~~~~~~~~~~~~~
186:
check:20'0 ~
187: !0 = !{i32 8, !"PIC Level", i32 2}
check:20'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
188: !1 = !{i32 7, !"PIE Level", i32 2}
check:20'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
189: !2 = !{i32 2, !"RtLibUseGOT", i32 1}
check:20'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
190: !3 = !{!"rustc version 1.76.0-dev"}
check:20'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
191: !4 = !{i32 1149414}
check:20'0 ~~~~~~~~~~~~~~~~~~~~
192: !5 = !{}
check:20'0 ~~~~~~~~~
193: !6 = !{i32 0, i32 2}
check:20'0 ~~~~~~~~~~~~~~~~~~~~~
194: !7 = !{i64 4}
check:20'0 ~~~~~~~~~~~~~~


</details>

Does that look like it's alright? If I'm reading the test right it seems like the `align 4` is the significant part of the missed `CHECK`, so we're okay? If so, I can try and write a patch to ignore most of the `getelementptr` line there, I guess.

Activity

  1. added
    A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.
    on Dec 21, 2023
  2. added
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Dec 21, 2023
  3. nikic commented on Dec 21, 2023

    @nikic
    Contributor

    Looks like over-constrained output. A different but equivalent getelementptr is created and replacing it would a wildcard should be fine.

  4. added
    A-testsuiteArea: The testsuite used to check the correctness of rustc
    and removed
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Dec 21, 2023
  5. added 2 commits that reference this issue on Dec 22, 2023
    58fdbd1
    41fbd25
  6. added a commit that references this issue on Dec 22, 2023
    5f41792
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.A-testsuiteArea: The testsuite used to check the correctness of rustc

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions