[llvm] [VPlan] Introduce CSE pass (PR #151872)

via llvm-commits llvm-commits at lists.llvm.org
Sun Aug 3 10:37:50 PDT 2025


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {undef deprecator}-->


:warning: undef deprecator found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git diff -U0 --pickaxe-regex -S '([^a-zA-Z0-9#_-]undef[^a-zA-Z0-9_-]|UndefValue::get)' 'HEAD~1' HEAD llvm/test/Transforms/LoopVectorize/X86/cse-bitcast.ll llvm/lib/Transforms/Vectorize/LoopVectorize.cpp llvm/lib/Transforms/Vectorize/VPlan.cpp llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp llvm/lib/Transforms/Vectorize/VPlanTransforms.h llvm/lib/Transforms/Vectorize/VPlanUtils.h llvm/lib/Transforms/Vectorize/VPlanValue.h llvm/test/Transforms/LoopVectorize/AArch64/epilog-vectorization-widen-inductions.ll llvm/test/Transforms/LoopVectorize/AArch64/force-target-instruction-cost.ll llvm/test/Transforms/LoopVectorize/AArch64/induction-costs.ll llvm/test/Transforms/LoopVectorize/AArch64/licm-calls.ll llvm/test/Transforms/LoopVectorize/AArch64/partial-reduce-dot-product.ll llvm/test/Transforms/LoopVectorize/AArch64/reduction-recurrence-costs-sve.ll llvm/test/Transforms/LoopVectorize/AArch64/sve-epilog-vect.ll llvm/test/Transforms/LoopVectorize/AArch64/sve-vscale-based-trip-counts.ll llvm/test/Transforms/LoopVectorize/AArch64/sve-widen-phi.ll llvm/test/Transforms/LoopVectorize/ARM/mve-qabs.ll llvm/test/Transforms/LoopVectorize/ARM/mve-reduction-types.ll llvm/test/Transforms/LoopVectorize/ARM/pointer_iv.ll llvm/test/Transforms/LoopVectorize/RISCV/inloop-reduction.ll llvm/test/Transforms/LoopVectorize/RISCV/scalable-tailfold.ll llvm/test/Transforms/LoopVectorize/RISCV/strided-accesses.ll llvm/test/Transforms/LoopVectorize/X86/cost-constant-known-via-scev.ll llvm/test/Transforms/LoopVectorize/X86/induction-costs.ll llvm/test/Transforms/LoopVectorize/X86/uniform_load.ll llvm/test/Transforms/LoopVectorize/first-order-recurrence-complex.ll llvm/test/Transforms/LoopVectorize/first-order-recurrence-multiply-recurrences.ll llvm/test/Transforms/LoopVectorize/first-order-recurrence.ll llvm/test/Transforms/LoopVectorize/induction.ll llvm/test/Transforms/LoopVectorize/interleave-with-i65-induction.ll llvm/test/Transforms/LoopVectorize/interleaved-accesses-different-insert-position.ll llvm/test/Transforms/LoopVectorize/opaque-ptr.ll llvm/test/Transforms/LoopVectorize/pointer-induction.ll llvm/test/Transforms/LoopVectorize/pr36983.ll llvm/test/Transforms/LoopVectorize/pr59319-loop-access-info-invalidation.ll llvm/test/Transforms/LoopVectorize/reverse_induction.ll llvm/test/Transforms/LoopVectorize/single-value-blend-phis.ll llvm/test/Transforms/LoopVectorize/vector-loop-backedge-elimination-branch-weights.ll llvm/test/Transforms/LoopVectorize/vector-loop-backedge-elimination.ll llvm/test/Transforms/LoopVectorize/version-stride-with-integer-casts.ll llvm/test/Transforms/LoopVectorize/vplan-printing-before-execute.ll
``````````

</details>


The following files introduce new uses of undef:
 - llvm/test/Transforms/LoopVectorize/pr36983.ll

[Undef](https://llvm.org/docs/LangRef.html#undefined-values) is now deprecated and should only be used in the rare cases where no replacement is possible. For example, a load of uninitialized memory yields `undef`. You should use `poison` values for placeholders instead.

In tests, avoid using `undef` and having tests that trigger undefined behavior. If you need an operand with some unimportant value, you can add a new argument to the function and use that instead.

For example, this is considered a bad practice:
```llvm
define void @fn() {
  ...
  br i1 undef, ...
}
```

Please use the following instead:
```llvm
define void @fn(i1 %cond) {
  ...
  br i1 %cond, ...
}
```

Please refer to the [Undefined Behavior Manual](https://llvm.org/docs/UndefinedBehavior.html) for more information.



https://github.com/llvm/llvm-project/pull/151872


More information about the llvm-commits mailing list