[llvm] [llvm] Remove `br i1 undef` from regression tests (PR #121733)
via llvm-commits
llvm-commits at lists.llvm.org
Sun Jan 5 21:33:26 PST 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)' d73ef9749e72e59d1d34275e89d4d2fffddd3e8c f350ba2b8f63e79146cc2d34887e61bca22018f0 llvm/test/CodeGen/X86/2011-06-03-x87chain.ll llvm/test/CodeGen/X86/2020_12_02_decrementing_loop.ll llvm/test/CodeGen/X86/AMX/amx-combine-undef.ll llvm/test/CodeGen/X86/AMX/lat-combine-amx-bitcast.ll llvm/test/CodeGen/X86/AMX/lat-transform-amx-bitcast.ll llvm/test/CodeGen/X86/StackColoring.ll llvm/test/CodeGen/X86/asm-label.ll llvm/test/CodeGen/X86/avx-select.ll llvm/test/CodeGen/X86/avx512-i1test.ll llvm/test/CodeGen/X86/block-placement.ll llvm/test/CodeGen/X86/clobber_frame_ptr.ll llvm/test/CodeGen/X86/combine-concatvectors.ll llvm/test/CodeGen/X86/crash.ll llvm/test/CodeGen/X86/domain-reassignment-test.ll llvm/test/CodeGen/X86/fast-isel-cmp-branch.ll llvm/test/CodeGen/X86/fold-vector-shuffle-crash.ll llvm/test/CodeGen/X86/hoist-spill.ll llvm/test/CodeGen/X86/interval-update-remat.ll llvm/test/CodeGen/X86/jump_sign.ll llvm/test/CodeGen/X86/loop-strength-reduce-crash.ll llvm/test/CodeGen/X86/lsr-crash-empty-uses.ll llvm/test/CodeGen/X86/lsr-delayed-fold.ll llvm/test/CodeGen/X86/machine-trace-metrics-crash.ll llvm/test/CodeGen/X86/merge-vector-stores-scale-idx-crash.ll llvm/test/CodeGen/X86/misched-crash.ll llvm/test/CodeGen/X86/pr10475.ll llvm/test/CodeGen/X86/pr11998.ll llvm/test/CodeGen/X86/pr32108.ll llvm/test/CodeGen/X86/pr50254.ll llvm/test/CodeGen/X86/pr57673.ll llvm/test/CodeGen/X86/ragreedy-hoist-spill.ll llvm/test/CodeGen/X86/shift-combine.ll llvm/test/CodeGen/X86/shuffle-combine-crash.ll llvm/test/CodeGen/X86/stackmap.ll llvm/test/CodeGen/X86/swifterror.ll llvm/test/CodeGen/X86/switch.ll llvm/test/CodeGen/X86/tail-merge-unreachable.ll llvm/test/CodeGen/X86/unreachable-loop-sinking.ll llvm/test/CodeGen/X86/vector-shuffle-combining-avx512bwvl.ll llvm/test/CodeGen/X86/x86-shrink-wrapping.ll
``````````
</details>
The following files introduce new uses of undef:
- llvm/test/CodeGen/X86/AMX/amx-combine-undef.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/121733
More information about the llvm-commits
mailing list