[llvm-branch-commits] [llvm] AMDGPU: Replace some float undef test uses with poison (PR #131090)
via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Thu Mar 13 00:46:05 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)' f66d04c3795174ffc6052771083519059b3cfe08 4ed51855d45fb3b94f4cdcd04adb69f4a430037d llvm/test/CodeGen/AMDGPU/GlobalISel/i1-copy.ll llvm/test/CodeGen/AMDGPU/GlobalISel/irtranslator-amdgpu_vs.ll llvm/test/CodeGen/AMDGPU/GlobalISel/llvm.amdgcn.div.scale.ll llvm/test/CodeGen/AMDGPU/GlobalISel/llvm.amdgcn.fmul.legacy.ll llvm/test/CodeGen/AMDGPU/GlobalISel/llvm.amdgcn.rsq.clamp.ll llvm/test/CodeGen/AMDGPU/adjust-writemask-invalid-copy.ll llvm/test/CodeGen/AMDGPU/amdgpu-codegenprepare-fdiv.ll llvm/test/CodeGen/AMDGPU/amdgpu-reloc-const.ll llvm/test/CodeGen/AMDGPU/cndmask-no-def-vcc.ll llvm/test/CodeGen/AMDGPU/commute-shifts.ll llvm/test/CodeGen/AMDGPU/cse-phi-incoming-val.ll llvm/test/CodeGen/AMDGPU/dagcombine-fma-fmad.ll llvm/test/CodeGen/AMDGPU/diverge-extra-formal-args.ll llvm/test/CodeGen/AMDGPU/diverge-interp-mov-lower.ll llvm/test/CodeGen/AMDGPU/dual-source-blend-export.ll llvm/test/CodeGen/AMDGPU/i1-copy-from-loop.ll llvm/test/CodeGen/AMDGPU/insert_vector_elt.ll llvm/test/CodeGen/AMDGPU/ipra-return-address-save-restore.ll llvm/test/CodeGen/AMDGPU/llvm.amdgcn.class.ll llvm/test/CodeGen/AMDGPU/llvm.amdgcn.cvt.pkrtz.ll llvm/test/CodeGen/AMDGPU/llvm.amdgcn.div.scale.ll llvm/test/CodeGen/AMDGPU/llvm.amdgcn.exp.row.ll llvm/test/CodeGen/AMDGPU/llvm.amdgcn.fmul.legacy.ll llvm/test/CodeGen/AMDGPU/llvm.amdgcn.fract.ll llvm/test/CodeGen/AMDGPU/llvm.amdgcn.image.nsa.ll llvm/test/CodeGen/AMDGPU/llvm.amdgcn.raw.buffer.load.ll llvm/test/CodeGen/AMDGPU/llvm.amdgcn.raw.ptr.buffer.load.ll llvm/test/CodeGen/AMDGPU/llvm.amdgcn.rcp.legacy.ll llvm/test/CodeGen/AMDGPU/llvm.amdgcn.rcp.ll llvm/test/CodeGen/AMDGPU/llvm.amdgcn.rsq.clamp.ll llvm/test/CodeGen/AMDGPU/llvm.amdgcn.rsq.legacy.ll llvm/test/CodeGen/AMDGPU/llvm.amdgcn.rsq.ll llvm/test/CodeGen/AMDGPU/llvm.amdgcn.s.buffer.load.ll llvm/test/CodeGen/AMDGPU/llvm.exp.ll llvm/test/CodeGen/AMDGPU/llvm.exp10.ll llvm/test/CodeGen/AMDGPU/llvm.exp2.ll llvm/test/CodeGen/AMDGPU/llvm.log.ll llvm/test/CodeGen/AMDGPU/llvm.log10.ll llvm/test/CodeGen/AMDGPU/llvm.log2.ll llvm/test/CodeGen/AMDGPU/load-local-redundant-copies.ll llvm/test/CodeGen/AMDGPU/loop_exit_with_xor.ll llvm/test/CodeGen/AMDGPU/memory_clause.ll llvm/test/CodeGen/AMDGPU/mixed-wave32-wave64.ll llvm/test/CodeGen/AMDGPU/rename-disconnected-bug.ll llvm/test/CodeGen/AMDGPU/ret.ll llvm/test/CodeGen/AMDGPU/scratch-simple.ll llvm/test/CodeGen/AMDGPU/select-undef.ll llvm/test/CodeGen/AMDGPU/sgpr-copy.ll llvm/test/CodeGen/AMDGPU/si-spill-cf.ll llvm/test/CodeGen/AMDGPU/simplifydemandedbits-recursion.ll llvm/test/CodeGen/AMDGPU/skip-if-dead.ll llvm/test/CodeGen/AMDGPU/smrd.ll llvm/test/CodeGen/AMDGPU/split-smrd.ll llvm/test/CodeGen/AMDGPU/subreg-coalescer-crash.ll llvm/test/CodeGen/AMDGPU/undefined-subreg-liverange.ll llvm/test/CodeGen/AMDGPU/unigine-liveness-crash.ll llvm/test/CodeGen/AMDGPU/vgpr-descriptor-waterfall-loop-idom-update.ll llvm/test/CodeGen/AMDGPU/vgpr-liverange-ir.ll llvm/test/CodeGen/AMDGPU/wave32.ll llvm/test/CodeGen/AMDGPU/wqm.ll llvm/test/CodeGen/AMDGPU/xor3-i1-const.ll
``````````
</details>
The following files introduce new uses of undef:
- llvm/test/CodeGen/AMDGPU/cndmask-no-def-vcc.ll
- llvm/test/CodeGen/AMDGPU/ipra-return-address-save-restore.ll
- llvm/test/CodeGen/AMDGPU/loop_exit_with_xor.ll
- llvm/test/CodeGen/AMDGPU/select-undef.ll
- llvm/test/CodeGen/AMDGPU/si-spill-cf.ll
- llvm/test/CodeGen/AMDGPU/vgpr-descriptor-waterfall-loop-idom-update.ll
- llvm/test/CodeGen/AMDGPU/wave32.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/131090
More information about the llvm-branch-commits
mailing list