[llvm] AMDGPU/UniformityAnalysis: Test MIR uniformity analysis for INLINEASM (PR #201956)

Pankaj Dwivedi via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 8 03:59:25 PDT 2026


================
@@ -0,0 +1,60 @@
+# RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx908 -run-pass=print-machine-uniformity -o - %s 2>&1 | FileCheck %s
+# RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx908 -passes='print<machine-uniformity>' -filetype=null %s 2>&1 | FileCheck %s
+
+# CHECK-LABEL: MachineUniformityInfo for function:  @inlineasm_s
+# CHECK-LABEL: BLOCK bb.0
+# CHECK-NOT: DIVERGENT: %0: INLINEASM
+---
+name:            inlineasm_s
+tracksRegLiveness: true
+body:             |
+  bb.0:
+    INLINEASM &"s_mov_b32 $0, 7", attdialect, regdef:SReg_32, def %0:sreg_32
+    $sgpr0 = COPY %0
+    SI_RETURN implicit $sgpr0
+...
+
+# CHECK-LABEL: MachineUniformityInfo for function:  @inlineasm_v
+# CHECK-LABEL: BLOCK bb.0
+# CHECK-NOT: DIVERGENT: %0: INLINEASM
+---
+name:            inlineasm_v
+tracksRegLiveness: true
+body:             |
+  bb.0:
+    INLINEASM &"v_mov_b32 $0, 8", attdialect, regdef:VGPR_32, def %0:vgpr_32
+    $vgpr0 = COPY %0
+    SI_RETURN implicit $vgpr0
+...
+
+# CHECK-LABEL: MachineUniformityInfo for function:  @inlineasm_sv
+# CHECK-LABEL: BLOCK bb.0
+# CHECK-NOT: DIVERGENT: %0: INLINEASM
+# CHECK-NOT: DIVERGENT: %1: INLINEASM
+---
+name:            inlineasm_sv
+tracksRegLiveness: true
+body:             |
+  bb.0:
+    INLINEASM &"s_mov_b32 $0, 7\0Av_mov_b32 $1, 8", attdialect, regdef:SReg_32, def %0:sreg_32, regdef:VGPR_32, def %1:vgpr_32
+    $sgpr0 = COPY %0
+    $vgpr0 = COPY %1
+    SI_RETURN implicit $sgpr0, implicit $vgpr0
+...
+
+# CHECK-LABEL: MachineUniformityInfo for function:  @inlineasm_svs
+# CHECK-LABEL: BLOCK bb.0
+# CHECK-NOT: DIVERGENT: %0: INLINEASM
+# CHECK-NOT: DIVERGENT: %1: INLINEASM
----------------
PankajDwivedi-25 wrote:

But later we have to separate out call getValueUniformity() call inside initialize() which is currently returning for whole instruction and uses value uniformity enum.

https://github.com/llvm/llvm-project/pull/201956


More information about the llvm-commits mailing list