Skip to content

Start using pattern types in libcore#136006

Open
oli-obk wants to merge 1 commit intorust-lang:mainfrom
oli-obk:push-tzonluoyuwkq
Open

Start using pattern types in libcore#136006
oli-obk wants to merge 1 commit intorust-lang:mainfrom
oli-obk:push-tzonluoyuwkq

Conversation

@oli-obk
Copy link
Contributor

@oli-obk oli-obk commented Jan 24, 2025

View all comments

cc #135996

Replaces the innards of NonNull with *const T is !null.

This does affect LLVM's optimizations, as now reading the field preserves the metadata that the field is not null, and transmuting to another type (e.g. just a raw pointer), will also preserve that information for optimizations. This can cause LLVM opts to do more work, but it's not guaranteed to produce better machine code.

Once we also remove all uses of rustc_layout_scalar_range_start from rustc itself, we can remove the support for that attribute entirely and handle all such needs via pattern types

@rustbot

This comment was marked as outdated.

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Jan 24, 2025
@oli-obk oli-obk added S-blocked Status: Blocked on something else such as an RFC or other implementation work. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 24, 2025
@rust-log-analyzer

This comment has been minimized.

Copy link
Contributor

@compiler-errors compiler-errors left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well r=me when/if it does get unblocked.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rustbot
Copy link
Collaborator

rustbot commented Jan 27, 2025

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

@Veykril
Copy link
Member

Veykril commented Jan 27, 2025

Re rust-analyzer blocker, as it turns out to implement pattern types (to a degree that would unblock this) it comes down to the same architecture changes required as for rust-lang/rust-analyzer#7434 (which I am currently looking into), so that will take a bit.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rustbot
Copy link
Collaborator

rustbot commented Jan 27, 2025

Some changes occurred to the CTFE machinery

cc @rust-lang/wg-const-eval

Some changes occurred to the CTFE / Miri interpreter

cc @rust-lang/miri

@rust-log-analyzer

This comment has been minimized.

@rustbot

This comment has been minimized.

@rustbot

This comment has been minimized.

@oli-obk
Copy link
Contributor Author

oli-obk commented Feb 13, 2026

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rust-bors

This comment has been minimized.

@rust-bors
Copy link
Contributor

rust-bors bot commented Feb 13, 2026

☀️ Try build successful (CI)
Build commit: 224f039 (224f0390307c2a60250e46665674e8530fa32631, parent: 47611e16044c68ef27bac31c35fda2ba1dc20b73)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (224f039): comparison URL.

Overall result: ❌✅ regressions and improvements - please read the text below

Benchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in compiler perf.

Next Steps: If you can justify the regressions found in this try perf run, please do so in sufficient writing along with @rustbot label: +perf-regression-triaged. If not, please fix the regressions and do another perf run. If its results are neutral or positive, the label will be automatically removed.

@bors rollup=never
@rustbot label: -S-waiting-on-perf +perf-regression

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
0.2% [0.2%, 0.2%] 1
Regressions ❌
(secondary)
0.5% [0.0%, 1.8%] 8
Improvements ✅
(primary)
-0.8% [-3.2%, -0.2%] 20
Improvements ✅
(secondary)
-1.1% [-1.8%, -0.1%] 5
All ❌✅ (primary) -0.7% [-3.2%, 0.2%] 21

Max RSS (memory usage)

Results (primary 2.5%, secondary -2.6%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
3.9% [2.4%, 5.7%] 4
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-2.9% [-2.9%, -2.9%] 1
Improvements ✅
(secondary)
-2.6% [-3.4%, -1.7%] 2
All ❌✅ (primary) 2.5% [-2.9%, 5.7%] 5

Cycles

Results (primary -2.5%, secondary -0.0%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
4.2% [2.4%, 8.3%] 4
Improvements ✅
(primary)
-2.5% [-2.5%, -2.5%] 1
Improvements ✅
(secondary)
-2.9% [-5.5%, -2.1%] 6
All ❌✅ (primary) -2.5% [-2.5%, -2.5%] 1

Binary size

Results (primary -0.1%, secondary 0.2%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
0.3% [0.0%, 0.9%] 9
Regressions ❌
(secondary)
1.0% [0.0%, 5.3%] 7
Improvements ✅
(primary)
-0.2% [-1.1%, -0.0%] 26
Improvements ✅
(secondary)
-0.1% [-0.9%, -0.0%] 22
All ❌✅ (primary) -0.1% [-1.1%, 0.9%] 35

Bootstrap: 482.691s -> 481.225s (-0.30%)
Artifact size: 398.13 MiB -> 396.21 MiB (-0.48%)

@oli-obk
Copy link
Contributor Author

oli-obk commented Feb 13, 2026

Hell yea

@rustbot ready

r? compiler

// Remember to use `.as_ptr()` instead of `.pointer`, as field projecting to
// this is banned by <https://github.com/rust-lang/compiler-team/issues/807>.
pointer: *const T,
pointer: crate::pattern_type!(*const T is !null),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm excited to do this, but it feels odd to me to have both cg_ssa changes and the change to the library type in one PR.

Would it maybe be feasible to split this to have zero library changes, just enough new test coverage to justify the compiler updates, then a follow-up no-compiler-review-needed change to the library part?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm, I guess the box elaboration needs to be in the same PR as the library change, doesn't it :/

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea... I can land some changes ahead of time, but I can only test them with a custom minicore

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gave this another try, I should be able to hit the cg_ssa changes with a test written on rustc today, but I'm missing some necessary component to actually go down this path. I tried https://play.rust-lang.org/?version=nightly&mode=debug&edition=2024&gist=72f945c494a52dbb039b2aff32453d41 (and we already have a test that this is a permutation of: https://github.com/rust-lang/rust/blob/main/tests/ui/type/pattern_types/unsize.rs

_12 = NonNull::<T> { pointer: copy _14 };
_15 = copy _14 as (*const T) is !null (Transmute);
StorageDead(_14);
_12 = NonNull::<T> { pointer: move _15 };
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not this PR's problem: looks like we should either avoid ever using NonNull(blah) in the library because that doesn't fold in GVN or should look at allowing constructors like this to fold with transmutes.

@rust-bors

This comment has been minimized.

@rustbot

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-bors

This comment has been minimized.

@rustbot
Copy link
Collaborator

rustbot commented Mar 2, 2026

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@oli-obk
Copy link
Contributor Author

oli-obk commented Mar 2, 2026

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rust-bors

This comment has been minimized.

@rust-log-analyzer
Copy link
Collaborator

The job aarch64-gnu-llvm-20-1 failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
/dev/sda15       98M  6.4M   92M   7% /boot/efi
tmpfs           1.6G   16K  1.6G   1% /run/user/1001
================================================================================

Sufficient disk space available (120307344KB >= 52428800KB). Skipping cleanup.
##[group]Run echo "[CI_PR_NUMBER=$num]"
echo "[CI_PR_NUMBER=$num]"
shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
---
set -ex

# Run a subset of tests. Used to run tests in parallel in multiple jobs.

# When this job partition is run as part of PR CI, skip tidy to allow revealing more failures. The
# dedicated `tidy` job failing won't block other PR CI jobs from completing, and so tidy failures
# shouldn't inhibit revealing other failures in PR CI jobs.
if [ "$PR_CI_JOB" == "1" ]; then
  echo "PR_CI_JOB set; skipping tidy"
  SKIP_TIDY="--skip tidy"
fi

../x.py --stage 2 test \
  ${SKIP_TIDY:+$SKIP_TIDY} \
  --skip compiler \
  --skip src
#!/bin/bash

set -ex

# Run a subset of tests. Used to run tests in parallel in multiple jobs.

# When this job partition is run as part of PR CI, skip tidy to allow revealing more failures. The
# dedicated `tidy` job failing won't block other PR CI jobs from completing, and so tidy failures
# shouldn't inhibit revealing other failures in PR CI jobs.
if [ "$PR_CI_JOB" == "1" ]; then
  echo "PR_CI_JOB set; skipping tidy"
  SKIP_TIDY="--skip tidy"
fi

../x.py --stage 2 test \
  ${SKIP_TIDY:+$SKIP_TIDY} \
  --skip tests \
  --skip coverage-map \
  --skip coverage-run \
  --skip library \
  --skip tidyselftest
---
Executing "/scripts/stage_2_test_set1.sh"
+ /scripts/stage_2_test_set1.sh
PR_CI_JOB set; skipping tidy
+ '[' 1 == 1 ']'
+ echo 'PR_CI_JOB set; skipping tidy'
+ SKIP_TIDY='--skip tidy'
+ ../x.py --stage 2 test --skip tidy --skip compiler --skip src
##[group]Building bootstrap
    Finished `dev` profile [unoptimized] target(s) in 0.04s
##[endgroup]
downloading https://static.rust-lang.org/dist/2026-01-21/rustfmt-nightly-aarch64-unknown-linux-gnu.tar.xz
---
test [ui] tests/ui/abi/abi-sysv64-register-usage.rs ... ignored, ignored when the architecture is aarch64
test [ui] tests/ui/abi/abi-typo-unstable.rs#feature_disabled ... ok
test [ui] tests/ui/abi/abi-typo-unstable.rs#feature_enabled ... ok
test [ui] tests/ui/abi/anon-extern-mod.rs ... ok
test [ui] tests/ui/abi/avr-sram.rs#disable_sram ... ok
test [ui] tests/ui/abi/avr-sram.rs#has_sram ... ok
test [ui] tests/ui/abi/arm-unadjusted-intrinsic.rs#aarch64 ... ok
test [ui] tests/ui/abi/avr-sram.rs#no_sram ... ok
test [ui] tests/ui/abi/arm-unadjusted-intrinsic.rs#arm ... ok
test [ui] tests/ui/abi/bad-custom.rs ... ok
test [ui] tests/ui/abi/c-stack-as-value.rs ... ok
test [ui] tests/ui/abi/c-zst.rs#powerpc-linux ... ok
test [ui] tests/ui/abi/c-zst.rs#aarch64-darwin ... ok
---
test [ui] tests/ui/asm/aarch64/may_unwind.rs ... ok
test [ui] tests/ui/asm/aarch64/type-check-3.rs ... ok
test [ui] tests/ui/asm/aarch64/type-check-2.rs ... ok
test [ui] tests/ui/asm/aarch64/type-f16.rs ... ok
test [ui] tests/ui/asm/aarch64v8r.rs#hf ... ok
test [ui] tests/ui/asm/aarch64v8r.rs#r82 ... ok
test [ui] tests/ui/asm/aarch64v8r.rs#sf ... ok
test [ui] tests/ui/asm/aarch64/sym.rs ... ok
test [ui] tests/ui/asm/asm-with-nested-closure.rs ... ok
test [ui] tests/ui/asm/binary_asm_labels.rs ... ignored, only executed when the architecture is x86_64
test [ui] tests/ui/asm/arm-low-dreg.rs ... ok
test [ui] tests/ui/asm/cfg-parse-error.rs ... ok
---
test [ui] tests/ui/const-generics/occurs-check/unused-substs-3.rs ... ok
test [ui] tests/ui/const-generics/ogca/basic-fail.rs ... ok
test [ui] tests/ui/const-generics/occurs-check/unused-substs-4.rs ... ok
test [ui] tests/ui/const-generics/occurs-check/unused-substs-5.rs ... ok
test [ui] tests/ui/const-generics/ogca/basic.rs ... ok
test [ui] tests/ui/const-generics/ogca/generic-param-rhs.rs ... ok
test [ui] tests/ui/const-generics/ogca/rhs-but-not-root.rs ... ok
test [ui] tests/ui/const-generics/ogca/coherence-ambiguous.rs ... ok
test [ui] tests/ui/const-generics/outer-lifetime-in-const-generic-default.rs ... ok
test [ui] tests/ui/const-generics/opaque_types.rs ... ok
test [ui] tests/ui/const-generics/opaque_types2.rs ... ok
test [ui] tests/ui/const-generics/overlapping_impls.rs ... ok
test [ui] tests/ui/const-generics/params-in-ct-in-ty-param-lazy-norm.rs#full ... ok
---
test [ui] tests/ui/extern/issue-64655-extern-rust-must-allow-unwind.rs#fat2 ... ok
test [ui] tests/ui/extern/issue-64655-extern-rust-must-allow-unwind.rs#fat3 ... ok
test [ui] tests/ui/extern/issue-80074.rs ... ok
test [ui] tests/ui/extern/issue-95829.rs ... ok
test [ui] tests/ui/extern/lgamma-linkage.rs ... ok
test [ui] tests/ui/extern/no-mangle-associated-fn.rs ... ok
test [ui] tests/ui/extern/not-in-block.rs ... ok
test [ui] tests/ui/extern/unsized-extern-derefmove.rs ... ok
test [ui] tests/ui/extern/windows-tcb-trash-13259.rs ... ok
test [ui] tests/ui/feature-gates/allow-features-empty.rs ... ok
---
test [ui] tests/ui/feature-gates/feature-gate-macro-derive.rs ... ok
test [ui] tests/ui/feature-gates/feature-gate-macro-metavar-expr-concat.rs ... ok
test [ui] tests/ui/feature-gates/feature-gate-marker_trait_attr.rs ... ok
test [ui] tests/ui/feature-gates/feature-gate-may-dangle.rs ... ok
test [ui] tests/ui/feature-gates/feature-gate-mgca-type-const-syntax.rs ... ok
test [ui] tests/ui/feature-gates/feature-gate-min-generic-const-args.rs ... ok
test [ui] tests/ui/feature-gates/feature-gate-movrs_target_feature.rs ... ignored, only executed when the architecture is x86_64
test [ui] tests/ui/feature-gates/feature-gate-min_const_fn.rs ... ok
test [ui] tests/ui/feature-gates/feature-gate-more-maybe-bounds.rs ... ok
test [ui] tests/ui/feature-gates/feature-gate-naked_functions_rustic_abi.rs ... ignored, only executed when the architecture is x86_64
---
test [ui] tests/ui/imports/ambiguous-7.rs ... ok
test [ui] tests/ui/imports/ambiguous-import-visibility-module.rs ... ok
test [ui] tests/ui/imports/ambiguous-8.rs ... ok
test [ui] tests/ui/imports/ambiguous-glob-vs-expanded-extern.rs ... ok
test [ui] tests/ui/imports/ambiguous-panic-glob-vs-multiouter.rs ... ok
test [ui] tests/ui/imports/ambiguous-panic-globvsglob.rs ... ok
test [ui] tests/ui/imports/ambiguous-panic-no-implicit-prelude.rs ... ok
test [ui] tests/ui/imports/ambiguous-panic-non-prelude-core-glob.rs ... ok
test [ui] tests/ui/imports/ambiguous-panic-non-prelude-std-glob.rs ... ok
test [ui] tests/ui/imports/ambiguous-panic-pick-core.rs ... ok
test [ui] tests/ui/imports/ambiguous-import-visibility-macro.rs ... ok
---
test [ui] tests/ui/layout/post-mono-layout-cycle.rs ... ok
test [ui] tests/ui/layout/randomize.rs#normal ... ok
test [ui] tests/ui/layout/randomize.rs#randomize-layout ... ok
test [ui] tests/ui/layout/null-pointer-optimization.rs ... ok
test [ui] tests/ui/layout/rigid-alias-due-to-broken-impl.rs ... ok
test [ui] tests/ui/layout/size-of-val-raw-too-big.rs ... ignored, only executed when the pointer width is 32bit (Layout computation rejects this layout for different reasons on 64-bit.)
test [ui] tests/ui/layout/reprc-power-alignment.rs ... ok
test [ui] tests/ui/layout/struct.rs ... ok
test [ui] tests/ui/layout/rust-call-abi-not-a-tuple-ice-81974.rs ... ok
test [ui] tests/ui/layout/rigid-alias-no-params.rs ... ok
---
------FileCheck stderr------------------------------
/checkout/tests/codegen-llvm/issues/for-loop-inner-assert-91109.rs:10:16: error: CHECK-NOT: excluded string found in input
 // CHECK-NOT: panic_bounds_check
               ^
/checkout/obj/build/aarch64-unknown-linux-gnu/test/codegen-llvm/issues/for-loop-inner-assert-91109/for-loop-inner-assert-91109.ll:64:25: note: found here
; call core::panicking::panic_bounds_check
                        ^~~~~~~~~~~~~~~~~~

Input file: /checkout/obj/build/aarch64-unknown-linux-gnu/test/codegen-llvm/issues/for-loop-inner-assert-91109/for-loop-inner-assert-91109.ll
Check file: /checkout/tests/codegen-llvm/issues/for-loop-inner-assert-91109.rs

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

Input was:
<<<<<<
        1: ; ModuleID = 'for_loop_inner_assert_91109.44854a692dda60a9-cgu.0' 
        2: source_filename = "for_loop_inner_assert_91109.44854a692dda60a9-cgu.0" 
        3: target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128-Fn32" 
        4: target triple = "aarch64-unknown-linux-gnu" 
        5:  
        6: %"alloc::vec::Vec<i32>" = type { i64, %"alloc::raw_vec::RawVec<i32>" } 
        7: %"alloc::raw_vec::RawVec<i32>" = type { %"alloc::raw_vec::RawVecInner", %"core::marker::PhantomData<i32>" } 
        8: %"alloc::raw_vec::RawVecInner" = type { ptr, i64, %"alloc::alloc::Global" } 
        9: %"alloc::alloc::Global" = type {} 
       10: %"core::marker::PhantomData<i32>" = type {} 
       11:  
       12: @alloc_8037057d752e95cb177947cdbddff6f8 = private unnamed_addr constant [67 x i8] c"/checkout/tests/codegen-llvm/issues/for-loop-inner-assert-91109.rs\00", align 1 
       13: @alloc_5d4e2812c9ea4048ad745e5e88543f81 = private unnamed_addr constant [33 x i8] c"assertion failed: d[i].len() == n", align 1 
       14: @alloc_efb41c7b440480510fa4e6566a6cf00e = private unnamed_addr constant <{ [4 x i8], [4 x i8], ptr, [12 x i8], [4 x i8] }> <{ [4 x i8] c"\0D\00\00\00", [4 x i8] undef, ptr @alloc_8037057d752e95cb177947cdbddff6f8, [12 x i8] c"B\00\00\00\00\00\00\00\09\00\00\00", [4 x i8] undef }>, align 8 
       15: @alloc_86236aae32091a6610ca0f26bf5fa9f7 = private unnamed_addr constant <{ [4 x i8], [4 x i8], ptr, [12 x i8], [4 x i8] }> <{ [4 x i8] c"\0F\00\00\00", [4 x i8] undef, ptr @alloc_8037057d752e95cb177947cdbddff6f8, [12 x i8] c"B\00\00\00\00\00\00\00\11\00\00\00", [4 x i8] undef }>, align 8 
       16:  
       17: ; Function Attrs: uwtable 
       18: define void @zero(ptr nocapture noundef nonnull readonly align 8 %d.0, i64 noundef range(i64 0, 384307168202282326) %d.1) unnamed_addr #0 { 
       19: start: 
       20:  %_147.not = icmp eq i64 %d.1, 0 
       21:  br i1 %_147.not, label %bb7, label %bb6 
       22:  
       23: bb1.loopexit: ; preds = %bb10 
       24:  %exitcond11.not = icmp eq i64 %0, %d.1 
       25:  br i1 %exitcond11.not, label %bb7, label %bb6 
       26:  
       27: bb7: ; preds = %bb1.loopexit, %start 
       28:  ret void 
       29:  
       30: bb6: ; preds = %start, %bb1.loopexit 
       31:  %iter.sroa.0.08 = phi i64 [ %0, %bb1.loopexit ], [ 0, %start ] 
       32:  %0 = add nuw nsw i64 %iter.sroa.0.08, 1 
       33:  %_7 = getelementptr inbounds nuw %"alloc::vec::Vec<i32>", ptr %d.0, i64 %iter.sroa.0.08 
       34:  %_6 = load i64, ptr %_7, align 8, !noundef !2 
       35:  %_18 = icmp ult i64 %_6, 2305843009213693952 
       36:  tail call void @llvm.assume(i1 %_18) 
       37:  %_5 = icmp eq i64 %_6, %d.1 
       38:  br i1 %_5, label %bb5.preheader, label %bb4, !prof !3 
       39:  
       40: bb5.preheader: ; preds = %bb6 
       41:  %1 = getelementptr inbounds nuw i8, ptr %_7, i64 8 
       42:  br label %bb8 
       43:  
       44: bb4: ; preds = %bb6 
       45: ; call core::panicking::panic 
       46:  tail call void @_RNvNtCs1oV0Iwofvl_4core9panicking5panic(ptr noalias noundef nonnull readonly align 1 @alloc_5d4e2812c9ea4048ad745e5e88543f81, i64 noundef 33, ptr noalias noundef nonnull readonly align 8 dereferenceable(32) @alloc_efb41c7b440480510fa4e6566a6cf00e) #4 
       47:  unreachable 
       48:  
       49: bb8: ; preds = %bb5.preheader, %bb10 
       50:  %iter1.sroa.0.06 = phi i64 [ 0, %bb5.preheader ], [ %2, %bb10 ] 
       51:  %_26 = load i64, ptr %_7, align 8, !noundef !2 
       52:  %_28 = icmp ult i64 %iter1.sroa.0.06, %_26 
       53:  br i1 %_28, label %bb10, label %panic2 
       54:  
       55: bb10: ; preds = %bb8 
       56:  %_27 = load ptr, ptr %1, align 8, !nonnull !2, !noundef !2 
       57:  %2 = add nuw nsw i64 %iter1.sroa.0.06, 1 
       58:  %_12 = getelementptr inbounds nuw i32, ptr %_27, i64 %iter1.sroa.0.06 
       59:  store i32 0, ptr %_12, align 4 
       60:  %exitcond.not = icmp eq i64 %2, %d.1 
       61:  br i1 %exitcond.not, label %bb1.loopexit, label %bb8 
       62:  
       63: panic2: ; preds = %bb8 
       64: ; call core::panicking::panic_bounds_check 
not:10                             !~~~~~~~~~~~~~~~~~  error: no match expected
       65:  tail call void @_RNvNtCs1oV0Iwofvl_4core9panicking18panic_bounds_check(i64 noundef %iter1.sroa.0.06, i64 noundef %_26, ptr noalias noundef nonnull readonly align 8 dereferenceable(32) @alloc_86236aae32091a6610ca0f26bf5fa9f7) #4 
       66:  unreachable 
       67: } 
       68:  
       69: ; core::panicking::panic_bounds_check 
       70: ; Function Attrs: cold minsize noinline noreturn optsize uwtable 
       71: declare void @_RNvNtCs1oV0Iwofvl_4core9panicking18panic_bounds_check(i64 noundef, i64 noundef, ptr noalias noundef readonly align 8 dereferenceable(32)) unnamed_addr #1 
       72:  
       73: ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) 
       74: declare void @llvm.assume(i1 noundef) #2 
       75:  
       76: ; core::panicking::panic 
       77: ; Function Attrs: cold noinline noreturn uwtable 
       78: declare void @_RNvNtCs1oV0Iwofvl_4core9panicking5panic(ptr noalias noundef nonnull readonly align 1, i64 noundef, ptr noalias noundef readonly align 8 dereferenceable(32)) unnamed_addr #3 
       79:  
       80: attributes #0 = { uwtable "frame-pointer"="non-leaf" "probe-stack"="inline-asm" "target-cpu"="generic" "target-features"="+v8a,+outline-atomics" } 
       81: attributes #1 = { cold minsize noinline noreturn optsize uwtable "frame-pointer"="non-leaf" "probe-stack"="inline-asm" "target-cpu"="generic" "target-features"="+v8a,+outline-atomics" } 
       82: attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) } 
       83: attributes #3 = { cold noinline noreturn uwtable "frame-pointer"="non-leaf" "probe-stack"="inline-asm" "target-cpu"="generic" "target-features"="+v8a,+outline-atomics" } 
       84: attributes #4 = { noinline noreturn } 
       85:  
       86: !llvm.module.flags = !{!0} 
       87: !llvm.ident = !{!1} 
       88:  
       89: !0 = !{i32 8, !"PIC Level", i32 2} 
       90: !1 = !{!"rustc version 1.96.0-nightly (977fb44ba 2026-03-02)"} 
       91: !2 = !{} 
       92: !3 = !{!"branch_weights", !"expected", i32 2000, i32 1} 
>>>>>>

------------------------------------------

error: verification with 'FileCheck' failed
status: exit status: 1
command: "/usr/lib/llvm-20/bin/FileCheck" "--input-file" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/codegen-llvm/issues/for-loop-inner-assert-91109/for-loop-inner-assert-91109.ll" "/checkout/tests/codegen-llvm/issues/for-loop-inner-assert-91109.rs" "--check-prefix=CHECK" "--allow-unused-prefixes" "--dump-input-context" "100"
stdout: none
--- stderr -------------------------------
/checkout/tests/codegen-llvm/issues/for-loop-inner-assert-91109.rs:10:16: error: CHECK-NOT: excluded string found in input
 // CHECK-NOT: panic_bounds_check
               ^
/checkout/obj/build/aarch64-unknown-linux-gnu/test/codegen-llvm/issues/for-loop-inner-assert-91109/for-loop-inner-assert-91109.ll:64:25: note: found here
; call core::panicking::panic_bounds_check
                        ^~~~~~~~~~~~~~~~~~

Input file: /checkout/obj/build/aarch64-unknown-linux-gnu/test/codegen-llvm/issues/for-loop-inner-assert-91109/for-loop-inner-assert-91109.ll
Check file: /checkout/tests/codegen-llvm/issues/for-loop-inner-assert-91109.rs

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

Input was:
<<<<<<
        1: ; ModuleID = 'for_loop_inner_assert_91109.44854a692dda60a9-cgu.0' 
        2: source_filename = "for_loop_inner_assert_91109.44854a692dda60a9-cgu.0" 
        3: target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128-Fn32" 
        4: target triple = "aarch64-unknown-linux-gnu" 
        5:  
        6: %"alloc::vec::Vec<i32>" = type { i64, %"alloc::raw_vec::RawVec<i32>" } 
        7: %"alloc::raw_vec::RawVec<i32>" = type { %"alloc::raw_vec::RawVecInner", %"core::marker::PhantomData<i32>" } 
        8: %"alloc::raw_vec::RawVecInner" = type { ptr, i64, %"alloc::alloc::Global" } 
        9: %"alloc::alloc::Global" = type {} 
       10: %"core::marker::PhantomData<i32>" = type {} 
       11:  
       12: @alloc_8037057d752e95cb177947cdbddff6f8 = private unnamed_addr constant [67 x i8] c"/checkout/tests/codegen-llvm/issues/for-loop-inner-assert-91109.rs\00", align 1 
       13: @alloc_5d4e2812c9ea4048ad745e5e88543f81 = private unnamed_addr constant [33 x i8] c"assertion failed: d[i].len() == n", align 1 
       14: @alloc_efb41c7b440480510fa4e6566a6cf00e = private unnamed_addr constant <{ [4 x i8], [4 x i8], ptr, [12 x i8], [4 x i8] }> <{ [4 x i8] c"\0D\00\00\00", [4 x i8] undef, ptr @alloc_8037057d752e95cb177947cdbddff6f8, [12 x i8] c"B\00\00\00\00\00\00\00\09\00\00\00", [4 x i8] undef }>, align 8 
       15: @alloc_86236aae32091a6610ca0f26bf5fa9f7 = private unnamed_addr constant <{ [4 x i8], [4 x i8], ptr, [12 x i8], [4 x i8] }> <{ [4 x i8] c"\0F\00\00\00", [4 x i8] undef, ptr @alloc_8037057d752e95cb177947cdbddff6f8, [12 x i8] c"B\00\00\00\00\00\00\00\11\00\00\00", [4 x i8] undef }>, align 8 
       16:  
       17: ; Function Attrs: uwtable 
       18: define void @zero(ptr nocapture noundef nonnull readonly align 8 %d.0, i64 noundef range(i64 0, 384307168202282326) %d.1) unnamed_addr #0 { 
       19: start: 
       20:  %_147.not = icmp eq i64 %d.1, 0 
       21:  br i1 %_147.not, label %bb7, label %bb6 
       22:  
       23: bb1.loopexit: ; preds = %bb10 
       24:  %exitcond11.not = icmp eq i64 %0, %d.1 
       25:  br i1 %exitcond11.not, label %bb7, label %bb6 
       26:  
       27: bb7: ; preds = %bb1.loopexit, %start 
       28:  ret void 
       29:  
       30: bb6: ; preds = %start, %bb1.loopexit 
       31:  %iter.sroa.0.08 = phi i64 [ %0, %bb1.loopexit ], [ 0, %start ] 
       32:  %0 = add nuw nsw i64 %iter.sroa.0.08, 1 
       33:  %_7 = getelementptr inbounds nuw %"alloc::vec::Vec<i32>", ptr %d.0, i64 %iter.sroa.0.08 
       34:  %_6 = load i64, ptr %_7, align 8, !noundef !2 
       35:  %_18 = icmp ult i64 %_6, 2305843009213693952 
       36:  tail call void @llvm.assume(i1 %_18) 
       37:  %_5 = icmp eq i64 %_6, %d.1 
       38:  br i1 %_5, label %bb5.preheader, label %bb4, !prof !3 
       39:  
       40: bb5.preheader: ; preds = %bb6 
       41:  %1 = getelementptr inbounds nuw i8, ptr %_7, i64 8 
       42:  br label %bb8 
       43:  
       44: bb4: ; preds = %bb6 
       45: ; call core::panicking::panic 
       46:  tail call void @_RNvNtCs1oV0Iwofvl_4core9panicking5panic(ptr noalias noundef nonnull readonly align 1 @alloc_5d4e2812c9ea4048ad745e5e88543f81, i64 noundef 33, ptr noalias noundef nonnull readonly align 8 dereferenceable(32) @alloc_efb41c7b440480510fa4e6566a6cf00e) #4 
       47:  unreachable 
       48:  
       49: bb8: ; preds = %bb5.preheader, %bb10 
       50:  %iter1.sroa.0.06 = phi i64 [ 0, %bb5.preheader ], [ %2, %bb10 ] 
       51:  %_26 = load i64, ptr %_7, align 8, !noundef !2 
       52:  %_28 = icmp ult i64 %iter1.sroa.0.06, %_26 
       53:  br i1 %_28, label %bb10, label %panic2 
       54:  
       55: bb10: ; preds = %bb8 
       56:  %_27 = load ptr, ptr %1, align 8, !nonnull !2, !noundef !2 
       57:  %2 = add nuw nsw i64 %iter1.sroa.0.06, 1 
       58:  %_12 = getelementptr inbounds nuw i32, ptr %_27, i64 %iter1.sroa.0.06 
       59:  store i32 0, ptr %_12, align 4 
       60:  %exitcond.not = icmp eq i64 %2, %d.1 
       61:  br i1 %exitcond.not, label %bb1.loopexit, label %bb8 
       62:  
       63: panic2: ; preds = %bb8 
       64: ; call core::panicking::panic_bounds_check 
not:10                             !~~~~~~~~~~~~~~~~~  error: no match expected
       65:  tail call void @_RNvNtCs1oV0Iwofvl_4core9panicking18panic_bounds_check(i64 noundef %iter1.sroa.0.06, i64 noundef %_26, ptr noalias noundef nonnull readonly align 8 dereferenceable(32) @alloc_86236aae32091a6610ca0f26bf5fa9f7) #4 
       66:  unreachable 
       67: } 
       68:  
       69: ; core::panicking::panic_bounds_check 
       70: ; Function Attrs: cold minsize noinline noreturn optsize uwtable 
       71: declare void @_RNvNtCs1oV0Iwofvl_4core9panicking18panic_bounds_check(i64 noundef, i64 noundef, ptr noalias noundef readonly align 8 dereferenceable(32)) unnamed_addr #1 
       72:  
       73: ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) 
       74: declare void @llvm.assume(i1 noundef) #2 
       75:  
       76: ; core::panicking::panic 
       77: ; Function Attrs: cold noinline noreturn uwtable 
       78: declare void @_RNvNtCs1oV0Iwofvl_4core9panicking5panic(ptr noalias noundef nonnull readonly align 1, i64 noundef, ptr noalias noundef readonly align 8 dereferenceable(32)) unnamed_addr #3 
       79:  
       80: attributes #0 = { uwtable "frame-pointer"="non-leaf" "probe-stack"="inline-asm" "target-cpu"="generic" "target-features"="+v8a,+outline-atomics" } 
       81: attributes #1 = { cold minsize noinline noreturn optsize uwtable "frame-pointer"="non-leaf" "probe-stack"="inline-asm" "target-cpu"="generic" "target-features"="+v8a,+outline-atomics" } 
       82: attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) } 
       83: attributes #3 = { cold noinline noreturn uwtable "frame-pointer"="non-leaf" "probe-stack"="inline-asm" "target-cpu"="generic" "target-features"="+v8a,+outline-atomics" } 
       84: attributes #4 = { noinline noreturn } 
       85:  
       86: !llvm.module.flags = !{!0} 
       87: !llvm.ident = !{!1} 
       88:  
       89: !0 = !{i32 8, !"PIC Level", i32 2} 
       90: !1 = !{!"rustc version 1.96.0-nightly (977fb44ba 2026-03-02)"} 
       91: !2 = !{} 
       92: !3 = !{!"branch_weights", !"expected", i32 2000, i32 1} 
>>>>>>
------------------------------------------

---- [codegen] tests/codegen-llvm/issues/for-loop-inner-assert-91109.rs stdout end ----
---- [codegen] tests/codegen-llvm/vec-reserve-extend.rs stdout ----
------FileCheck stdout------------------------------

------FileCheck stderr------------------------------
/checkout/tests/codegen-llvm/vec-reserve-extend.rs:10:16: error: CHECK-NOT: excluded string found in input
 // CHECK-NOT: call {{.*}}reserve
               ^
/checkout/obj/build/aarch64-unknown-linux-gnu/test/codegen-llvm/vec-reserve-extend/vec-reserve-extend.ll:333:3: note: found here
; call <alloc::raw_vec::RawVecInner<_>>::reserve::do_reserve_and_handle::<alloc::alloc::Global>
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/checkout/tests/codegen-llvm/vec-reserve-extend.rs:11:16: error: CHECK-NOT: excluded string found in input
 // CHECK-NOT: call {{.*}}do_reserve_and_handle
               ^
/checkout/obj/build/aarch64-unknown-linux-gnu/test/codegen-llvm/vec-reserve-extend/vec-reserve-extend.ll:333:3: note: found here
; call <alloc::raw_vec::RawVecInner<_>>::reserve::do_reserve_and_handle::<alloc::alloc::Global>
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Input file: /checkout/obj/build/aarch64-unknown-linux-gnu/test/codegen-llvm/vec-reserve-extend/vec-reserve-extend.ll
Check file: /checkout/tests/codegen-llvm/vec-reserve-extend.rs

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

Input was:
<<<<<<
        .
        .
        .
      233: ; <usize as core::fmt::Debug>::fmt 
      234: ; Function Attrs: inlinehint uwtable 
      235: define internal noundef zeroext i1 @_RNvXsZ_NtNtCs1oV0Iwofvl_4core3fmt3numjNtB7_5Debug3fmt(ptr noalias noundef readonly align 8 dereferenceable(8) %self, ptr noalias noundef align 8 dereferenceable(24) %f) unnamed_addr #2 { 
      236: start: 
      237:  %0 = getelementptr inbounds nuw i8, ptr %f, i64 20 
      238:  %_4 = load i32, ptr %0, align 4, !noundef !4 
      239:  %_3 = and i32 %_4, 33554432 
      240:  %1 = icmp eq i32 %_3, 0 
      241:  br i1 %1, label %bb2, label %bb1 
      242:  
      243: bb2: ; preds = %start 
      244:  %_5 = and i32 %_4, 67108864 
      245:  %2 = icmp eq i32 %_5, 0 
      246:  br i1 %2, label %bb4, label %bb3 
      247:  
      248: bb1: ; preds = %start 
      249: ; call <usize as core::fmt::LowerHex>::fmt 
      250:  %3 = tail call noundef zeroext i1 @_RNvXs6_NtNtCs1oV0Iwofvl_4core3fmt3numjNtB7_8LowerHex3fmt(ptr noalias noundef nonnull readonly align 8 dereferenceable(8) %self, ptr noalias noundef nonnull align 8 dereferenceable(24) %f) 
      251:  br label %bb6 
      252:  
      253: bb4: ; preds = %bb2 
      254: ; call <usize as core::fmt::Display>::fmt 
      255:  %4 = tail call noundef zeroext i1 @_RNvXsi_NtNtNtCs1oV0Iwofvl_4core3fmt3num3impjNtB9_7Display3fmt(ptr noalias noundef nonnull readonly align 8 dereferenceable(8) %self, ptr noalias noundef nonnull align 8 dereferenceable(24) %f) 
      256:  br label %bb6 
      257:  
      258: bb3: ; preds = %bb2 
      259: ; call <usize as core::fmt::UpperHex>::fmt 
      260:  %5 = tail call noundef zeroext i1 @_RNvXs8_NtNtCs1oV0Iwofvl_4core3fmt3numjNtB7_8UpperHex3fmt(ptr noalias noundef nonnull readonly align 8 dereferenceable(8) %self, ptr noalias noundef nonnull align 8 dereferenceable(24) %f) 
      261:  br label %bb6 
      262:  
      263: bb6: ; preds = %bb4, %bb3, %bb1 
      264:  %_0.sroa.0.0.in = phi i1 [ %4, %bb4 ], [ %5, %bb3 ], [ %3, %bb1 ] 
      265:  ret i1 %_0.sroa.0.0.in 
      266: } 
      267:  
      268: ; Function Attrs: uwtable 
      269: define void @should_reserve_once(ptr nocapture noundef nonnull align 8 %v) unnamed_addr #1 personality ptr @rust_eh_personality { 
      270: start: 
      271:  %self3.i.i = alloca [24 x i8], align 8 
      272:  %e.i = alloca [16 x i8], align 8 
      273:  %_6 = load i64, ptr %v, align 8, !noundef !4 
      274:  %_7 = getelementptr inbounds nuw i8, ptr %v, i64 8 
      275:  %0 = getelementptr inbounds nuw i8, ptr %v, i64 16 
      276:  %self4.i = load i64, ptr %0, align 8, !range !3, !noundef !4 
      277:  %_11.i = sub i64 %self4.i, %_6 
      278:  %_5.i = icmp ult i64 %_11.i, 3 
      279:  br i1 %_5.i, label %bb1.i, label %_RINvMsj_NtCsfqfa6G1Caf3_5alloc3vecINtB6_3VechE14extend_trustedINtNtNtCs1oV0Iwofvl_4core5array4iter8IntoIterhKj3_EECseHTl9kyFgP7_18vec_reserve_extend.exit 
      280:  
      281: bb1.i: ; preds = %start 
      282:  %_28.1.i.i = icmp ugt i64 %_6, -4 
      283:  br i1 %_28.1.i.i, label %bb2.i, label %bb12.i.i 
      284:  
      285: bb12.i.i: ; preds = %bb1.i 
      286:  %_28.0.i.i = add nuw i64 %_6, 3 
      287:  %1 = shl nuw i64 %self4.i, 1 
      288:  %_0.sroa.0.0.sroa.speculated.i.i.i = tail call noundef i64 @llvm.umax.i64(i64 %_28.0.i.i, i64 range(i64 0, -1) %1) 
      289:  %_0.sroa.0.0.sroa.speculated.i15.i.i = tail call noundef i64 @llvm.umax.i64(i64 %_0.sroa.0.0.sroa.speculated.i.i.i, i64 8) 
      290:  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %self3.i.i) 
      291:  %self.val.i.i = load ptr, ptr %_7, align 8 
      292: ; call <alloc::raw_vec::RawVecInner>::finish_grow 
      293:  call fastcc void @_RNvMs4_NtCsfqfa6G1Caf3_5alloc7raw_vecNtB5_11RawVecInner11finish_growCseHTl9kyFgP7_18vec_reserve_extend(ptr noalias noundef align 8 dereferenceable(24) %self3.i.i, ptr %self.val.i.i, i64 %self4.i, i64 noundef %_0.sroa.0.0.sroa.speculated.i15.i.i) 
      294:  %_40.i.i = load i64, ptr %self3.i.i, align 8, !range !5, !noundef !4 
      295:  %2 = trunc nuw i64 %_40.i.i to i1 
      296:  %3 = getelementptr inbounds nuw i8, ptr %self3.i.i, i64 8 
      297:  br i1 %2, label %bb21.i.i, label %_RNvMNtCs1oV0Iwofvl_4core6resultINtB2_6ResultuNtNtCsfqfa6G1Caf3_5alloc11collections15TryReserveErrorE6unwrapCseHTl9kyFgP7_18vec_reserve_extend.exit 
      298:  
      299: bb21.i.i: ; preds = %bb12.i.i 
      300:  %e.0.i.i = load i64, ptr %3, align 8 
      301:  %4 = getelementptr inbounds nuw i8, ptr %self3.i.i, i64 16 
      302:  %e.1.i.i = load i64, ptr %4, align 8, !range !6, !noundef !4 
      303:  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %self3.i.i) 
      304:  br label %bb2.i 
      305:  
      306: bb2.i: ; preds = %bb1.i, %bb21.i.i 
      307:  %_0.sroa.3.0.i.ph = phi i64 [ %e.1.i.i, %bb21.i.i ], [ 0, %bb1.i ] 
      308:  %_0.sroa.0.0.i.ph = phi i64 [ %e.0.i.i, %bb21.i.i ], [ undef, %bb1.i ] 
      309:  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %e.i) 
      310:  store i64 %_0.sroa.0.0.i.ph, ptr %e.i, align 8 
      311:  %5 = getelementptr inbounds nuw i8, ptr %e.i, i64 8 
      312:  store i64 %_0.sroa.3.0.i.ph, ptr %5, align 8 
      313: ; call core::result::unwrap_failed 
      314:  call void @_RNvNtCs1oV0Iwofvl_4core6result13unwrap_failed(ptr noalias noundef nonnull readonly align 1 @alloc_00ae4b301f7fab8ac9617c03fcbd7274, i64 noundef 43, ptr noundef nonnull align 1 %e.i, ptr noalias noundef nonnull readonly align 8 dereferenceable(32) @vtable.0, ptr noalias noundef nonnull readonly align 8 dereferenceable(32) @alloc_cc3a80780a963fdd6152f98049ba4edc) #13 
      315:  unreachable 
      316:  
      317: _RNvMNtCs1oV0Iwofvl_4core6resultINtB2_6ResultuNtNtCsfqfa6G1Caf3_5alloc11collections15TryReserveErrorE6unwrapCseHTl9kyFgP7_18vec_reserve_extend.exit: ; preds = %bb12.i.i 
      318:  %v.0.i.i = load ptr, ptr %3, align 8, !nonnull !4, !noundef !4 
      319:  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %self3.i.i) 
      320:  store ptr %v.0.i.i, ptr %_7, align 8 
      321:  %6 = icmp sgt i64 %_0.sroa.0.0.sroa.speculated.i15.i.i, -1 
      322:  tail call void @llvm.assume(i1 %6) 
      323:  store i64 %_0.sroa.0.0.sroa.speculated.i15.i.i, ptr %0, align 8 
      324:  %.pre.i = sub i64 %_0.sroa.0.0.sroa.speculated.i15.i.i, %_6 
      325:  %7 = icmp ugt i64 %.pre.i, 2 
      326:  %len.i.i.pre = load i64, ptr %v, align 8, !noalias !15 
      327:  %.pre = sub i64 %_0.sroa.0.0.sroa.speculated.i15.i.i, %len.i.i.pre 
      328:  %8 = icmp ult i64 %.pre, 3 
      329:  tail call void @llvm.assume(i1 %7) 
      330:  br i1 %8, label %bb1.i.i, label %_RINvMsj_NtCsfqfa6G1Caf3_5alloc3vecINtB6_3VechE14extend_trustedINtNtNtCs1oV0Iwofvl_4core5array4iter8IntoIterhKj3_EECseHTl9kyFgP7_18vec_reserve_extend.exit, !prof !18 
      331:  
      332: bb1.i.i: ; preds = %_RNvMNtCs1oV0Iwofvl_4core6resultINtB2_6ResultuNtNtCsfqfa6G1Caf3_5alloc11collections15TryReserveErrorE6unwrapCseHTl9kyFgP7_18vec_reserve_extend.exit 
      333: ; call <alloc::raw_vec::RawVecInner<_>>::reserve::do_reserve_and_handle::<alloc::alloc::Global> 
not:10       !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                                     error: no match expected
not:11       !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                          error: no match expected
      334:  tail call fastcc void @_RINvNvMs2_NtCsfqfa6G1Caf3_5alloc7raw_vecINtB8_11RawVecInnerpE7reserve21do_reserve_and_handleNtNtBa_5alloc6GlobalECseHTl9kyFgP7_18vec_reserve_extend(ptr noundef nonnull align 8 %_7, i64 noundef %len.i.i.pre, i64 noundef 3) 
      335:  %_38.pre.i = load i64, ptr %v, align 8, !noalias !15 
      336:  br label %_RINvMsj_NtCsfqfa6G1Caf3_5alloc3vecINtB6_3VechE14extend_trustedINtNtNtCs1oV0Iwofvl_4core5array4iter8IntoIterhKj3_EECseHTl9kyFgP7_18vec_reserve_extend.exit 
      337:  
      338: _RINvMsj_NtCsfqfa6G1Caf3_5alloc3vecINtB6_3VechE14extend_trustedINtNtNtCs1oV0Iwofvl_4core5array4iter8IntoIterhKj3_EECseHTl9kyFgP7_18vec_reserve_extend.exit: ; preds = %start, %bb1.i.i, %_RNvMNtCs1oV0Iwofvl_4core6resultINtB2_6ResultuNtNtCsfqfa6G1Caf3_5alloc11collections15TryReserveErrorE6unwrapCseHTl9kyFgP7_18vec_reserve_extend.exit 
      339:  %_38.i = phi i64 [ %_38.pre.i, %bb1.i.i ], [ %len.i.i.pre, %_RNvMNtCs1oV0Iwofvl_4core6resultINtB2_6ResultuNtNtCsfqfa6G1Caf3_5alloc11collections15TryReserveErrorE6unwrapCseHTl9kyFgP7_18vec_reserve_extend.exit ], [ %_6, %start ] 
      340:  %_37.i = load ptr, ptr %_7, align 8, !noalias !15, !nonnull !4, !noundef !4 
      341:  %scevgep.i.i = getelementptr i8, ptr %_37.i, i64 %_38.i 
      342:  store i8 1, ptr %scevgep.i.i, align 1, !noalias !19 
      343:  %_8.sroa.6.16.scevgep.i.i.sroa_idx = getelementptr inbounds nuw i8, ptr %scevgep.i.i, i64 1 
      344:  store i8 2, ptr %_8.sroa.6.16.scevgep.i.i.sroa_idx, align 1, !noalias !19 
      345:  %_8.sroa.7.16.scevgep.i.i.sroa_idx = getelementptr inbounds nuw i8, ptr %scevgep.i.i, i64 2 
      346:  store i8 3, ptr %_8.sroa.7.16.scevgep.i.i.sroa_idx, align 1, !noalias !19 
      347:  %9 = add i64 %_38.i, 3 
      348:  store i64 %9, ptr %v, align 8, !noalias !29 
      349:  ret void 
      350: } 
      351:  
      352: ; Function Attrs: nounwind uwtable 
      353: declare noundef range(i32 0, 10) i32 @rust_eh_personality(i32 noundef, i32 noundef, i64 noundef, ptr noundef, ptr noundef) unnamed_addr #3 
      354:  
      355: ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) 
      356: declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #4 
      357:  
      358: ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) 
      359: declare void @llvm.assume(i1 noundef) #5 
      360:  
      361: ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) 
      362: declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #4 
      363:  
      364: ; core::panicking::panic_fmt 
      365: ; Function Attrs: cold noinline noreturn uwtable 
      366: declare void @_RNvNtCs1oV0Iwofvl_4core9panicking9panic_fmt(ptr noundef nonnull, ptr noundef nonnull, ptr noalias noundef readonly align 8 dereferenceable(32)) unnamed_addr #6 
      367:  
      368: ; alloc::raw_vec::handle_error 
      369: ; Function Attrs: cold minsize noreturn optsize uwtable 
      370: declare void @_RNvNtCsfqfa6G1Caf3_5alloc7raw_vec12handle_error(i64, i64 noundef range(i64 0, -9223372036854775807)) unnamed_addr #7 
      371:  
      372: ; core::panicking::panic 
      373: ; Function Attrs: cold noinline noreturn uwtable 
      374: declare void @_RNvNtCs1oV0Iwofvl_4core9panicking5panic(ptr noalias noundef nonnull readonly align 1, i64 noundef, ptr noalias noundef readonly align 8 dereferenceable(32)) unnamed_addr #6 
      375:  
      376: ; core::result::unwrap_failed 
      377: ; Function Attrs: cold noinline noreturn uwtable 
      378: declare void @_RNvNtCs1oV0Iwofvl_4core6result13unwrap_failed(ptr noalias noundef nonnull readonly align 1, i64 noundef, ptr noundef nonnull align 1, ptr noalias noundef readonly align 8 dereferenceable(32), ptr noalias noundef readonly align 8 dereferenceable(32)) unnamed_addr #6 
      379:  
      380: ; __rustc::__rust_realloc 
      381: ; Function Attrs: nounwind allockind("realloc,aligned") allocsize(3) uwtable 
      382: declare noalias noundef ptr @_RNvCs3c3FMyhdKjM_7___rustc14___rust_realloc(ptr allocptr noundef nonnull, i64 noundef, i64 allocalign noundef range(i64 1, -9223372036854775807), i64 noundef) unnamed_addr #8 
      383:  
      384: ; __rustc::__rust_no_alloc_shim_is_unstable_v2 
      385: ; Function Attrs: nounwind uwtable 
      386: declare void @_RNvCs3c3FMyhdKjM_7___rustc35___rust_no_alloc_shim_is_unstable_v2() unnamed_addr #3 
      387:  
      388: ; __rustc::__rust_alloc 
      389: ; Function Attrs: nounwind allockind("alloc,uninitialized,aligned") allocsize(0) uwtable 
      390: declare noalias noundef ptr @_RNvCs3c3FMyhdKjM_7___rustc12___rust_alloc(i64 noundef, i64 allocalign noundef range(i64 1, -9223372036854775807)) unnamed_addr #9 
      391:  
      392: ; <core::ptr::alignment::Alignment as core::fmt::Debug>::fmt 
      393: ; Function Attrs: uwtable 
      394: declare noundef zeroext i1 @_RNvXs_NtNtCs1oV0Iwofvl_4core3ptr9alignmentNtB4_9AlignmentNtNtB8_3fmt5Debug3fmt(ptr noalias noundef readonly align 8 dereferenceable(8), ptr noalias noundef align 8 dereferenceable(24)) unnamed_addr #1 
      395:  
      396: ; <core::fmt::Formatter>::debug_struct_field2_finish 
      397: ; Function Attrs: uwtable 
      398: declare noundef zeroext i1 @_RNvMsa_NtCs1oV0Iwofvl_4core3fmtNtB5_9Formatter26debug_struct_field2_finish(ptr noalias noundef align 8 dereferenceable(24), ptr noalias noundef nonnull readonly align 1, i64 noundef, ptr noalias noundef nonnull readonly align 1, i64 noundef, ptr noundef nonnull align 1, ptr noalias noundef readonly align 8 dereferenceable(32), ptr noalias noundef nonnull readonly align 1, i64 noundef, ptr noundef nonnull align 1, ptr noalias noundef readonly align 8 dereferenceable(32)) unnamed_addr #1 
      399:  
      400: ; <core::fmt::Formatter>::debug_struct_field1_finish 
      401: ; Function Attrs: uwtable 
      402: declare noundef zeroext i1 @_RNvMsa_NtCs1oV0Iwofvl_4core3fmtNtB5_9Formatter26debug_struct_field1_finish(ptr noalias noundef align 8 dereferenceable(24), ptr noalias noundef nonnull readonly align 1, i64 noundef, ptr noalias noundef nonnull readonly align 1, i64 noundef, ptr noundef nonnull align 1, ptr noalias noundef readonly align 8 dereferenceable(32)) unnamed_addr #1 
      403:  
      404: ; <core::fmt::Formatter>::write_str 
      405: ; Function Attrs: uwtable 
      406: declare noundef zeroext i1 @_RNvMsa_NtCs1oV0Iwofvl_4core3fmtNtB5_9Formatter9write_str(ptr noalias noundef align 8 dereferenceable(24), ptr noalias noundef nonnull readonly align 1, i64 noundef) unnamed_addr #1 
      407:  
      408: ; <usize as core::fmt::Display>::fmt 
      409: ; Function Attrs: uwtable 
      410: declare noundef zeroext i1 @_RNvXsi_NtNtNtCs1oV0Iwofvl_4core3fmt3num3impjNtB9_7Display3fmt(ptr noalias noundef readonly align 8 dereferenceable(8), ptr noalias noundef align 8 dereferenceable(24)) unnamed_addr #1 
      411:  
      412: ; <usize as core::fmt::UpperHex>::fmt 
      413: ; Function Attrs: uwtable 
      414: declare noundef zeroext i1 @_RNvXs8_NtNtCs1oV0Iwofvl_4core3fmt3numjNtB7_8UpperHex3fmt(ptr noalias noundef readonly align 8 dereferenceable(8), ptr noalias noundef align 8 dereferenceable(24)) unnamed_addr #1 
      415:  
      416: ; <usize as core::fmt::LowerHex>::fmt 
      417: ; Function Attrs: uwtable 
      418: declare noundef zeroext i1 @_RNvXs6_NtNtCs1oV0Iwofvl_4core3fmt3numjNtB7_8LowerHex3fmt(ptr noalias noundef readonly align 8 dereferenceable(8), ptr noalias noundef align 8 dereferenceable(24)) unnamed_addr #1 
      419:  
      420: ; <core::fmt::Formatter>::pad 
      421: ; Function Attrs: uwtable 
      422: declare noundef zeroext i1 @_RNvMsa_NtCs1oV0Iwofvl_4core3fmtNtB5_9Formatter3pad(ptr noalias noundef align 8 dereferenceable(24), ptr noalias noundef nonnull readonly align 1, i64 noundef) unnamed_addr #1 
      423:  
      424: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: readwrite) 
      425: declare void @llvm.experimental.noalias.scope.decl(metadata) #10 
      426:  
      427: ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) 
      428: declare i64 @llvm.umax.i64(i64, i64) #11 
      429:  
      430: attributes #0 = { cold uwtable "frame-pointer"="non-leaf" "probe-stack"="inline-asm" "target-cpu"="generic" "target-features"="+v8a,+outline-atomics" } 
      431: attributes #1 = { uwtable "frame-pointer"="non-leaf" "probe-stack"="inline-asm" "target-cpu"="generic" "target-features"="+v8a,+outline-atomics" } 
      432: attributes #2 = { inlinehint uwtable "frame-pointer"="non-leaf" "probe-stack"="inline-asm" "target-cpu"="generic" "target-features"="+v8a,+outline-atomics" } 
      433: attributes #3 = { nounwind uwtable "frame-pointer"="non-leaf" "probe-stack"="inline-asm" "target-cpu"="generic" "target-features"="+v8a,+outline-atomics" } 
        .
        .
        .
>>>>>>

------------------------------------------

error: verification with 'FileCheck' failed
status: exit status: 1
command: "/usr/lib/llvm-20/bin/FileCheck" "--input-file" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/codegen-llvm/vec-reserve-extend/vec-reserve-extend.ll" "/checkout/tests/codegen-llvm/vec-reserve-extend.rs" "--check-prefix=CHECK" "--allow-unused-prefixes" "--dump-input-context" "100"
stdout: none
--- stderr -------------------------------
/checkout/tests/codegen-llvm/vec-reserve-extend.rs:10:16: error: CHECK-NOT: excluded string found in input
 // CHECK-NOT: call {{.*}}reserve
               ^
/checkout/obj/build/aarch64-unknown-linux-gnu/test/codegen-llvm/vec-reserve-extend/vec-reserve-extend.ll:333:3: note: found here
; call <alloc::raw_vec::RawVecInner<_>>::reserve::do_reserve_and_handle::<alloc::alloc::Global>
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/checkout/tests/codegen-llvm/vec-reserve-extend.rs:11:16: error: CHECK-NOT: excluded string found in input
 // CHECK-NOT: call {{.*}}do_reserve_and_handle
               ^
/checkout/obj/build/aarch64-unknown-linux-gnu/test/codegen-llvm/vec-reserve-extend/vec-reserve-extend.ll:333:3: note: found here
; call <alloc::raw_vec::RawVecInner<_>>::reserve::do_reserve_and_handle::<alloc::alloc::Global>
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Input file: /checkout/obj/build/aarch64-unknown-linux-gnu/test/codegen-llvm/vec-reserve-extend/vec-reserve-extend.ll
Check file: /checkout/tests/codegen-llvm/vec-reserve-extend.rs

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

Input was:
<<<<<<
        .
        .
        .
      233: ; <usize as core::fmt::Debug>::fmt 
      234: ; Function Attrs: inlinehint uwtable 
      235: define internal noundef zeroext i1 @_RNvXsZ_NtNtCs1oV0Iwofvl_4core3fmt3numjNtB7_5Debug3fmt(ptr noalias noundef readonly align 8 dereferenceable(8) %self, ptr noalias noundef align 8 dereferenceable(24) %f) unnamed_addr #2 { 
      236: start: 
      237:  %0 = getelementptr inbounds nuw i8, ptr %f, i64 20 
      238:  %_4 = load i32, ptr %0, align 4, !noundef !4 
      239:  %_3 = and i32 %_4, 33554432 

@rust-bors
Copy link
Contributor

rust-bors bot commented Mar 2, 2026

☀️ Try build successful (CI)
Build commit: 339a92e (339a92ed90cab1177510feacee981e87fa5f004c, parent: 8d50bccc5bd70be9f5a2fc98c0857e24b3dcdf85)

@rust-timer

This comment has been minimized.

@oli-obk
Copy link
Contributor Author

oli-obk commented Mar 2, 2026

Oh no the changes from #152702 had subtle effects on what LLVM sees when pattern types are used inside NonNull, so now some opts don't work anymore

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (339a92e): comparison URL.

Overall result: ❌✅ regressions and improvements - please read the text below

Benchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in compiler perf.

Next Steps: If you can justify the regressions found in this try perf run, please do so in sufficient writing along with @rustbot label: +perf-regression-triaged. If not, please fix the regressions and do another perf run. If its results are neutral or positive, the label will be automatically removed.

@bors rollup=never
@rustbot label: -S-waiting-on-perf +perf-regression

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
0.5% [0.2%, 0.6%] 8
Regressions ❌
(secondary)
1.1% [0.3%, 2.5%] 18
Improvements ✅
(primary)
-0.8% [-3.4%, -0.1%] 91
Improvements ✅
(secondary)
-0.6% [-10.0%, -0.0%] 87
All ❌✅ (primary) -0.7% [-3.4%, 0.6%] 99

Max RSS (memory usage)

Results (primary 0.8%, secondary -0.2%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
5.6% [3.1%, 8.5%] 3
Regressions ❌
(secondary)
4.5% [1.8%, 6.4%] 3
Improvements ✅
(primary)
-4.0% [-4.5%, -3.6%] 3
Improvements ✅
(secondary)
-3.7% [-7.5%, -0.9%] 4
All ❌✅ (primary) 0.8% [-4.5%, 8.5%] 6

Cycles

Results (primary -1.8%, secondary -2.8%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
1.7% [1.7%, 1.7%] 1
Regressions ❌
(secondary)
4.5% [4.5%, 4.5%] 1
Improvements ✅
(primary)
-2.2% [-2.5%, -1.9%] 9
Improvements ✅
(secondary)
-3.4% [-9.4%, -1.2%] 12
All ❌✅ (primary) -1.8% [-2.5%, 1.7%] 10

Binary size

Results (primary -0.1%, secondary -0.4%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
0.2% [0.1%, 0.2%] 9
Regressions ❌
(secondary)
0.2% [0.0%, 0.5%] 4
Improvements ✅
(primary)
-0.2% [-0.3%, -0.1%] 11
Improvements ✅
(secondary)
-1.6% [-3.1%, -0.1%] 2
All ❌✅ (primary) -0.1% [-0.3%, 0.2%] 20

Bootstrap: 479.657s -> 474.169s (-1.14%)
Artifact size: 396.97 MiB -> 393.93 MiB (-0.76%)

@oli-obk
Copy link
Contributor Author

oli-obk commented Mar 2, 2026

Ok that is some nice perf, but is it just costing runtime perf?

@oli-obk
Copy link
Contributor Author

oli-obk commented Mar 4, 2026

Oh no the changes from #152702 had subtle effects on what LLVM sees when pattern types are used inside NonNull, so now some opts don't work anymore

basically this PR doesn't change the MIR of

pub fn zero(d: &mut [Vec<i32>]) {
    let n = d.len();
    for i in 0..n {
        assert!(d[i].len() == n);
        for j in 0..n {
            d[i][j] = 0;
        }
    }
}

at all.

The MIR of it contains no function calls, it's fully inlined. So the only thing that can cause a regression here is the fact that somewhere we transmute across pattern type and LLVM chokes on that, even tho the pattern type never shows up in MIR.

@oli-obk
Copy link
Contributor Author

oli-obk commented Mar 4, 2026

Oh no the changes from #152702 had subtle effects on what LLVM sees when pattern types are used inside NonNull, so now some opts don't work anymore

nope that's not it. I reverted all of it and it didn't affect anything.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. A-test-infra-minicore Area: `minicore` test auxiliary and `//@ add-core-stubs` A-testsuite Area: The testsuite used to check the correctness of rustc O-unix Operating system: Unix-like O-wasi Operating system: Wasi, Webassembly System Interface O-wasm Target: WASM (WebAssembly), http://webassembly.org/ perf-regression Performance regression. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-clippy Relevant to the Clippy team. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. T-rustfmt Relevant to the rustfmt team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.