[llvm] [AMDGPU] Add option to prevent insns straddling half cache-line boundaries (PR #150239)

via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 23 08:36:57 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/CodeGen/AMDGPU/no_straddle.ll llvm/test/CodeGen/AMDGPU/no_straddle_amdgcn.bitcast.1024bit.ll llvm/test/CodeGen/AMDGPU/no_straddle_fcanonicalize.f16.ll llvm/test/CodeGen/AMDGPU/no_straddle_global_store_short_saddr_t16.ll llvm/test/CodeGen/AMDGPU/no_straddle_llvm.amdgcn.mfma.scale.f32.16x16x128.f8f6f4.ll llvm/test/CodeGen/AMDGPU/no_straddle_llvm.amdgcn.mfma.scale.f32.32x32x64.f8f6f4.ll llvm/test/CodeGen/AMDGPU/no_straddle_memmove-var-size.ll llvm/test/CodeGen/AMDGPU/no_straddle_mfma-loop.ll llvm/test/CodeGen/AMDGPU/no_straddle_mfma-no-register-aliasing.ll llvm/test/CodeGen/AMDGPU/no_straddle_mfma-vgpr-cd-select.ll llvm/test/CodeGen/AMDGPU/no_straddle_saddsat.ll llvm/test/CodeGen/AMDGPU/no_straddle_shufflevector.v2p3.v8p3.ll llvm/test/CodeGen/AMDGPU/no_straddle_sub.ll llvm/test/CodeGen/AMDGPU/no_straddle_wave32.ll llvm/test/CodeGen/AMDGPU/no_straddle_wqm.ll llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp llvm/lib/Target/AMDGPU/AMDGPUMCInstLower.cpp llvm/lib/Target/AMDGPU/SIMachineFunctionInfo.h
``````````

</details>


The following files introduce new uses of undef:
 - llvm/test/CodeGen/AMDGPU/no_straddle_fcanonicalize.f16.ll
 - llvm/test/CodeGen/AMDGPU/no_straddle_global_store_short_saddr_t16.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/150239


More information about the llvm-commits mailing list