LLVM 24: vec-reserve-extend test failing
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
Sample failure:
/workspace/tests/codegen-llvm/vec-reserve-extend.rs:10:16: error: CHECK-NOT: excluded string found in input
// CHECK-NOT: call {{.*}}reserve
^
/workspace/build/x86_64-unknown-linux-gnu/test/codegen-llvm/vec-reserve-extend/vec-reserve-extend.ll:306:3: note: found here
; call <alloc::raw_vec::RawVecInner<_>>::reserve::do_reserve_and_handle::<alloc::alloc::Global>
based on some digging, I think this is from llvm/llvm-project@7a3aa7da4c02 - truthfully I'm not sure if it's a bug in the optimizer change or if we need to sprinkle some more hints for LLVM into the code on our side. New IR output:
; Function Attrs: nonlazybind uwtable
define void @should_reserve_once(ptr noalias nofree noundef align 8 captures(none) dereferenceable(24) %v) unnamed_addr #2 personality ptr @rust_eh_personality !guid !45 {
start:
%self3.i.i = alloca [24 x i8], align 8
%e.i = alloca [16 x i8], align 8
%0 = getelementptr inbounds nuw i8, ptr %v, i64 16
%_6 = load i64, ptr %0, align 8, !noundef !28
tail call void @llvm.experimental.noalias.scope.decl(metadata !46)
%self4.i = load i64, ptr %v, align 8, !range !27, !alias.scope !46, !noundef !28
%_11.i = sub i64 %self4.i, %_6
%_5.i = icmp ult i64 %_11.i, 3
br i1 %_5.i, label %bb1.i, label %_RINvMsk_NtCsbrQcgdVahqB_5alloc3vecINtB6_3VechE14extend_trustedINtNtNtCs9cuWXJ791ES_4core5array4iter8IntoIterhKj3_EECseHTl9kyFgP7_18vec_reserve_extend.exit
bb1.i: ; preds = %start
tail call void @llvm.experimental.noalias.scope.decl(metadata !49)
%_25.1.i.i = icmp ugt i64 %_6, -4
br i1 %_25.1.i.i, label %bb2.i, label %bb9.i.i
bb9.i.i: ; preds = %bb1.i
%_25.0.i.i = add nuw i64 %_6, 3
%v16.i.i = shl nuw i64 %self4.i, 1
%..i.i.i = tail call noundef i64 @llvm.umax.i64(i64 %_25.0.i.i, i64 range(i64 0, -1) %v16.i.i)
%..i16.i.i = tail call noundef i64 @llvm.umax.i64(i64 %..i.i.i, i64 8)
call void @llvm.lifetime.start.p0(ptr nonnull %self3.i.i), !noalias !52
%1 = getelementptr inbounds nuw i8, ptr %v, i64 8
%self.val15.i.i = load ptr, ptr %1, align 8, !alias.scope !52
; call <alloc::raw_vec::RawVecInner>::finish_grow
call fastcc void @_RNvMs5_NtCsbrQcgdVahqB_5alloc7raw_vecNtB5_11RawVecInner11finish_growCseHTl9kyFgP7_18vec_reserve_extend(ptr noalias nofree noundef align 8 captures(none) dereferenceable(24) %self3.i.i, i64 %self4.i, ptr %self.val15.i.i, i64 noundef %..i16.i.i)
%_37.i.i = load i64, ptr %self3.i.i, align 8, !range !29, !noalias !52, !noundef !28
%2 = trunc nuw i64 %_37.i.i to i1
%3 = getelementptr inbounds nuw i8, ptr %self3.i.i, i64 8
br i1 %2, label %bb18.i.i, label %_RNvMNtCs9cuWXJ791ES_4core6resultINtB2_6ResultuNtNtCsbrQcgdVahqB_5alloc11collections15TryReserveErrorE6unwrapCseHTl9kyFgP7_18vec_reserve_extend.exit
bb18.i.i: ; preds = %bb9.i.i
%e.0.i.i = load i64, ptr %3, align 8, !range !30, !noalias !52, !noundef !28
%4 = getelementptr inbounds nuw i8, ptr %self3.i.i, i64 16
%e.1.i.i = load i64, ptr %4, align 8, !noalias !52
call void @llvm.lifetime.end.p0(ptr nonnull %self3.i.i), !noalias !52
br label %bb2.i
bb2.i: ; preds = %bb1.i, %bb18.i.i
%_0.sroa.3.0.i.ph = phi i64 [ %e.1.i.i, %bb18.i.i ], [ undef, %bb1.i ]
%_0.sroa.0.0.i.ph = phi i64 [ %e.0.i.i, %bb18.i.i ], [ 0, %bb1.i ]
call void @llvm.lifetime.start.p0(ptr nonnull %e.i)
store i64 %_0.sroa.0.0.i.ph, ptr %e.i, align 8
%5 = getelementptr inbounds nuw i8, ptr %e.i, i64 8
store i64 %_0.sroa.3.0.i.ph, ptr %5, align 8
; call core::result::unwrap_failed
call void @_RNvNtCs9cuWXJ791ES_4core6result13unwrap_failed(ptr noalias nofree noundef nonnull readonly captures(address, read_provenance) @alloc_00ae4b301f7fab8ac9617c03fcbd7274, i64 noundef 43, ptr noundef nonnull %e.i, ptr noalias nofree noundef readonly align 8 captures(address, read_provenance) dereferenceable(32) @vtable.0, ptr noalias nofree noundef readonly align 8 captures(address, read_provenance) dereferenceable(24) @alloc_11754d6f2273df2df0dcb4d09d8ddd63) #15
unreachable
_RNvMNtCs9cuWXJ791ES_4core6resultINtB2_6ResultuNtNtCsbrQcgdVahqB_5alloc11collections15TryReserveErrorE6unwrapCseHTl9kyFgP7_18vec_reserve_extend.exit: ; preds = %bb9.i.i
%v.0.i.i = load ptr, ptr %3, align 8, !noalias !52, !nonnull !28, !noundef !28
call void @llvm.lifetime.end.p0(ptr nonnull %self3.i.i), !noalias !52
store ptr %v.0.i.i, ptr %1, align 8, !alias.scope !52
%6 = icmp sgt i64 %..i16.i.i, -1
tail call void @llvm.assume(i1 %6)
store i64 %..i16.i.i, ptr %v, align 8, !alias.scope !52
%.pre = sub i64 %..i16.i.i, %_6
%7 = icmp ult i64 %.pre, 3
tail call void @llvm.experimental.noalias.scope.decl(metadata !53)
br i1 %7, label %bb1.i.i, label %_RINvMsk_NtCsbrQcgdVahqB_5alloc3vecINtB6_3VechE14extend_trustedINtNtNtCs9cuWXJ791ES_4core5array4iter8IntoIterhKj3_EECseHTl9kyFgP7_18vec_reserve_extend.exit, !prof !56
bb1.i.i: ; preds = %_RNvMNtCs9cuWXJ791ES_4core6resultINtB2_6ResultuNtNtCsbrQcgdVahqB_5alloc11collections15TryReserveErrorE6unwrapCseHTl9kyFgP7_18vec_reserve_extend.exit
; call <alloc::raw_vec::RawVecInner<_>>::reserve::do_reserve_and_handle::<alloc::alloc::Global>
tail call fastcc void @_RINvNvMs2_NtCsbrQcgdVahqB_5alloc7raw_vecINtB8_11RawVecInnerpE7reserve21do_reserve_and_handleNtNtBa_5alloc6GlobalECseHTl9kyFgP7_18vec_reserve_extend(ptr noalias nofree noundef nonnull align 8 dereferenceable(24) %v, i64 noundef %_6, i64 noundef 3)
%_27.pre.i = load i64, ptr %0, align 8, !alias.scope !53, !noalias !57
br label %_RINvMsk_NtCsbrQcgdVahqB_5alloc3vecINtB6_3VechE14extend_trustedINtNtNtCs9cuWXJ791ES_4core5array4iter8IntoIterhKj3_EECseHTl9kyFgP7_18vec_reserve_extend.exit
_RINvMsk_NtCsbrQcgdVahqB_5alloc3vecINtB6_3VechE14extend_trustedINtNtNtCs9cuWXJ791ES_4core5array4iter8IntoIterhKj3_EECseHTl9kyFgP7_18vec_reserve_extend.exit: ; preds = %start, %bb1.i.i, %_RNvMNtCs9cuWXJ791ES_4core6resultINtB2_6ResultuNtNtCsbrQcgdVahqB_5alloc11collections15TryReserveErrorE6unwrapCseHTl9kyFgP7_18vec_reserve_extend.exit
%_27.i = phi i64 [ %_27.pre.i, %bb1.i.i ], [ %_6, %_RNvMNtCs9cuWXJ791ES_4core6resultINtB2_6ResultuNtNtCsbrQcgdVahqB_5alloc11collections15TryReserveErrorE6unwrapCseHTl9kyFgP7_18vec_reserve_extend.exit ], [ %_6, %start ]
%8 = getelementptr inbounds nuw i8, ptr %v, i64 8
%_26.i = load ptr, ptr %8, align 8, !alias.scope !53, !noalias !57, !nonnull !28, !noundef !28
%scevgep.i.i.i = getelementptr i8, ptr %_26.i, i64 %_27.i
store i8 1, ptr %scevgep.i.i.i, align 1, !noalias !59
%_8.sroa.6.16.scevgep.i.i.i.sroa_idx = getelementptr inbounds nuw i8, ptr %scevgep.i.i.i, i64 1
store i8 2, ptr %_8.sroa.6.16.scevgep.i.i.i.sroa_idx, align 1, !noalias !59
%_8.sroa.7.16.scevgep.i.i.i.sroa_idx = getelementptr inbounds nuw i8, ptr %scevgep.i.i.i, i64 2
store i8 3, ptr %_8.sroa.7.16.scevgep.i.i.i.sroa_idx, align 1, !noalias !59
%9 = add i64 %_27.i, 3
store i64 %9, ptr %0, align 8, !alias.scope !53, !noalias !69
ret void
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with tests/codegen-llvm/vec-reserve-extend.rs and run the failing codegen-LLVM test to reproduce the CHECK-NOT failure. Compare the generated IR with the behavior introduced by llvm/llvm-project@7a3aa7da4c02, then determine whether the test expectation or Rust-side LLVM guidance is incorrect. Done means the test passes on LLVM 24 with the intended single-reserve behavior validated.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers, testing
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100