[llvm] AMDGPU/UniformityAnalysis: For G_AMDGPU_WHOLE_WAVE_FUNC_SETUP, always divergent (PR #203000)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 10 07:54:20 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-backend-amdgpu
Author: Petar Avramovic (petar-avramovic)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/203000.diff
2 Files Affected:
- (modified) llvm/lib/Target/AMDGPU/SIInstrInfo.cpp (+4)
- (added) llvm/test/Analysis/UniformityAnalysis/AMDGPU/MIR/never-uniform-gmir.mir (+13)
``````````diff
diff --git a/llvm/lib/Target/AMDGPU/SIInstrInfo.cpp b/llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
index b4fa13c8ebae3..cf19ef63dce31 100644
--- a/llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
+++ b/llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
@@ -10992,6 +10992,10 @@ SIInstrInfo::getGenericValueUniformity(const MachineInstr &MI) const {
if (Opcode == TargetOpcode::G_DYN_STACKALLOC)
return ValueUniformity::AlwaysUniform;
+ if (Opcode == AMDGPU::G_AMDGPU_WHOLE_WAVE_FUNC_SETUP) {
+ return ValueUniformity::NeverUniform;
+ }
+
return ValueUniformity::Default;
}
diff --git a/llvm/test/Analysis/UniformityAnalysis/AMDGPU/MIR/never-uniform-gmir.mir b/llvm/test/Analysis/UniformityAnalysis/AMDGPU/MIR/never-uniform-gmir.mir
new file mode 100644
index 0000000000000..e59410179b526
--- /dev/null
+++ b/llvm/test/Analysis/UniformityAnalysis/AMDGPU/MIR/never-uniform-gmir.mir
@@ -0,0 +1,13 @@
+# RUN: llc -mtriple=amdgcn-- -run-pass=print-machine-uniformity -o - %s 2>&1 | FileCheck %s
+# RUN: llc -mtriple=amdgcn-- -passes='print<machine-uniformity>' -filetype=null %s 2>&1 | FileCheck %s
+
+# whole wave func setup (original exec mask) is a divergence source
+---
+name: whole_wave_func_setup
+body: |
+ bb.0:
+ ; CHECK-LABEL: MachineUniformityInfo for function: @whole_wave_func_setup
+ ; CHECK: DIVERGENT: %0: %0:_(s1) = G_AMDGPU_WHOLE_WAVE_FUNC_SETUP
+ %0:_(s1) = G_AMDGPU_WHOLE_WAVE_FUNC_SETUP
+ G_AMDGPU_WHOLE_WAVE_FUNC_RETURN %0(s1)
+...
``````````
</details>
https://github.com/llvm/llvm-project/pull/203000
More information about the llvm-commits
mailing list