Skip to content

[LV] Apply urem folds to preheader - #213928

Open
david-arm wants to merge 2 commits into
llvm:mainfrom
david-arm:fix_compile_time
Open

[LV] Apply urem folds to preheader#213928
david-arm wants to merge 2 commits into
llvm:mainfrom
david-arm:fix_compile_time

Conversation

@david-arm

Copy link
Copy Markdown
Contributor

Following on from PR #212198, this patch also applies the same urem vplan folds to the vector preheader, which leads to a lot of test changes that are mostly mechanical.

As a by-product it also fixes a compile-time regression introduced by #212198 due to the expensive getVectorPreheader function.

In future we can do further folds similar to instcombine, since (X - (X & Y)) --> (X & ~Y) and we know that urem(X, PowerOf2Y) -> X & log2(PowerOf2Y). However, the root matching pattern in this case needs to be a subtract.

Following on from PR llvm#212198, this patch also applies the same
urem vplan folds to the vector preheader, which leads to a lot
of test changes that are mostly mechanical.
@llvmorg-github-actions

llvmorg-github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown

@llvm/pr-subscribers-backend-risc-v
@llvm/pr-subscribers-vectorizers
@llvm/pr-subscribers-backend-powerpc
@llvm/pr-subscribers-backend-systemz

@llvm/pr-subscribers-llvm-transforms

Author: David Sherwood (david-arm)

Changes

Following on from PR #212198, this patch also applies the same urem vplan folds to the vector preheader, which leads to a lot of test changes that are mostly mechanical.

As a by-product it also fixes a compile-time regression introduced by #212198 due to the expensive getVectorPreheader function.

In future we can do further folds similar to instcombine, since (X - (X & Y)) --> (X & ~Y) and we know that urem(X, PowerOf2Y) -> X & log2(PowerOf2Y). However, the root matching pattern in this case needs to be a subtract.


Patch is 1.29 MiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/213928.diff

353 Files Affected:

  • (modified) llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp (+1-4)
  • (modified) llvm/test/Transforms/LoopVectorize/AArch64/aggressive-interleaving.ll (+5-5)
  • (modified) llvm/test/Transforms/LoopVectorize/AArch64/blend-costs.ll (+1-1)
  • (modified) llvm/test/Transforms/LoopVectorize/AArch64/bounded-load.ll (+17-17)
  • (modified) llvm/test/Transforms/LoopVectorize/AArch64/call-costs.ll (+3-3)
  • (modified) llvm/test/Transforms/LoopVectorize/AArch64/clmul.ll (+1-1)
  • (modified) llvm/test/Transforms/LoopVectorize/AArch64/conditional-branches-cost.ll (+3-3)
  • (modified) llvm/test/Transforms/LoopVectorize/AArch64/conditional-scalar-assignment.ll (+3-3)
  • (modified) llvm/test/Transforms/LoopVectorize/AArch64/deterministic-type-shrinkage.ll (+2-2)
  • (modified) llvm/test/Transforms/LoopVectorize/AArch64/epilog-iv-live-outs.ll (+14-14)
  • (modified) llvm/test/Transforms/LoopVectorize/AArch64/epilog-iv-select-cmp.ll (+12-12)
  • (modified) llvm/test/Transforms/LoopVectorize/AArch64/epilog-vectorization-factors.ll (+6-6)
  • (modified) llvm/test/Transforms/LoopVectorize/AArch64/epilog-vectorization-widen-inductions.ll (+8-8)
  • (modified) llvm/test/Transforms/LoopVectorize/AArch64/epilogue-vectorization-fix-scalar-resume-values.ll (+7-7)
  • (modified) llvm/test/Transforms/LoopVectorize/AArch64/f128-fmuladd-reduction.ll (+1-1)
  • (modified) llvm/test/Transforms/LoopVectorize/AArch64/find-last-iv-sinkable-expr-epilogue.ll (+5-5)
  • (modified) llvm/test/Transforms/LoopVectorize/AArch64/fixed-order-recurrence.ll (+2-2)
  • (modified) llvm/test/Transforms/LoopVectorize/AArch64/fmax-without-fast-math-flags.ll (+2-2)
  • (modified) llvm/test/Transforms/LoopVectorize/AArch64/fmin-without-fast-math-flags.ll (+1-1)
  • (modified) llvm/test/Transforms/LoopVectorize/AArch64/force-target-instruction-cost.ll (+6-6)
  • (modified) llvm/test/Transforms/LoopVectorize/AArch64/gather-cost.ll (+8-8)
  • (modified) llvm/test/Transforms/LoopVectorize/AArch64/gather-do-not-vectorize-addressing.ll (+1-1)
  • (modified) llvm/test/Transforms/LoopVectorize/AArch64/induction-costs-sve.ll (+7-7)
  • (modified) llvm/test/Transforms/LoopVectorize/AArch64/induction-costs.ll (+21-21)
  • (modified) llvm/test/Transforms/LoopVectorize/AArch64/indvar-overflow-check-scalable-tc.ll (+3-3)
  • (modified) llvm/test/Transforms/LoopVectorize/AArch64/interleave-with-gaps.ll (+11-11)
  • (modified) llvm/test/Transforms/LoopVectorize/AArch64/interleaving-load-store.ll (+5-5)
  • (modified) llvm/test/Transforms/LoopVectorize/AArch64/interleaving-reduction.ll (+4-4)
  • (modified) llvm/test/Transforms/LoopVectorize/AArch64/intrinsiccost.ll (+4-5)
  • (modified) llvm/test/Transforms/LoopVectorize/AArch64/load-cast-context.ll (+3-3)
  • (modified) llvm/test/Transforms/LoopVectorize/AArch64/loop-vectorization-factors.ll (+14-14)
  • (modified) llvm/test/Transforms/LoopVectorize/AArch64/low_trip_count_predicates.ll (+6-6)
  • (modified) llvm/test/Transforms/LoopVectorize/AArch64/masked-call-scalarize.ll (+1-1)
  • (modified) llvm/test/Transforms/LoopVectorize/AArch64/masked-call.ll (+1-1)
  • (modified) llvm/test/Transforms/LoopVectorize/AArch64/optsize_minsize.ll (+1-1)
  • (modified) llvm/test/Transforms/LoopVectorize/AArch64/partial-reduce-chained.ll (+12-12)
  • (modified) llvm/test/Transforms/LoopVectorize/AArch64/partial-reduce-constant-ops.ll (+7-7)
  • (modified) llvm/test/Transforms/LoopVectorize/AArch64/partial-reduce-dot-product-epilogue.ll (+3-3)
  • (modified) llvm/test/Transforms/LoopVectorize/AArch64/partial-reduce-dot-product-neon.ll (+18-18)
  • (modified) llvm/test/Transforms/LoopVectorize/AArch64/partial-reduce-dot-product.ll (+50-50)
  • (modified) llvm/test/Transforms/LoopVectorize/AArch64/partial-reduce-extends-shared-with-reduce.ll (+1-1)
  • (modified) llvm/test/Transforms/LoopVectorize/AArch64/partial-reduce-fdot-product.ll (+1-1)
  • (modified) llvm/test/Transforms/LoopVectorize/AArch64/partial-reduce-incomplete-chains.ll (+1-1)
  • (modified) llvm/test/Transforms/LoopVectorize/AArch64/partial-reduce-interleave.ll (+2-2)
  • (modified) llvm/test/Transforms/LoopVectorize/AArch64/partial-reduce-no-dotprod.ll (+1-1)
  • (modified) llvm/test/Transforms/LoopVectorize/AArch64/partial-reduce-with-predicate-epilogue.ll (+6-6)
  • (modified) llvm/test/Transforms/LoopVectorize/AArch64/partial-reduce.ll (+3-3)
  • (modified) llvm/test/Transforms/LoopVectorize/AArch64/predicated-costs.ll (+1-1)
  • (modified) llvm/test/Transforms/LoopVectorize/AArch64/reduction-cost.ll (+1-1)
  • (modified) llvm/test/Transforms/LoopVectorize/AArch64/reduction-recurrence-costs-sve.ll (+6-6)
  • (modified) llvm/test/Transforms/LoopVectorize/AArch64/reduction-small-size.ll (+5-5)
  • (modified) llvm/test/Transforms/LoopVectorize/AArch64/replicating-load-store-costs-apple.ll (+2-2)
  • (modified) llvm/test/Transforms/LoopVectorize/AArch64/replicating-load-store-costs.ll (+2-2)
  • (modified) llvm/test/Transforms/LoopVectorize/AArch64/scalable-fp-ext-trunc-illegal-type.ll (+1-1)
  • (modified) llvm/test/Transforms/LoopVectorize/AArch64/select-index.ll (+16-16)
  • (modified) llvm/test/Transforms/LoopVectorize/AArch64/simple_early_exit.ll (+9-9)
  • (modified) llvm/test/Transforms/LoopVectorize/AArch64/streaming-compatible-sve-no-maximize-bandwidth.ll (+2-2)
  • (modified) llvm/test/Transforms/LoopVectorize/AArch64/strict-fadd.ll (+2-2)
  • (modified) llvm/test/Transforms/LoopVectorize/AArch64/sve-epilog-vect-inloop-reductions.ll (+1-1)
  • (modified) llvm/test/Transforms/LoopVectorize/AArch64/sve-epilog-vect-reductions.ll (+1-1)
  • (modified) llvm/test/Transforms/LoopVectorize/AArch64/sve-epilog-vect-strict-reductions.ll (+1-1)
  • (modified) llvm/test/Transforms/LoopVectorize/AArch64/sve-epilog-vect.ll (+3-3)
  • (modified) llvm/test/Transforms/LoopVectorize/AArch64/sve-epilog-vscale-fixed.ll (+1-1)
  • (modified) llvm/test/Transforms/LoopVectorize/AArch64/sve-fixed-width-inorder-core.ll (+3-3)
  • (modified) llvm/test/Transforms/LoopVectorize/AArch64/transform-narrow-interleave-fold-tail.ll (+1-1)
  • (modified) llvm/test/Transforms/LoopVectorize/AArch64/transform-narrow-interleave-group-requires-scalar-epilogue.ll (+1-4)
  • (modified) llvm/test/Transforms/LoopVectorize/AArch64/transform-narrow-interleave-to-widen-memory-cost.ll (+6-6)
  • (modified) llvm/test/Transforms/LoopVectorize/AArch64/transform-narrow-interleave-to-widen-memory-derived-ivs.ll (+6-8)
  • (modified) llvm/test/Transforms/LoopVectorize/AArch64/vector-reverse-mask4.ll (+1-1)
  • (modified) llvm/test/Transforms/LoopVectorize/AArch64/vector-reverse.ll (+2-2)
  • (modified) llvm/test/Transforms/LoopVectorize/ARM/active-lane-mask.ll (+1-1)
  • (modified) llvm/test/Transforms/LoopVectorize/ARM/gather-cost.ll (+1-1)
  • (modified) llvm/test/Transforms/LoopVectorize/ARM/mve-gather-scatter-tailpred.ll (+8-8)
  • (modified) llvm/test/Transforms/LoopVectorize/ARM/mve-hoist-runtime-checks.ll (+10-10)
  • (modified) llvm/test/Transforms/LoopVectorize/ARM/mve-multiexit.ll (+2-2)
  • (modified) llvm/test/Transforms/LoopVectorize/ARM/mve-qabs.ll (+3-3)
  • (modified) llvm/test/Transforms/LoopVectorize/ARM/mve-reduction-types.ll (+13-13)
  • (modified) llvm/test/Transforms/LoopVectorize/ARM/mve-reductions-interleave.ll (+2-2)
  • (modified) llvm/test/Transforms/LoopVectorize/ARM/mve-reductions.ll (+27-27)
  • (modified) llvm/test/Transforms/LoopVectorize/ARM/mve-reg-pressure-vmla.ll (+1-1)
  • (modified) llvm/test/Transforms/LoopVectorize/ARM/mve-saddsatcost.ll (+1-1)
  • (modified) llvm/test/Transforms/LoopVectorize/ARM/mve-selectandorcost.ll (+1-1)
  • (modified) llvm/test/Transforms/LoopVectorize/ARM/optsize_minsize.ll (+1-1)
  • (modified) llvm/test/Transforms/LoopVectorize/ARM/sphinx.ll (+1-1)
  • (modified) llvm/test/Transforms/LoopVectorize/ARM/tail-fold-multiple-icmps.ll (+1-1)
  • (modified) llvm/test/Transforms/LoopVectorize/ARM/tail-folding-counting-down.ll (+14-14)
  • (modified) llvm/test/Transforms/LoopVectorize/ARM/tail-folding-not-allowed.ll (+5-5)
  • (modified) llvm/test/Transforms/LoopVectorize/ARM/tail-folding-scalar-epilogue-fallback.ll (+1-1)
  • (modified) llvm/test/Transforms/LoopVectorize/PowerPC/exit-branch-cost.ll (+7-7)
  • (modified) llvm/test/Transforms/LoopVectorize/PowerPC/large-loop-rdx.ll (+4-4)
  • (modified) llvm/test/Transforms/LoopVectorize/PowerPC/optimal-epilog-vectorization.ll (+8-8)
  • (modified) llvm/test/Transforms/LoopVectorize/PowerPC/pr41179.ll (+1-1)
  • (modified) llvm/test/Transforms/LoopVectorize/PowerPC/small-loop-rdx.ll (+4-4)
  • (modified) llvm/test/Transforms/LoopVectorize/PowerPC/vectorize-bswap.ll (+1-1)
  • (modified) llvm/test/Transforms/LoopVectorize/PowerPC/vplan-scalarivsext-crash.ll (+3-3)
  • (modified) llvm/test/Transforms/LoopVectorize/RISCV/bf16.ll (+2-2)
  • (modified) llvm/test/Transforms/LoopVectorize/RISCV/dead-ops-cost.ll (+1-1)
  • (modified) llvm/test/Transforms/LoopVectorize/RISCV/illegal-type.ll (+1-1)
  • (modified) llvm/test/Transforms/LoopVectorize/RISCV/interleaved-store-with-gap.ll (+1-1)
  • (modified) llvm/test/Transforms/LoopVectorize/RISCV/ordered-reduction.ll (+2-2)
  • (modified) llvm/test/Transforms/LoopVectorize/RISCV/reductions.ll (+6-6)
  • (modified) llvm/test/Transforms/LoopVectorize/RISCV/riscv-unroll.ll (+2-2)
  • (modified) llvm/test/Transforms/LoopVectorize/RISCV/safe-dep-distance.ll (+1-1)
  • (modified) llvm/test/Transforms/LoopVectorize/RISCV/tail-folding-call-intrinsics.ll (+1-1)
  • (modified) llvm/test/Transforms/LoopVectorize/RISCV/tail-folding-inloop-reduction.ll (+8-8)
  • (modified) llvm/test/Transforms/LoopVectorize/RISCV/tail-folding-interleave.ll (+1-1)
  • (modified) llvm/test/Transforms/LoopVectorize/RISCV/tail-folding-reduction.ll (+8-8)
  • (modified) llvm/test/Transforms/LoopVectorize/SystemZ/vectorized-epilogue-loop.ll (+2-2)
  • (modified) llvm/test/Transforms/LoopVectorize/VPlan/interleave-conditional-scalar-assignment-vplan.ll (+51-51)
  • (modified) llvm/test/Transforms/LoopVectorize/VPlan/vplan-predicate-switch.ll (+24-24)
  • (modified) llvm/test/Transforms/LoopVectorize/VPlan/widen-canonical-iv-register-pressure.ll (+53-53)
  • (modified) llvm/test/Transforms/LoopVectorize/WebAssembly/induction-branch-cost.ll (+3-3)
  • (modified) llvm/test/Transforms/LoopVectorize/WebAssembly/partial-reduce-accumulate.ll (+3-3)
  • (modified) llvm/test/Transforms/LoopVectorize/X86/cast-costs.ll (+5-5)
  • (modified) llvm/test/Transforms/LoopVectorize/X86/clmul.ll (+3-3)
  • (modified) llvm/test/Transforms/LoopVectorize/X86/conditional-scalar-assignment.ll (+12-12)
  • (modified) llvm/test/Transforms/LoopVectorize/X86/conversion-cost.ll (+5-5)
  • (modified) llvm/test/Transforms/LoopVectorize/X86/cost-conditional-branches.ll (+11-11)
  • (modified) llvm/test/Transforms/LoopVectorize/X86/cost-model-i386.ll (+2-2)
  • (modified) llvm/test/Transforms/LoopVectorize/X86/cost-model.ll (+7-7)
  • (modified) llvm/test/Transforms/LoopVectorize/X86/divs-with-tail-folding.ll (+2-2)
  • (modified) llvm/test/Transforms/LoopVectorize/X86/end-pointer-signed.ll (+1-1)
  • (modified) llvm/test/Transforms/LoopVectorize/X86/epilog-vectorization-inductions.ll (+4-4)
  • (modified) llvm/test/Transforms/LoopVectorize/X86/epilog-vectorization-ordered-reduction.ll (+37-37)
  • (modified) llvm/test/Transforms/LoopVectorize/X86/fixed-order-recurrence.ll (+3-3)
  • (modified) llvm/test/Transforms/LoopVectorize/X86/float-induction-x86.ll (+18-18)
  • (modified) llvm/test/Transforms/LoopVectorize/X86/fold-tail-low-trip-count.ll (+2-2)
  • (modified) llvm/test/Transforms/LoopVectorize/X86/gather-cost.ll (+1-1)
  • (modified) llvm/test/Transforms/LoopVectorize/X86/gather_scatter.ll (+3-3)
  • (modified) llvm/test/Transforms/LoopVectorize/X86/idiv-by-const.ll (+18-18)
  • (modified) llvm/test/Transforms/LoopVectorize/X86/illegal-parallel-loop-uniform-write.ll (+1-1)
  • (modified) llvm/test/Transforms/LoopVectorize/X86/induction-costs.ll (+3-3)
  • (modified) llvm/test/Transforms/LoopVectorize/X86/induction-step.ll (+5-5)
  • (modified) llvm/test/Transforms/LoopVectorize/X86/interleave-cost.ll (+1-1)
  • (modified) llvm/test/Transforms/LoopVectorize/X86/interleave-opaque-pointers.ll (+1-1)
  • (modified) llvm/test/Transforms/LoopVectorize/X86/intrinsiccost.ll (+4-4)
  • (modified) llvm/test/Transforms/LoopVectorize/X86/invariant-load-gather.ll (+2-2)
  • (modified) llvm/test/Transforms/LoopVectorize/X86/invariant-store-vectorization.ll (+10-10)
  • (modified) llvm/test/Transforms/LoopVectorize/X86/iv-live-outs.ll (+2-2)
  • (modified) llvm/test/Transforms/LoopVectorize/X86/load-deref-pred.ll (+2-2)
  • (modified) llvm/test/Transforms/LoopVectorize/X86/masked_load_store.ll (+60-60)
  • (modified) llvm/test/Transforms/LoopVectorize/X86/multi-exit-cost.ll (+1-1)
  • (modified) llvm/test/Transforms/LoopVectorize/X86/optsize.ll (+2-2)
  • (modified) llvm/test/Transforms/LoopVectorize/X86/outer-loop-non-power-of-2-type.ll (+1-1)
  • (modified) llvm/test/Transforms/LoopVectorize/X86/pr23997.ll (+4-4)
  • (modified) llvm/test/Transforms/LoopVectorize/X86/pr35432.ll (+1-1)
  • (modified) llvm/test/Transforms/LoopVectorize/X86/pr39160.ll (+1-1)
  • (modified) llvm/test/Transforms/LoopVectorize/X86/pr47437.ll (+5-5)
  • (modified) llvm/test/Transforms/LoopVectorize/X86/pr48340.ll (+2-2)
  • (modified) llvm/test/Transforms/LoopVectorize/X86/pr54634.ll (+4-4)
  • (modified) llvm/test/Transforms/LoopVectorize/X86/pr72969.ll (+1-1)
  • (modified) llvm/test/Transforms/LoopVectorize/X86/predicate-switch.ll (+12-12)
  • (modified) llvm/test/Transforms/LoopVectorize/X86/predicated-instruction-cost.ll (+1-1)
  • (modified) llvm/test/Transforms/LoopVectorize/X86/predicated-replicate-feeding-cast.ll (+2-2)
  • (modified) llvm/test/Transforms/LoopVectorize/X86/reduction-crash.ll (+1-1)
  • (modified) llvm/test/Transforms/LoopVectorize/X86/reduction-fastmath.ll (+2-2)
  • (modified) llvm/test/Transforms/LoopVectorize/X86/replicate-recipe-with-only-first-lane-used.ll (+1-1)
  • (modified) llvm/test/Transforms/LoopVectorize/X86/replicating-load-store-costs.ll (+7-7)
  • (modified) llvm/test/Transforms/LoopVectorize/X86/scatter_crash.ll (+14-14)
  • (modified) llvm/test/Transforms/LoopVectorize/X86/small-size.ll (+14-14)
  • (modified) llvm/test/Transforms/LoopVectorize/X86/tail_loop_folding.ll (+1-1)
  • (modified) llvm/test/Transforms/LoopVectorize/X86/transform-narrow-interleave-to-widen-memory-epilogue-vec.ll (+2-2)
  • (modified) llvm/test/Transforms/LoopVectorize/X86/transform-narrow-interleave-to-widen-memory-gaps.ll (+1-1)
  • (modified) llvm/test/Transforms/LoopVectorize/X86/transform-narrow-interleave-to-widen-memory-live-outs.ll (+1-1)
  • (modified) llvm/test/Transforms/LoopVectorize/X86/transform-narrow-interleave-to-widen-memory.ll (+9-9)
  • (modified) llvm/test/Transforms/LoopVectorize/X86/vectorize-force-tail-with-evl.ll (+3-3)
  • (modified) llvm/test/Transforms/LoopVectorize/X86/widen-canonical-iv-register-pressure.ll (+2-2)
  • (modified) llvm/test/Transforms/LoopVectorize/X86/x86-interleaved-accesses-masked-group.ll (+10-10)
  • (modified) llvm/test/Transforms/LoopVectorize/X86/x86-predication.ll (+2-2)
  • (modified) llvm/test/Transforms/LoopVectorize/X86/x86_fp80-vector-store.ll (+1-1)
  • (modified) llvm/test/Transforms/LoopVectorize/alias-mask-negative-tests.ll (+2-2)
  • (modified) llvm/test/Transforms/LoopVectorize/assume.ll (+1-1)
  • (modified) llvm/test/Transforms/LoopVectorize/bounded-load-multi-exit.ll (+1-1)
  • (modified) llvm/test/Transforms/LoopVectorize/bounded-load-predicated.ll (+6-6)
  • (modified) llvm/test/Transforms/LoopVectorize/bounded-load-user-ic.ll (+1-1)
  • (modified) llvm/test/Transforms/LoopVectorize/bounded-load-vf-ranges.ll (+3-3)
  • (modified) llvm/test/Transforms/LoopVectorize/byte-type-function-variants.ll (+3-3)
  • (modified) llvm/test/Transforms/LoopVectorize/bzip_reverse_loops.ll (+2-2)
  • (modified) llvm/test/Transforms/LoopVectorize/cast-induction.ll (+3-3)
  • (modified) llvm/test/Transforms/LoopVectorize/conditional-scalar-assignment-interleave-only.ll (+1-1)
  • (modified) llvm/test/Transforms/LoopVectorize/consecutive-ptr-uniforms.ll (+30-30)
  • (modified) llvm/test/Transforms/LoopVectorize/cse-gep-source-element-type.ll (+2-2)
  • (modified) llvm/test/Transforms/LoopVectorize/dead_instructions.ll (+7-7)
  • (modified) llvm/test/Transforms/LoopVectorize/dereferenceable-info-from-assumption-constant-size-needs-loop-guards.ll (+13-7)
  • (modified) llvm/test/Transforms/LoopVectorize/dereferenceable-info-from-assumption-constant-size.ll (+1-1)
  • (modified) llvm/test/Transforms/LoopVectorize/dereferenceable-info-from-assumption-variable-size.ll (+10-10)
  • (modified) llvm/test/Transforms/LoopVectorize/div-exact.ll (+2-2)
  • (modified) llvm/test/Transforms/LoopVectorize/dont-fold-tail-for-divisible-TC.ll (+3-3)
  • (modified) llvm/test/Transforms/LoopVectorize/early-exit-minmax-trip-count.ll (+1-1)
  • (modified) llvm/test/Transforms/LoopVectorize/epilog-iv-select-cmp.ll (+22-22)
  • (modified) llvm/test/Transforms/LoopVectorize/epilog-vectorization-any-of-reductions.ll (+8-8)
  • (modified) llvm/test/Transforms/LoopVectorize/epilog-vectorization-fixed-order-recurrences.ll (+11-11)
  • (modified) llvm/test/Transforms/LoopVectorize/epilog-vectorization-fmaxnum-reductions.ll (+3-3)
  • (modified) llvm/test/Transforms/LoopVectorize/epilog-vectorization-reductions.ll (+56-56)
  • (modified) llvm/test/Transforms/LoopVectorize/epilog-vectorization-scev-expansion.ll (+2-2)
  • (modified) llvm/test/Transforms/LoopVectorize/epilog-vectorization-trunc-induction-steps.ll (+2-2)
  • (modified) llvm/test/Transforms/LoopVectorize/expand-ptrtoaddr.ll (+1-1)
  • (modified) llvm/test/Transforms/LoopVectorize/expression-recipe-branch-weights.ll (+1-1)
  • (modified) llvm/test/Transforms/LoopVectorize/extract-last-veclane.ll (+2-2)
  • (modified) llvm/test/Transforms/LoopVectorize/fcmp-uno-fold-interleave.ll (+1-1)
  • (modified) llvm/test/Transforms/LoopVectorize/find-last-iv-interleave.ll (+4-4)
  • (modified) llvm/test/Transforms/LoopVectorize/find-last-iv-sinkable-expr-epilogue.ll (+3-3)
  • (modified) llvm/test/Transforms/LoopVectorize/find-last-iv-sinkable-expr-tail-folding.ll (+12-12)
  • (modified) llvm/test/Transforms/LoopVectorize/find-last-iv-sinkable-expr.ll (+15-15)
  • (modified) llvm/test/Transforms/LoopVectorize/find-last-iv-sinkable-load.ll (+9-9)
  • (modified) llvm/test/Transforms/LoopVectorize/find-last.ll (+2-2)
  • (modified) llvm/test/Transforms/LoopVectorize/first-order-recurrence-chains.ll (+14-14)
  • (modified) llvm/test/Transforms/LoopVectorize/first-order-recurrence-complex.ll (+4-4)
  • (modified) llvm/test/Transforms/LoopVectorize/first-order-recurrence-tail-folding.ll (+9-9)
  • (modified) llvm/test/Transforms/LoopVectorize/first-order-recurrence-with-uniform-ops.ll (+6-6)
  • (modified) llvm/test/Transforms/LoopVectorize/first-order-recurrence.ll (+51-51)
  • (modified) llvm/test/Transforms/LoopVectorize/flags.ll (+3-3)
  • (modified) llvm/test/Transforms/LoopVectorize/float-induction.ll (+32-32)
  • (modified) llvm/test/Transforms/LoopVectorize/fmax-without-fast-math-flags-interleave.ll (+3-3)
  • (modified) llvm/test/Transforms/LoopVectorize/fmax-without-fast-math-flags.ll (+5-5)
  • (modified) llvm/test/Transforms/LoopVectorize/fmin-without-fast-math-flags.ll (+2-2)
  • (modified) llvm/test/Transforms/LoopVectorize/fpsat.ll (+2-2)
  • (modified) llvm/test/Transforms/LoopVectorize/histograms.ll (+1-1)
  • (modified) llvm/test/Transforms/LoopVectorize/hoist-and-sink-mem-ops-with-invariant-pointers.ll (+6-6)
  • (modified) llvm/test/Transforms/LoopVectorize/hoist-predicated-loads-with-predicated-stores.ll (+6-6)
  • (modified) llvm/test/Transforms/LoopVectorize/if-conversion-nest.ll (+2-2)
  • (modified) llvm/test/Transforms/LoopVectorize/if-conversion.ll (+3-3)
  • (modified) llvm/test/Transforms/LoopVectorize/if-pred-non-void.ll (+2-2)
  • (modified) llvm/test/Transforms/LoopVectorize/if-pred-stores.ll (+7-7)
  • (modified) llvm/test/Transforms/LoopVectorize/if-reduction.ll (+15-15)
  • (modified) llvm/test/Transforms/LoopVectorize/induction-ptrcasts.ll (+2-2)
  • (modified) llvm/test/Transforms/LoopVectorize/induction-step.ll (+9-9)
  • (modified) llvm/test/Transforms/LoopVectorize/induction-unroll-novec.ll (+3-3)
  • (modified) llvm/test/Transforms/LoopVectorize/induction.ll (+104-104)
  • (modified) llvm/test/Transforms/LoopVectorize/interleave-and-scalarize-only.ll (+3-3)
  • (modified) llvm/test/Transforms/LoopVectorize/interleaved-accesses-2.ll (+1-1)
  • (modified) llvm/test/Transforms/LoopVectorize/interleaved-accesses-dead-member.ll (+2-2)
diff --git a/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp b/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
index 541a3da855992..8761361c78f75 100644
--- a/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
+++ b/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
@@ -1366,10 +1366,7 @@ static void simplifyRecipe(VPSingleDefRecipe *Def) {
   }
 
   const APInt *APC;
-  // TODO: Enable optimizations in the vector preheader in a follow-up PR.
-  // This check currently means we only simplify before region dissolution.
-  VPBasicBlock *Preheader = Plan->getVectorPreheader();
-  if (CanCreateNewRecipe && Preheader && Def->getParent() != Preheader &&
+  if (CanCreateNewRecipe &&
       match(Def, m_URem(m_VPValue(X), m_APInt(APC))) && APC->isPowerOf2()) {
     return Def->replaceAllUsesWith(Builder.createAnd(
         X, Plan->getConstantInt(*APC - 1), Def->getDebugLoc()));
diff --git a/llvm/test/Transforms/LoopVectorize/AArch64/aggressive-interleaving.ll b/llvm/test/Transforms/LoopVectorize/AArch64/aggressive-interleaving.ll
index 23ffc98cbc283..9789e291dc1a9 100644
--- a/llvm/test/Transforms/LoopVectorize/AArch64/aggressive-interleaving.ll
+++ b/llvm/test/Transforms/LoopVectorize/AArch64/aggressive-interleaving.ll
@@ -31,7 +31,7 @@ define void @test_interleave_reduction(ptr %arg, ptr %arg1) {
 ; A320-NEXT:    [[MIN_ITERS_CHECK:%.*]] = icmp ult i64 [[TMP3]], 2
 ; A320-NEXT:    br i1 [[MIN_ITERS_CHECK]], label %[[SCALAR_PH:.*]], label %[[VECTOR_PH:.*]]
 ; A320:       [[VECTOR_PH]]:
-; A320-NEXT:    [[N_MOD_VF:%.*]] = urem i64 [[TMP3]], 2
+; A320-NEXT:    [[N_MOD_VF:%.*]] = and i64 [[TMP3]], 1
 ; A320-NEXT:    [[N_VEC:%.*]] = sub i64 [[TMP3]], [[N_MOD_VF]]
 ; A320-NEXT:    [[TMP4:%.*]] = shl i64 [[N_VEC]], 2
 ; A320-NEXT:    [[IND_END:%.*]] = getelementptr i8, ptr [[TPM27]], i64 [[TMP4]]
@@ -73,12 +73,12 @@ define void @test_interleave_reduction(ptr %arg, ptr %arg1) {
 ; A320-NEXT:    br i1 [[CMP_N]], label %[[EXIT_INNER:.*]], label %[[SCALAR_PH]]
 ; A320:       [[SCALAR_PH]]:
 ; A320-NEXT:    [[BC_RESUME_VAL:%.*]] = phi ptr [ [[IND_END]], %[[MIDDLE_BLOCK]] ], [ [[TPM27]], %[[OUTER]] ]
-; A320-NEXT:    [[BC_RESUME_VAL7:%.*]] = phi ptr [ [[IND_END3]], %[[MIDDLE_BLOCK]] ], [ [[TPM32]], %[[OUTER]] ]
+; A320-NEXT:    [[BC_RESUME_VAL5:%.*]] = phi ptr [ [[IND_END3]], %[[MIDDLE_BLOCK]] ], [ [[TPM32]], %[[OUTER]] ]
 ; A320-NEXT:    [[BC_MERGE_RDX:%.*]] = phi double [ [[BIN_RDX]], %[[MIDDLE_BLOCK]] ], [ 0.000000e+00, %[[OUTER]] ]
 ; A320-NEXT:    br label %[[INNER:.*]]
 ; A320:       [[INNER]]:
 ; A320-NEXT:    [[PHI_PTR_I32:%.*]] = phi ptr [ [[NEXT_I32:%.*]], %[[INNER]] ], [ [[BC_RESUME_VAL]], %[[SCALAR_PH]] ]
-; A320-NEXT:    [[PHI_PTR_F64:%.*]] = phi ptr [ [[NEXT_F64:%.*]], %[[INNER]] ], [ [[BC_RESUME_VAL7]], %[[SCALAR_PH]] ]
+; A320-NEXT:    [[PHI_PTR_F64:%.*]] = phi ptr [ [[NEXT_F64:%.*]], %[[INNER]] ], [ [[BC_RESUME_VAL5]], %[[SCALAR_PH]] ]
 ; A320-NEXT:    [[PHI_ACC:%.*]] = phi double [ [[TPM50:%.*]], %[[INNER]] ], [ [[BC_MERGE_RDX]], %[[SCALAR_PH]] ]
 ; A320-NEXT:    [[TPM44:%.*]] = load double, ptr [[PHI_PTR_F64]], align 8
 ; A320-NEXT:    [[TPM45:%.*]] = load i32, ptr [[PHI_PTR_I32]], align 4
@@ -154,7 +154,7 @@ define double @sum_reduction(ptr nocapture readonly %a, i64 %n) {
 ; A320-NEXT:    [[MIN_ITERS_CHECK:%.*]] = icmp ult i64 [[N]], 8
 ; A320-NEXT:    br i1 [[MIN_ITERS_CHECK]], label %[[SCALAR_PH:.*]], label %[[VECTOR_PH:.*]]
 ; A320:       [[VECTOR_PH]]:
-; A320-NEXT:    [[N_MOD_VF:%.*]] = urem i64 [[N]], 8
+; A320-NEXT:    [[N_MOD_VF:%.*]] = and i64 [[N]], 7
 ; A320-NEXT:    [[N_VEC:%.*]] = sub i64 [[N]], [[N_MOD_VF]]
 ; A320-NEXT:    br label %[[VECTOR_BODY:.*]]
 ; A320:       [[VECTOR_BODY]]:
@@ -245,7 +245,7 @@ define double @dot_product(ptr nocapture readonly %a, ptr nocapture readonly %b,
 ; A320-NEXT:    [[MIN_ITERS_CHECK:%.*]] = icmp ult i64 [[N]], 8
 ; A320-NEXT:    br i1 [[MIN_ITERS_CHECK]], label %[[SCALAR_PH:.*]], label %[[VECTOR_PH:.*]]
 ; A320:       [[VECTOR_PH]]:
-; A320-NEXT:    [[N_MOD_VF:%.*]] = urem i64 [[N]], 8
+; A320-NEXT:    [[N_MOD_VF:%.*]] = and i64 [[N]], 7
 ; A320-NEXT:    [[N_VEC:%.*]] = sub i64 [[N]], [[N_MOD_VF]]
 ; A320-NEXT:    br label %[[VECTOR_BODY:.*]]
 ; A320:       [[VECTOR_BODY]]:
diff --git a/llvm/test/Transforms/LoopVectorize/AArch64/blend-costs.ll b/llvm/test/Transforms/LoopVectorize/AArch64/blend-costs.ll
index 1a83a3ed4cdb8..c41e9d78de209 100644
--- a/llvm/test/Transforms/LoopVectorize/AArch64/blend-costs.ll
+++ b/llvm/test/Transforms/LoopVectorize/AArch64/blend-costs.ll
@@ -12,7 +12,7 @@ define void @test_blend_feeding_replicated_store_1(i64 %N, ptr noalias %src, ptr
 ; CHECK-NEXT:    [[MIN_ITERS_CHECK:%.*]] = icmp ule i64 [[TMP43]], 16
 ; CHECK-NEXT:    br i1 [[MIN_ITERS_CHECK]], label %[[SCALAR_PH:.*]], label %[[VECTOR_PH:.*]]
 ; CHECK:       [[VECTOR_PH]]:
-; CHECK-NEXT:    [[N_MOD_VF:%.*]] = urem i64 [[TMP43]], 16
+; CHECK-NEXT:    [[N_MOD_VF:%.*]] = and i64 [[TMP43]], 15
 ; CHECK-NEXT:    [[TMP1:%.*]] = icmp eq i64 [[N_MOD_VF]], 0
 ; CHECK-NEXT:    [[TMP2:%.*]] = select i1 [[TMP1]], i64 16, i64 [[N_MOD_VF]]
 ; CHECK-NEXT:    [[N_VEC:%.*]] = sub i64 [[TMP43]], [[TMP2]]
diff --git a/llvm/test/Transforms/LoopVectorize/AArch64/bounded-load.ll b/llvm/test/Transforms/LoopVectorize/AArch64/bounded-load.ll
index bb1bcf18b0a41..bc16875a3fe3a 100644
--- a/llvm/test/Transforms/LoopVectorize/AArch64/bounded-load.ll
+++ b/llvm/test/Transforms/LoopVectorize/AArch64/bounded-load.ll
@@ -19,7 +19,7 @@ define i32 @bounded_load_reduction_bound2(ptr %A, i32 %N) {
 ; CHECK-NEXT:    [[MIN_ITERS_CHECK1:%.*]] = icmp ult i32 [[N]], 16
 ; CHECK-NEXT:    br i1 [[MIN_ITERS_CHECK1]], label %[[VEC_EPILOG_PH:.*]], label %[[VECTOR_PH:.*]]
 ; CHECK:       [[VECTOR_PH]]:
-; CHECK-NEXT:    [[N_MOD_VF:%.*]] = urem i32 [[N]], 16
+; CHECK-NEXT:    [[N_MOD_VF:%.*]] = and i32 [[N]], 15
 ; CHECK-NEXT:    [[N_VEC:%.*]] = sub i32 [[N]], [[N_MOD_VF]]
 ; CHECK-NEXT:    br label %[[VECTOR_BODY:.*]]
 ; CHECK:       [[VECTOR_BODY]]:
@@ -62,7 +62,7 @@ define i32 @bounded_load_reduction_bound2(ptr %A, i32 %N) {
 ; CHECK:       [[VEC_EPILOG_PH]]:
 ; CHECK-NEXT:    [[VEC_EPILOG_RESUME_VAL:%.*]] = phi i32 [ [[N_VEC]], %[[VEC_EPILOG_ITER_CHECK]] ], [ 0, %[[VECTOR_MAIN_LOOP_ITER_CHECK]] ]
 ; CHECK-NEXT:    [[BC_MERGE_RDX:%.*]] = phi i32 [ [[TMP15]], %[[VEC_EPILOG_ITER_CHECK]] ], [ 0, %[[VECTOR_MAIN_LOOP_ITER_CHECK]] ]
-; CHECK-NEXT:    [[N_MOD_VF13:%.*]] = urem i32 [[N]], 4
+; CHECK-NEXT:    [[N_MOD_VF13:%.*]] = and i32 [[N]], 3
 ; CHECK-NEXT:    [[N_VEC14:%.*]] = sub i32 [[N]], [[N_MOD_VF13]]
 ; CHECK-NEXT:    [[TMP16:%.*]] = insertelement <4 x i32> zeroinitializer, i32 [[BC_MERGE_RDX]], i32 0
 ; CHECK-NEXT:    br label %[[VEC_EPILOG_VECTOR_BODY:.*]]
@@ -84,11 +84,11 @@ define i32 @bounded_load_reduction_bound2(ptr %A, i32 %N) {
 ; CHECK-NEXT:    br i1 [[CMP_N20]], label %[[EXIT]], label %[[VEC_EPILOG_SCALAR_PH]]
 ; CHECK:       [[VEC_EPILOG_SCALAR_PH]]:
 ; CHECK-NEXT:    [[BC_RESUME_VAL:%.*]] = phi i32 [ [[N_VEC14]], %[[VEC_EPILOG_MIDDLE_BLOCK]] ], [ [[N_VEC]], %[[VEC_EPILOG_ITER_CHECK]] ], [ 0, %[[VECTOR_SCEVCHECK]] ], [ 0, %[[ITER_CHECK]] ]
-; CHECK-NEXT:    [[BC_MERGE_RDX21:%.*]] = phi i32 [ [[TMP22]], %[[VEC_EPILOG_MIDDLE_BLOCK]] ], [ [[TMP15]], %[[VEC_EPILOG_ITER_CHECK]] ], [ 0, %[[VECTOR_SCEVCHECK]] ], [ 0, %[[ITER_CHECK]] ]
+; CHECK-NEXT:    [[BC_MERGE_RDX20:%.*]] = phi i32 [ [[TMP22]], %[[VEC_EPILOG_MIDDLE_BLOCK]] ], [ [[TMP15]], %[[VEC_EPILOG_ITER_CHECK]] ], [ 0, %[[VECTOR_SCEVCHECK]] ], [ 0, %[[ITER_CHECK]] ]
 ; CHECK-NEXT:    br label %[[LOOP:.*]]
 ; CHECK:       [[LOOP]]:
 ; CHECK-NEXT:    [[IV:%.*]] = phi i32 [ [[BC_RESUME_VAL]], %[[VEC_EPILOG_SCALAR_PH]] ], [ [[IV_NEXT:%.*]], %[[LOOP]] ]
-; CHECK-NEXT:    [[SUM:%.*]] = phi i32 [ [[BC_MERGE_RDX21]], %[[VEC_EPILOG_SCALAR_PH]] ], [ [[SUM_NEXT:%.*]], %[[LOOP]] ]
+; CHECK-NEXT:    [[SUM:%.*]] = phi i32 [ [[BC_MERGE_RDX20]], %[[VEC_EPILOG_SCALAR_PH]] ], [ [[SUM_NEXT:%.*]], %[[LOOP]] ]
 ; CHECK-NEXT:    [[BOUNDED:%.*]] = urem i32 [[IV]], 2
 ; CHECK-NEXT:    [[GEP:%.*]] = getelementptr inbounds i32, ptr [[A]], i32 [[BOUNDED]]
 ; CHECK-NEXT:    [[LV:%.*]] = load i32, ptr [[GEP]], align 4
@@ -133,7 +133,7 @@ define i32 @bounded_load_reduction_bound4(ptr %A, i32 %N) {
 ; CHECK-NEXT:    [[MIN_ITERS_CHECK1:%.*]] = icmp ult i32 [[N]], 16
 ; CHECK-NEXT:    br i1 [[MIN_ITERS_CHECK1]], label %[[VEC_EPILOG_PH:.*]], label %[[VECTOR_PH:.*]]
 ; CHECK:       [[VECTOR_PH]]:
-; CHECK-NEXT:    [[N_MOD_VF:%.*]] = urem i32 [[N]], 16
+; CHECK-NEXT:    [[N_MOD_VF:%.*]] = and i32 [[N]], 15
 ; CHECK-NEXT:    [[N_VEC:%.*]] = sub i32 [[N]], [[N_MOD_VF]]
 ; CHECK-NEXT:    br label %[[VECTOR_BODY:.*]]
 ; CHECK:       [[VECTOR_BODY]]:
@@ -171,7 +171,7 @@ define i32 @bounded_load_reduction_bound4(ptr %A, i32 %N) {
 ; CHECK:       [[VEC_EPILOG_PH]]:
 ; CHECK-NEXT:    [[VEC_EPILOG_RESUME_VAL:%.*]] = phi i32 [ [[N_VEC]], %[[VEC_EPILOG_ITER_CHECK]] ], [ 0, %[[VECTOR_MAIN_LOOP_ITER_CHECK]] ]
 ; CHECK-NEXT:    [[BC_MERGE_RDX:%.*]] = phi i32 [ [[TMP12]], %[[VEC_EPILOG_ITER_CHECK]] ], [ 0, %[[VECTOR_MAIN_LOOP_ITER_CHECK]] ]
-; CHECK-NEXT:    [[N_MOD_VF10:%.*]] = urem i32 [[N]], 4
+; CHECK-NEXT:    [[N_MOD_VF10:%.*]] = and i32 [[N]], 3
 ; CHECK-NEXT:    [[N_VEC11:%.*]] = sub i32 [[N]], [[N_MOD_VF10]]
 ; CHECK-NEXT:    [[TMP13:%.*]] = insertelement <4 x i32> zeroinitializer, i32 [[BC_MERGE_RDX]], i32 0
 ; CHECK-NEXT:    br label %[[VEC_EPILOG_VECTOR_BODY:.*]]
@@ -191,11 +191,11 @@ define i32 @bounded_load_reduction_bound4(ptr %A, i32 %N) {
 ; CHECK-NEXT:    br i1 [[CMP_N16]], label %[[EXIT]], label %[[VEC_EPILOG_SCALAR_PH]]
 ; CHECK:       [[VEC_EPILOG_SCALAR_PH]]:
 ; CHECK-NEXT:    [[BC_RESUME_VAL:%.*]] = phi i32 [ [[N_VEC11]], %[[VEC_EPILOG_MIDDLE_BLOCK]] ], [ [[N_VEC]], %[[VEC_EPILOG_ITER_CHECK]] ], [ 0, %[[VECTOR_SCEVCHECK]] ], [ 0, %[[ITER_CHECK]] ]
-; CHECK-NEXT:    [[BC_MERGE_RDX17:%.*]] = phi i32 [ [[TMP18]], %[[VEC_EPILOG_MIDDLE_BLOCK]] ], [ [[TMP12]], %[[VEC_EPILOG_ITER_CHECK]] ], [ 0, %[[VECTOR_SCEVCHECK]] ], [ 0, %[[ITER_CHECK]] ]
+; CHECK-NEXT:    [[BC_MERGE_RDX16:%.*]] = phi i32 [ [[TMP18]], %[[VEC_EPILOG_MIDDLE_BLOCK]] ], [ [[TMP12]], %[[VEC_EPILOG_ITER_CHECK]] ], [ 0, %[[VECTOR_SCEVCHECK]] ], [ 0, %[[ITER_CHECK]] ]
 ; CHECK-NEXT:    br label %[[LOOP:.*]]
 ; CHECK:       [[LOOP]]:
 ; CHECK-NEXT:    [[IV:%.*]] = phi i32 [ [[BC_RESUME_VAL]], %[[VEC_EPILOG_SCALAR_PH]] ], [ [[IV_NEXT:%.*]], %[[LOOP]] ]
-; CHECK-NEXT:    [[SUM:%.*]] = phi i32 [ [[BC_MERGE_RDX17]], %[[VEC_EPILOG_SCALAR_PH]] ], [ [[SUM_NEXT:%.*]], %[[LOOP]] ]
+; CHECK-NEXT:    [[SUM:%.*]] = phi i32 [ [[BC_MERGE_RDX16]], %[[VEC_EPILOG_SCALAR_PH]] ], [ [[SUM_NEXT:%.*]], %[[LOOP]] ]
 ; CHECK-NEXT:    [[BOUNDED:%.*]] = urem i32 [[IV]], 4
 ; CHECK-NEXT:    [[GEP:%.*]] = getelementptr inbounds i32, ptr [[A]], i32 [[BOUNDED]]
 ; CHECK-NEXT:    [[LV:%.*]] = load i32, ptr [[GEP]], align 4
@@ -240,7 +240,7 @@ define i16 @bounded_load_reduction_bound4_i16(ptr %A, i32 %N) {
 ; CHECK-NEXT:    [[MIN_ITERS_CHECK1:%.*]] = icmp ult i32 [[N]], 16
 ; CHECK-NEXT:    br i1 [[MIN_ITERS_CHECK1]], label %[[VEC_EPILOG_PH:.*]], label %[[VECTOR_PH:.*]]
 ; CHECK:       [[VECTOR_PH]]:
-; CHECK-NEXT:    [[N_MOD_VF:%.*]] = urem i32 [[N]], 16
+; CHECK-NEXT:    [[N_MOD_VF:%.*]] = and i32 [[N]], 15
 ; CHECK-NEXT:    [[N_VEC:%.*]] = sub i32 [[N]], [[N_MOD_VF]]
 ; CHECK-NEXT:    br label %[[VECTOR_BODY:.*]]
 ; CHECK:       [[VECTOR_BODY]]:
@@ -268,7 +268,7 @@ define i16 @bounded_load_reduction_bound4_i16(ptr %A, i32 %N) {
 ; CHECK:       [[VEC_EPILOG_PH]]:
 ; CHECK-NEXT:    [[VEC_EPILOG_RESUME_VAL:%.*]] = phi i32 [ [[N_VEC]], %[[VEC_EPILOG_ITER_CHECK]] ], [ 0, %[[VECTOR_MAIN_LOOP_ITER_CHECK]] ]
 ; CHECK-NEXT:    [[BC_MERGE_RDX:%.*]] = phi i16 [ [[TMP8]], %[[VEC_EPILOG_ITER_CHECK]] ], [ 0, %[[VECTOR_MAIN_LOOP_ITER_CHECK]] ]
-; CHECK-NEXT:    [[N_MOD_VF4:%.*]] = urem i32 [[N]], 4
+; CHECK-NEXT:    [[N_MOD_VF4:%.*]] = and i32 [[N]], 3
 ; CHECK-NEXT:    [[N_VEC5:%.*]] = sub i32 [[N]], [[N_MOD_VF4]]
 ; CHECK-NEXT:    [[TMP9:%.*]] = insertelement <4 x i16> zeroinitializer, i16 [[BC_MERGE_RDX]], i32 0
 ; CHECK-NEXT:    br label %[[VEC_EPILOG_VECTOR_BODY:.*]]
@@ -288,11 +288,11 @@ define i16 @bounded_load_reduction_bound4_i16(ptr %A, i32 %N) {
 ; CHECK-NEXT:    br i1 [[CMP_N10]], label %[[EXIT]], label %[[VEC_EPILOG_SCALAR_PH]]
 ; CHECK:       [[VEC_EPILOG_SCALAR_PH]]:
 ; CHECK-NEXT:    [[BC_RESUME_VAL:%.*]] = phi i32 [ [[N_VEC5]], %[[VEC_EPILOG_MIDDLE_BLOCK]] ], [ [[N_VEC]], %[[VEC_EPILOG_ITER_CHECK]] ], [ 0, %[[VECTOR_SCEVCHECK]] ], [ 0, %[[ITER_CHECK]] ]
-; CHECK-NEXT:    [[BC_MERGE_RDX11:%.*]] = phi i16 [ [[TMP14]], %[[VEC_EPILOG_MIDDLE_BLOCK]] ], [ [[TMP8]], %[[VEC_EPILOG_ITER_CHECK]] ], [ 0, %[[VECTOR_SCEVCHECK]] ], [ 0, %[[ITER_CHECK]] ]
+; CHECK-NEXT:    [[BC_MERGE_RDX10:%.*]] = phi i16 [ [[TMP14]], %[[VEC_EPILOG_MIDDLE_BLOCK]] ], [ [[TMP8]], %[[VEC_EPILOG_ITER_CHECK]] ], [ 0, %[[VECTOR_SCEVCHECK]] ], [ 0, %[[ITER_CHECK]] ]
 ; CHECK-NEXT:    br label %[[LOOP:.*]]
 ; CHECK:       [[LOOP]]:
 ; CHECK-NEXT:    [[IV:%.*]] = phi i32 [ [[BC_RESUME_VAL]], %[[VEC_EPILOG_SCALAR_PH]] ], [ [[IV_NEXT:%.*]], %[[LOOP]] ]
-; CHECK-NEXT:    [[SUM:%.*]] = phi i16 [ [[BC_MERGE_RDX11]], %[[VEC_EPILOG_SCALAR_PH]] ], [ [[SUM_NEXT:%.*]], %[[LOOP]] ]
+; CHECK-NEXT:    [[SUM:%.*]] = phi i16 [ [[BC_MERGE_RDX10]], %[[VEC_EPILOG_SCALAR_PH]] ], [ [[SUM_NEXT:%.*]], %[[LOOP]] ]
 ; CHECK-NEXT:    [[BOUNDED:%.*]] = urem i32 [[IV]], 4
 ; CHECK-NEXT:    [[GEP:%.*]] = getelementptr inbounds i16, ptr [[A]], i32 [[BOUNDED]]
 ; CHECK-NEXT:    [[LV:%.*]] = load i16, ptr [[GEP]], align 2
@@ -335,7 +335,7 @@ define i32 @bounded_user_ic_exceeds_window(ptr %A, i32 %N) {
 ; CHECK-NEXT:    [[TMP1:%.*]] = icmp ugt i32 [[TMP0]], 3
 ; CHECK-NEXT:    br i1 [[TMP1]], label %[[SCALAR_PH]], label %[[VECTOR_PH:.*]]
 ; CHECK:       [[VECTOR_PH]]:
-; CHECK-NEXT:    [[N_MOD_VF:%.*]] = urem i32 [[N]], 32
+; CHECK-NEXT:    [[N_MOD_VF:%.*]] = and i32 [[N]], 31
 ; CHECK-NEXT:    [[N_VEC:%.*]] = sub i32 [[N]], [[N_MOD_VF]]
 ; CHECK-NEXT:    br label %[[VECTOR_BODY:.*]]
 ; CHECK:       [[VECTOR_BODY]]:
@@ -535,7 +535,7 @@ define i32 @reverse_load_with_bounded(ptr %A, ptr %B, i32 %N) {
 ; CHECK-NEXT:    [[MIN_ITERS_CHECK2:%.*]] = icmp ult i32 [[N]], 16
 ; CHECK-NEXT:    br i1 [[MIN_ITERS_CHECK2]], label %[[VEC_EPILOG_PH:.*]], label %[[VECTOR_PH:.*]]
 ; CHECK:       [[VECTOR_PH]]:
-; CHECK-NEXT:    [[N_MOD_VF:%.*]] = urem i32 [[N]], 16
+; CHECK-NEXT:    [[N_MOD_VF:%.*]] = and i32 [[N]], 15
 ; CHECK-NEXT:    [[N_VEC:%.*]] = sub i32 [[N]], [[N_MOD_VF]]
 ; CHECK-NEXT:    br label %[[VECTOR_BODY:.*]]
 ; CHECK:       [[VECTOR_BODY]]:
@@ -591,7 +591,7 @@ define i32 @reverse_load_with_bounded(ptr %A, ptr %B, i32 %N) {
 ; CHECK:       [[VEC_EPILOG_PH]]:
 ; CHECK-NEXT:    [[VEC_EPILOG_RESUME_VAL:%.*]] = phi i32 [ [[N_VEC]], %[[VEC_EPILOG_ITER_CHECK]] ], [ 0, %[[VECTOR_MAIN_LOOP_ITER_CHECK]] ]
 ; CHECK-NEXT:    [[BC_MERGE_RDX:%.*]] = phi i32 [ [[TMP24]], %[[VEC_EPILOG_ITER_CHECK]] ], [ 0, %[[VECTOR_MAIN_LOOP_ITER_CHECK]] ]
-; CHECK-NEXT:    [[N_MOD_VF18:%.*]] = urem i32 [[N]], 4
+; CHECK-NEXT:    [[N_MOD_VF18:%.*]] = and i32 [[N]], 3
 ; CHECK-NEXT:    [[N_VEC19:%.*]] = sub i32 [[N]], [[N_MOD_VF18]]
 ; CHECK-NEXT:    [[TMP25:%.*]] = insertelement <4 x i32> zeroinitializer, i32 [[BC_MERGE_RDX]], i32 0
 ; CHECK-NEXT:    br label %[[VEC_EPILOG_VECTOR_BODY:.*]]
@@ -617,11 +617,11 @@ define i32 @reverse_load_with_bounded(ptr %A, ptr %B, i32 %N) {
 ; CHECK-NEXT:    br i1 [[CMP_N26]], label %[[EXIT]], label %[[VEC_EPILOG_SCALAR_PH]]
 ; CHECK:       [[VEC_EPILOG_SCALAR_PH]]:
 ; CHECK-NEXT:    [[BC_RESUME_VAL:%.*]] = phi i32 [ [[N_VEC19]], %[[VEC_EPILOG_MIDDLE_BLOCK]] ], [ [[N_VEC]], %[[VEC_EPILOG_ITER_CHECK]] ], [ 0, %[[VECTOR_SCEVCHECK]] ], [ 0, %[[ITER_CHECK]] ]
-; CHECK-NEXT:    [[BC_MERGE_RDX27:%.*]] = phi i32 [ [[TMP34]], %[[VEC_EPILOG_MIDDLE_BLOCK]] ], [ [[TMP24]], %[[VEC_EPILOG_ITER_CHECK]] ], [ 0, %[[VECTOR_SCEVCHECK]] ], [ 0, %[[ITER_CHECK]] ]
+; CHECK-NEXT:    [[BC_MERGE_RDX26:%.*]] = phi i32 [ [[TMP34]], %[[VEC_EPILOG_MIDDLE_BLOCK]] ], [ [[TMP24]], %[[VEC_EPILOG_ITER_CHECK]] ], [ 0, %[[VECTOR_SCEVCHECK]] ], [ 0, %[[ITER_CHECK]] ]
 ; CHECK-NEXT:    br label %[[LOOP:.*]]
 ; CHECK:       [[LOOP]]:
 ; CHECK-NEXT:    [[IV:%.*]] = phi i32 [ [[BC_RESUME_VAL]], %[[VEC_EPILOG_SCALAR_PH]] ], [ [[IV_NEXT:%.*]], %[[LOOP]] ]
-; CHECK-NEXT:    [[SUM:%.*]] = phi i32 [ [[BC_MERGE_RDX27]], %[[VEC_EPILOG_SCALAR_PH]] ], [ [[SUM_NEXT:%.*]], %[[LOOP]] ]
+; CHECK-NEXT:    [[SUM:%.*]] = phi i32 [ [[BC_MERGE_RDX26]], %[[VEC_EPILOG_SCALAR_PH]] ], [ [[SUM_NEXT:%.*]], %[[LOOP]] ]
 ; CHECK-NEXT:    [[BOUNDED:%.*]] = urem i32 [[IV]], 4
 ; CHECK-NEXT:    [[GEP1:%.*]] = getelementptr inbounds i32, ptr [[A]], i32 [[BOUNDED]]
 ; CHECK-NEXT:    [[LV1:%.*]] = load i32, ptr [[GEP1]], align 4
diff --git a/llvm/test/Transforms/LoopVectorize/AArch64/call-costs.ll b/llvm/test/Transforms/LoopVectorize/AArch64/call-costs.ll
index 47ec13b653a18..2143cf45fc1bd 100644
--- a/llvm/test/Transforms/LoopVectorize/AArch64/call-costs.ll
+++ b/llvm/test/Transforms/LoopVectorize/AArch64/call-costs.ll
@@ -259,7 +259,7 @@ define void @widen_intrinsics_with_mixed_return_types(ptr noalias %src, ptr noal
 ; CHECK-NEXT:    [[MIN_ITERS_CHECK:%.*]] = icmp ult i64 [[N]], 8
 ; CHECK-NEXT:    br i1 [[MIN_ITERS_CHECK]], label %[[SCALAR_PH:.*]], label %[[VECTOR_PH:.*]]
 ; CHECK:       [[VECTOR_PH]]:
-; CHECK-NEXT:    [[N_MOD_VF:%.*]] = urem i64 [[N]], 8
+; CHECK-NEXT:    [[N_MOD_VF:%.*]] = and i64 [[N]], 7
 ; CHECK-NEXT:    [[N_VEC:%.*]] = sub i64 [[N]], [[N_MOD_VF]]
 ; CHECK-NEXT:    [[BROADCAST_SPLATINSERT:%.*]] = insertelement <4 x i32> poison, i32 [[X]], i64 0
 ; CHECK-NEXT:    [[BROADCAST_SPLAT:%.*]] = shufflevector <4 x i32> [[BROADCAST_SPLATINSERT]], <4 x i32> poison, <4 x i32> zeroinitializer
@@ -277,7 +277,7 @@ define void @widen_intrinsics_with_mixed_return_types(ptr noalias %src, ptr noal
 ; CHECK-NEXT:    store <4 x i32> [[TMP2]], ptr [[TMP4]], align 4
 ; CHECK-NEXT:    [[INDEX_NEXT]] = add nuw i64 [[INDEX]], 8
 ; CHECK-NEXT:    [[TMP5:%.*]] = icmp eq i64 [[INDEX_NEXT]], [[N_VEC]]
-; CHECK-NEXT:    br i1 [[TMP5]], label %[[MIDDLE_BLOCK:.*]], label %[[VECTOR_BODY]], !llvm.loop [[LOOP6:![0-9]+]]
+; CHECK-NEXT:    br i1 [[TMP5]], label %[[MIDDLE_BLOCK:.*]], label %[[VECTOR_BODY]], !llvm.loop [[LOOP5:![0-9]+]]
 ; CHECK:       [[MIDDLE_BLOCK]]:
 ; CHECK-NEXT:    [[CMP_N:%.*]] = icmp eq i64 [[N]], [[N_VEC]]
 ; CHECK-NEXT:    br i1 [[CMP_N]], label %[[EXIT:.*]], label %[[SCALAR_PH]]
@@ -296,7 +296,7 @@ define void @widen_intrinsics_with_mixed_return_types(ptr noalias %src, ptr noal
 ; CHECK-NEXT:    store i32 [[COND]], ptr [[DST_GEP]], align 4
 ; CHECK-NEXT:    [[IV_NEXT]] = add nuw nsw i64 [[IV]], 1
 ; CHECK-NEXT:    [[DONE:%.*]] = icmp eq i64 [[IV_NEXT]], [[N]]
-; CHECK-NEXT:    br i1 [[DONE]], label %[[EXIT]], label %[[LOOP]], !llvm.loop [[LOOP7:![0-9]+]]
+; CHECK-NEXT:    br i1 [[DONE]], label %[[EXIT]], label %[[LOOP]], !llvm.loop [[LOOP6:![0-9]+]]
 ; CHECK:       [[EXIT]]:
 ; CHECK-NEXT:    ret void
 ;
diff --git a/llvm/test/Transforms/LoopVectorize/AArch64/clmul.ll b/llvm/test/Transforms/LoopVectorize/AArch64/clmul.ll
index 8871a81b4c654..b866ccd9c6cf9 100644
--- a/llvm/test/Transforms/LoopVectorize/AArch64/clmul.ll
+++ b/llvm/test/Transforms/LoopVectorize/AArch64/clmul.ll
@@ -21,7 +21,7 @@ define void @clmul_loop(ptr %a, ptr %b, ptr %c, i64 %n) {
 ; CHECK-NEXT:    [[CONFLICT_RDX:%.*]] = or i1 [[DIFF_CHECK]], [[DIFF_CHECK4]]
 ; CHECK-NEXT:    br i1 [[CONFLICT_RDX]], label %[[SCALAR_PH]], label %[[VECTOR_PH:.*]]
 ; CHECK:       [[VECTOR_PH]]:
-; CHECK-NEXT:    [[N_MOD_VF:%.*]] = urem i64 [[N]], 4
+; CHECK-NEXT:    [[N_MOD_VF:%.*]] = and i64 [[N]], 3
 ; CHECK-NEXT:    [[N_VEC:%.*]] = sub i64 [[N]], [[N_MOD_VF]]
 ; CHECK-NEXT:    br label %[[VECTOR_BODY:.*]]
 ; CHECK:       [[VECTOR_BODY]]:
diff --git a/llvm/test/Transforms/LoopVectorize/AArch64/conditional-branches-cost.ll b/llvm/test/Transforms/LoopVectorize/AArch64/conditional-branches-cost.ll
index 09852d7951c09..98bb0257a91f9 100644
--- a/llvm/test/Transforms/LoopVectorize/AArch64/conditional-branches-cost.ll
+++ b/llvm/test/Transforms/LoopVectorize/AArch64/conditional-branches-cost.ll
@@ -56,7 +56,7 @@ define void @loop_dependent_cond(ptr %src, ptr noalias %dst, i64 %N) {
 ; DEFAULT-NEXT:    [[MIN_ITERS_CHECK:%.*]] = icmp ult i64 [[TMP0]], 4
 ; DEFAULT-NEXT:    br i1 [[MIN_ITERS_CHECK]], label %[[SCALAR_PH:.*]], label %[[VECTOR_PH:.*]]
 ; DEFAULT:       [[VECTOR_PH]]:
-; DEFAULT-NEXT:    [[N_MOD_VF:%.*]] = urem i64 [[TMP0]], 4
+; DEFAULT-NEXT:    [[N_MOD_VF:%.*]] = and i64 [[TMP0]], 3
 ; DEFAULT...
[truncated]

@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown

✅ With the latest revision this PR passed the C/C++ code formatter.

@artagnon artagnon left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The challenge with mass test updates is always reverting unwanted hunks :( If you use Magit or some other git frontend, it should make it easier?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Noting non-mechanical change: why not keep n?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Because it's no longer %n I think. I'll double check.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Would be good to show what it is now?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Noting non-trivial change.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yep, the optimisation working as expected!

Comment on lines -47 to +56
; CHECK-NEXT: [[R:%.*]] = phi i64 [ [[TMP7:%.*]], %[[FOR_BODY]] ], [ [[BC_MERGE_RDX]], %[[SCALAR_PH]] ]
; CHECK-NEXT: [[TMP2:%.*]] = getelementptr inbounds i64, ptr [[A]], i64 [[I]]
; CHECK-NEXT: [[TMP6:%.*]] = load i64, ptr [[TMP2]], align 8
; CHECK-NEXT: [[TMP7]] = add i64 [[TMP6]], [[R]]
; CHECK-NEXT: [[R:%.*]] = phi i64 [ [[TMP2:%.*]], %[[FOR_BODY]] ], [ [[BC_MERGE_RDX]], %[[SCALAR_PH]] ]
; CHECK-NEXT: [[SMAX:%.*]] = getelementptr inbounds i64, ptr [[A]], i64 [[I]]
; CHECK-NEXT: [[N_MOD_VF:%.*]] = load i64, ptr [[SMAX]], align 8
; CHECK-NEXT: [[TMP2]] = add i64 [[N_MOD_VF]], [[R]]
; CHECK-NEXT: [[I_NEXT]] = add nuw nsw i64 [[I]], 1
; CHECK-NEXT: [[COND:%.*]] = icmp slt i64 [[I_NEXT]], [[N]]
; CHECK-NEXT: br i1 [[COND]], label %[[FOR_BODY]], label %[[FOR_END]], !llvm.loop [[LOOP3:![0-9]+]]
; CHECK: [[FOR_END]]:
; CHECK-NEXT: [[TMP8:%.*]] = phi i64 [ [[TMP7]], %[[FOR_BODY]] ], [ [[TMP9]], %[[MIDDLE_BLOCK]] ]
; CHECK-NEXT: ret i64 [[TMP8]]
; CHECK-NEXT: [[TMP5:%.*]] = phi i64 [ [[TMP2]], %[[FOR_BODY]] ], [ [[TMP9]], %[[MIDDLE_BLOCK]] ]
; CHECK-NEXT: ret i64 [[TMP5]]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could revert hunk?

Comment on lines -72 to +78
; INTERLEAVE-NEXT: [[TMP12:%.*]] = select <2 x i1> [[TMP6]], <2 x double> [[WIDE_LOAD]], <2 x double> zeroinitializer, !fpmath [[META3]]
; INTERLEAVE-NEXT: [[TMP8:%.*]] = select <2 x i1> [[TMP7]], <2 x double> [[WIDE_LOAD1]], <2 x double> zeroinitializer, !fpmath [[META3]]
; INTERLEAVE-NEXT: [[TMP9:%.*]] = fptrunc <2 x double> [[TMP12]] to <2 x float>, !fpmath [[META3]]
; INTERLEAVE-NEXT: [[TMP8:%.*]] = select <2 x i1> [[TMP6]], <2 x double> [[WIDE_LOAD]], <2 x double> zeroinitializer, !fpmath [[META3]]
; INTERLEAVE-NEXT: [[TMP9:%.*]] = select <2 x i1> [[TMP7]], <2 x double> [[WIDE_LOAD1]], <2 x double> zeroinitializer, !fpmath [[META3]]
; INTERLEAVE-NEXT: [[TMP10:%.*]] = fptrunc <2 x double> [[TMP8]] to <2 x float>, !fpmath [[META3]]
; INTERLEAVE-NEXT: [[TMP12:%.*]] = fptrunc <2 x double> [[TMP9]] to <2 x float>, !fpmath [[META3]]
; INTERLEAVE-NEXT: [[TMP11:%.*]] = getelementptr inbounds float, ptr [[TMP1]], i64 2
; INTERLEAVE-NEXT: store <2 x float> [[TMP9]], ptr [[TMP1]], align 4, !tbaa [[CHAR_TBAA0]]
; INTERLEAVE-NEXT: store <2 x float> [[TMP10]], ptr [[TMP11]], align 4, !tbaa [[CHAR_TBAA0]]
; INTERLEAVE-NEXT: store <2 x float> [[TMP10]], ptr [[TMP1]], align 4, !tbaa [[CHAR_TBAA0]]
; INTERLEAVE-NEXT: store <2 x float> [[TMP12]], ptr [[TMP11]], align 4, !tbaa [[CHAR_TBAA0]]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could revert hunk?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could update by hand keeping N_MOD_VF pattern?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could revert lots of hunks?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Similar.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could update by hand keeping N_MOD_VF pattern?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Similar.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could revert hunks?

@david-arm

Copy link
Copy Markdown
Contributor Author

The challenge with mass test updates is always reverting unwanted hunks :( If you use Magit or some other git frontend, it should make it easier?

Sorry, I don't know what you mean. How can I revert test changes if that would cause the tests to fail?

@artagnon

artagnon commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

The challenge with mass test updates is always reverting unwanted hunks :( If you use Magit or some other git frontend, it should make it easier?

Sorry, I don't know what you mean. How can I revert test changes if that would cause the tests to fail?

Ah, the trick is always selecting the hunks in the diff to stage -- Magit is just a nicer frontend to git add -p, so you stage just the urem changes in each file, and drop the rest? When the FileCheck pattern is different, you'd have to manually edit and rewrite it to the earlier pattern though, and I know the pain myself :(

@david-arm

Copy link
Copy Markdown
Contributor Author

Ah, the trick is always selecting the hunks in the diff to stage -- Magit is just a nicer frontend to git add -p, so you stage just the urem changes in each file, and drop the rest? When the FileCheck pattern is different, you'd have to manually edit and rewrite it to the earlier pattern though, and I know the pain myself :(

OK, I've never heard of Magit and I've never used git add -p so two new things for me today. :)

If there are hundreds of files that need manually rewriting I'd rather just have a pre-commit PR that regenerates all the CHECK lines instead. This will be of more benefit to everyone I think, since others will hit exactly the same issue at some point.

@artagnon

artagnon commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

If there are hundreds of files that need manually rewriting I'd rather just have a pre-commit PR that regenerates all the CHECK lines instead. This will be of more benefit to everyone I think, since others will hit exactly the same issue at some point.

I agree with this, but in this case, I think UTC was perturbed by the urem variable-name-change (it uses heuristics to keep variable names), and I don't think there is anything to regen and pre-commit for most files, unfortunately.

@david-arm

Copy link
Copy Markdown
Contributor Author

I agree with this, but in this case, I think UTC was perturbed by the urem variable-name-change (it uses heuristics to keep variable names), and I don't think there is anything to regen and pre-commit for most files, unfortunately.

In general, I'm also not keen on manually editing files that have : NOTE: Assertions have been autogenerated by utils/update_test_checks.py because it seems to me that's a contradiction. Really, if we're manually editing files we should also remove the NOTE I think but that's just my opinion!

@artagnon

artagnon commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Really, if we're manually editing files we should also remove the NOTE I think but that's just my opinion!

It's just some best-effort to unstage some hunks, to compensate for UTC's deficiencies -- I personally always try to do it, and don't mind if others don't, but just noting that it's maybe 30 mins of grunt work with the right tools for 100+ files?

@david-arm

Copy link
Copy Markdown
Contributor Author

It's just some best-effort to unstage some hunks, to compensate for UTC's deficiencies -- I personally always try to do it, and don't mind if others don't, but just noting that it's maybe 30 mins of grunt work with the right tools for 100+ files?

I don't mind having a look at seeing how prevalent this is and find a solution, but just saying in general I prefer not to manually edit files that claim to be auto-generated that's all.

; CHECK: [[SCALAR_PH]]:
; CHECK-NEXT: [[BC_RESUME_VAL12:%.*]] = phi ptr [ [[TMP7]], %[[VEC_EPILOG_MIDDLE_BLOCK]] ], [ [[TMP13]], %[[VEC_EPILOG_ITER_CHECK]] ], [ [[DST]], %[[VECTOR_MEMCHECK1]] ], [ [[DST]], %[[LOOP_PREHEADER]] ]
; CHECK-NEXT: [[BC_RESUME_VAL13:%.*]] = phi i32 [ [[TMP8]], %[[VEC_EPILOG_MIDDLE_BLOCK]] ], [ [[TMP15]], %[[VEC_EPILOG_ITER_CHECK]] ], [ [[WIDTH]], %[[VECTOR_MEMCHECK1]] ], [ [[WIDTH]], %[[LOOP_PREHEADER]] ]
; CHECK-NEXT: [[BC_RESUME_VAL11:%.*]] = phi ptr [ [[TMP7]], %[[VEC_EPILOG_MIDDLE_BLOCK]] ], [ [[TMP13]], %[[VEC_EPILOG_ITER_CHECK]] ], [ [[DST]], %[[VECTOR_MEMCHECK1]] ], [ [[DST]], %[[LOOP_PREHEADER]] ]

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@artagnon this is an example that I think can be easily fixed by a pre-commit regenerating CHECK lines. The urem changes didn't affect the variable name.

@lukel97 lukel97 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM, test diffs looked as expected. I'm honestly not too concerned about the UTC churn, manually staging hunks doesn't sound like a good use of time if another UTC update down the line is going to rename them anyway.

david-arm added a commit to david-arm/llvm-project that referenced this pull request Aug 6, 2026
david-arm added a commit to david-arm/llvm-project that referenced this pull request Aug 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants