[llvm] [LoopStrengthReduce] Mitigation of issues introduced by compilation time optimization in SolveRecurse. (PR #147588)

via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 9 05:38:43 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/lib/Transforms/Scalar/LoopStrengthReduce.cpp llvm/test/CodeGen/AArch64/aarch64-p2align-max-bytes.ll llvm/test/CodeGen/AArch64/machine-combiner-copy.ll llvm/test/CodeGen/AArch64/machine-licm-sub-loop.ll llvm/test/CodeGen/AArch64/zext-to-tbl.ll llvm/test/CodeGen/AMDGPU/idiv-licm.ll llvm/test/CodeGen/AMDGPU/memintrinsic-unroll.ll llvm/test/CodeGen/AMDGPU/memmove-var-size.ll llvm/test/CodeGen/AMDGPU/mul24-pass-ordering.ll llvm/test/CodeGen/AMDGPU/noclobber-barrier.ll llvm/test/CodeGen/ARM/2011-03-15-LdStMultipleBug.ll llvm/test/CodeGen/ARM/dsp-loop-indexing.ll llvm/test/CodeGen/ARM/fpclamptosat.ll llvm/test/CodeGen/ARM/loop-indexing.ll llvm/test/CodeGen/NVPTX/load-with-non-coherent-cache.ll llvm/test/CodeGen/PowerPC/lsr-profitable-chain.ll llvm/test/CodeGen/PowerPC/more-dq-form-prepare.ll llvm/test/CodeGen/RISCV/riscv-codegenprepare-asm.ll llvm/test/CodeGen/RISCV/rvv/fixed-vectors-strided-load-store-asm.ll llvm/test/CodeGen/Thumb2/LowOverheadLoops/mve-float-loops.ll llvm/test/CodeGen/Thumb2/LowOverheadLoops/mve-tail-data-types.ll llvm/test/CodeGen/Thumb2/mve-blockplacement.ll llvm/test/CodeGen/Thumb2/mve-float16regloops.ll llvm/test/CodeGen/Thumb2/mve-float32regloops.ll llvm/test/CodeGen/Thumb2/mve-memtp-loop.ll llvm/test/CodeGen/WebAssembly/unrolled-mem-indices.ll llvm/test/CodeGen/X86/apx/check-nf-in-suppress-reloc-pass.ll llvm/test/CodeGen/X86/avx512vnni-combine.ll llvm/test/CodeGen/X86/avxvnni-combine.ll llvm/test/CodeGen/X86/dag-update-nodetomatch.ll llvm/test/CodeGen/X86/loop-strength-reduce7.ll llvm/test/CodeGen/X86/masked-iv-safe.ll llvm/test/CodeGen/X86/optimize-max-0.ll llvm/test/CodeGen/X86/pr42565.ll llvm/test/CodeGen/X86/ragreedy-hoist-spill.ll llvm/test/Transforms/LoopStrengthReduce/AArch64/vscale-fixups.ll llvm/test/Transforms/LoopStrengthReduce/AMDGPU/atomics.ll llvm/test/Transforms/LoopStrengthReduce/AMDGPU/different-addrspace-addressing-mode-loops.ll llvm/test/Transforms/LoopStrengthReduce/AMDGPU/lsr-postinc-pos-addrspace.ll llvm/test/Transforms/LoopStrengthReduce/ARM/complexity.ll llvm/test/Transforms/LoopStrengthReduce/ARM/illegal-addr-modes.ll llvm/test/Transforms/LoopStrengthReduce/RISCV/many-geps.ll llvm/test/Transforms/LoopStrengthReduce/X86/ivchain-X86.ll llvm/test/Transforms/LoopStrengthReduce/X86/missing-phi-operand-update.ll llvm/test/Transforms/LoopStrengthReduce/X86/nested-loop.ll llvm/test/Transforms/LoopStrengthReduce/X86/normalization-during-scev-expansion.ll llvm/test/Transforms/LoopStrengthReduce/X86/postinc-iv-used-by-urem-and-udiv.ll llvm/test/Transforms/LoopStrengthReduce/X86/pr62660-normalization-failure.ll llvm/test/Transforms/LoopStrengthReduce/depth-limit-overrun.ll llvm/test/Transforms/LoopStrengthReduce/ivincs-hoist.ll llvm/test/Transforms/LoopStrengthReduce/lsr-overflow.ll llvm/test/Transforms/LoopStrengthReduce/lsr-term-fold-negative-testcase.ll llvm/test/Transforms/LoopStrengthReduce/uglygep.ll llvm/test/Transforms/LoopStrengthReduce/wrong-hoisting-iv.ll
``````````

</details>


The following files introduce new uses of undef:
 - llvm/test/Transforms/LoopStrengthReduce/uglygep.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/147588


More information about the llvm-commits mailing list