Skip to content

Commit ac55d78

Browse files
authored
AMDGPU: Don't duplicate implicit operands in 3-address conversion (#168426)
We previously got a duplicate implicit $exec operand. It didn't really hurt anything (other than being a slight drag on compile-time performance). Still, let's keep things clean.
1 parent 418204d commit ac55d78

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

llvm/lib/Target/AMDGPU/SIInstrInfo.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4187,7 +4187,7 @@ SIInstrInfo::convertToThreeAddressImpl(MachineInstr &MI,
41874187
if (NewMFMAOpc != -1) {
41884188
MachineInstrBuilder MIB =
41894189
BuildMI(MBB, MI, MI.getDebugLoc(), get(NewMFMAOpc));
4190-
for (unsigned I = 0, E = MI.getNumOperands(); I != E; ++I)
4190+
for (unsigned I = 0, E = MI.getNumExplicitOperands(); I != E; ++I)
41914191
MIB.add(MI.getOperand(I));
41924192
return MIB;
41934193
}
@@ -4196,7 +4196,7 @@ SIInstrInfo::convertToThreeAddressImpl(MachineInstr &MI,
41964196
unsigned NewOpc = AMDGPU::mapWMMA2AddrTo3AddrOpcode(MI.getOpcode());
41974197
MachineInstrBuilder MIB = BuildMI(MBB, MI, MI.getDebugLoc(), get(NewOpc))
41984198
.setMIFlags(MI.getFlags());
4199-
for (unsigned I = 0, E = MI.getNumOperands(); I != E; ++I)
4199+
for (unsigned I = 0, E = MI.getNumExplicitOperands(); I != E; ++I)
42004200
MIB->addOperand(MI.getOperand(I));
42014201
return MIB;
42024202
}

llvm/test/CodeGen/AMDGPU/twoaddr-wmma.mir

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# RUN: llc -mtriple=amdgcn -mcpu=gfx1100 %s --passes=two-address-instruction -verify-each -o - | FileCheck -check-prefix=GCN %s
33

44
# GCN-LABEL: name: test_v_wmma_f32_16x16x16_f16_twoaddr_w32
5-
# GCN: early-clobber %2:vreg_256 = V_WMMA_F32_16X16X16_F16_threeaddr_w32 8, killed %1, 8, killed %1, 8, %0, 0, 0, implicit $exec
5+
# GCN: early-clobber %2:vreg_256 = V_WMMA_F32_16X16X16_F16_threeaddr_w32 8, killed %1, 8, killed %1, 8, %0, 0, 0, implicit $exec{{$}}
66

77
---
88
name: test_v_wmma_f32_16x16x16_f16_twoaddr_w32
@@ -20,7 +20,7 @@ body: |
2020
...
2121

2222
# GCN-LABEL: name: test_v_wmma_f32_16x16x16_bf16_twoaddr_w32
23-
# GCN: early-clobber %2:vreg_256 = V_WMMA_F32_16X16X16_BF16_threeaddr_w32 8, killed %1, 8, killed %1, 8, %0, 0, 0, implicit $exec
23+
# GCN: early-clobber %2:vreg_256 = V_WMMA_F32_16X16X16_BF16_threeaddr_w32 8, killed %1, 8, killed %1, 8, %0, 0, 0, implicit $exec{{$}}
2424

2525
---
2626
name: test_v_wmma_f32_16x16x16_bf16_twoaddr_w32
@@ -38,7 +38,7 @@ body: |
3838
...
3939

4040
# GCN-LABEL: name: test_v_wmma_f16_16x16x16_f16_twoaddr_w32
41-
# GCN: early-clobber %2:vreg_256 = V_WMMA_F16_16X16X16_F16_threeaddr_w32 8, killed %1, 8, killed %1, 8, %0, 0, 0, 0, 0, implicit $exec
41+
# GCN: early-clobber %2:vreg_256 = V_WMMA_F16_16X16X16_F16_threeaddr_w32 8, killed %1, 8, killed %1, 8, %0, 0, 0, 0, 0, implicit $exec{{$}}
4242

4343
---
4444
name: test_v_wmma_f16_16x16x16_f16_twoaddr_w32
@@ -56,7 +56,7 @@ body: |
5656
...
5757

5858
# GCN-LABEL: name: test_v_wmma_bf16_16x16x16_bf16_twoaddr_w32
59-
# GCN: early-clobber %2:vreg_256 = V_WMMA_BF16_16X16X16_BF16_threeaddr_w32 8, killed %1, 8, killed %1, 8, %0, 0, 0, 0, 0, implicit $exec
59+
# GCN: early-clobber %2:vreg_256 = V_WMMA_BF16_16X16X16_BF16_threeaddr_w32 8, killed %1, 8, killed %1, 8, %0, 0, 0, 0, 0, implicit $exec{{$}}
6060

6161
---
6262
name: test_v_wmma_bf16_16x16x16_bf16_twoaddr_w32
@@ -74,7 +74,7 @@ body: |
7474
...
7575

7676
# GCN-LABEL: name: test_v_wmma_i32_16x16x16_iu8_twoaddr_w32
77-
# GCN: early-clobber %2:vreg_256 = V_WMMA_I32_16X16X16_IU8_threeaddr_w32 8, killed %1, 8, killed %1, 8, %0, 0, 0, 0, implicit $exec
77+
# GCN: early-clobber %2:vreg_256 = V_WMMA_I32_16X16X16_IU8_threeaddr_w32 8, killed %1, 8, killed %1, 8, %0, 0, 0, 0, implicit $exec{{$}}
7878

7979
---
8080
name: test_v_wmma_i32_16x16x16_iu8_twoaddr_w32
@@ -92,7 +92,7 @@ body: |
9292
...
9393

9494
# GCN-LABEL: name: test_v_wmma_i32_16x16x16_iu4_twoaddr_w32
95-
# GCN: early-clobber %2:vreg_256 = V_WMMA_I32_16X16X16_IU4_threeaddr_w32 8, killed %1, 8, killed %1, 8, %0, 0, 0, 0, implicit $exec
95+
# GCN: early-clobber %2:vreg_256 = V_WMMA_I32_16X16X16_IU4_threeaddr_w32 8, killed %1, 8, killed %1, 8, %0, 0, 0, 0, implicit $exec{{$}}
9696

9797
---
9898
name: test_v_wmma_i32_16x16x16_iu4_twoaddr_w32
@@ -110,7 +110,7 @@ body: |
110110
...
111111

112112
# GCN-LABEL: name: test_v_wmma_f32_16x16x16_f16_twoaddr_w64
113-
# GCN: early-clobber %2:vreg_128 = V_WMMA_F32_16X16X16_F16_threeaddr_w64 8, killed %1, 8, killed %1, 8, %0, 0, 0, implicit $exec
113+
# GCN: early-clobber %2:vreg_128 = V_WMMA_F32_16X16X16_F16_threeaddr_w64 8, killed %1, 8, killed %1, 8, %0, 0, 0, implicit $exec{{$}}
114114

115115
---
116116
name: test_v_wmma_f32_16x16x16_f16_twoaddr_w64
@@ -128,7 +128,7 @@ body: |
128128
...
129129

130130
# GCN-LABEL: name: test_v_wmma_f32_16x16x16_bf16_twoaddr_w64
131-
# GCN: early-clobber %2:vreg_128 = V_WMMA_F32_16X16X16_BF16_threeaddr_w64 8, killed %1, 8, killed %1, 8, %0, 0, 0, implicit $exec
131+
# GCN: early-clobber %2:vreg_128 = V_WMMA_F32_16X16X16_BF16_threeaddr_w64 8, killed %1, 8, killed %1, 8, %0, 0, 0, implicit $exec{{$}}
132132

133133
---
134134
name: test_v_wmma_f32_16x16x16_bf16_twoaddr_w64
@@ -146,7 +146,7 @@ body: |
146146
...
147147

148148
# GCN-LABEL: name: test_v_wmma_f16_16x16x16_f16_twoaddr_w64
149-
# GCN: early-clobber %2:vreg_128 = V_WMMA_F16_16X16X16_F16_threeaddr_w64 8, killed %1, 8, killed %1, 8, %0, 0, 0, 0, 0, implicit $exec
149+
# GCN: early-clobber %2:vreg_128 = V_WMMA_F16_16X16X16_F16_threeaddr_w64 8, killed %1, 8, killed %1, 8, %0, 0, 0, 0, 0, implicit $exec{{$}}
150150

151151
---
152152
name: test_v_wmma_f16_16x16x16_f16_twoaddr_w64
@@ -164,7 +164,7 @@ body: |
164164
...
165165

166166
# GCN-LABEL: name: test_v_wmma_bf16_16x16x16_bf16_twoaddr_w64
167-
# GCN: early-clobber %2:vreg_128 = V_WMMA_BF16_16X16X16_BF16_threeaddr_w64 8, killed %1, 8, killed %1, 8, %0, 0, 0, 0, 0, implicit $exec
167+
# GCN: early-clobber %2:vreg_128 = V_WMMA_BF16_16X16X16_BF16_threeaddr_w64 8, killed %1, 8, killed %1, 8, %0, 0, 0, 0, 0, implicit $exec{{$}}
168168

169169
---
170170
name: test_v_wmma_bf16_16x16x16_bf16_twoaddr_w64
@@ -182,7 +182,7 @@ body: |
182182
...
183183

184184
# GCN-LABEL: name: test_v_wmma_i32_16x16x16_iu8_twoaddr_w64
185-
# GCN: early-clobber %2:vreg_128 = V_WMMA_I32_16X16X16_IU8_threeaddr_w64 8, killed %1, 8, killed %1, 8, %0, 0, 0, 0, implicit $exec
185+
# GCN: early-clobber %2:vreg_128 = V_WMMA_I32_16X16X16_IU8_threeaddr_w64 8, killed %1, 8, killed %1, 8, %0, 0, 0, 0, implicit $exec{{$}}
186186

187187
---
188188
name: test_v_wmma_i32_16x16x16_iu8_twoaddr_w64
@@ -200,7 +200,7 @@ body: |
200200
...
201201

202202
# GCN-LABEL: name: test_v_wmma_i32_16x16x16_iu4_twoaddr_w64
203-
# GCN: early-clobber %2:vreg_128 = V_WMMA_I32_16X16X16_IU4_threeaddr_w64 8, killed %1, 8, killed %1, 8, %0, 0, 0, 0, implicit $exec
203+
# GCN: early-clobber %2:vreg_128 = V_WMMA_I32_16X16X16_IU4_threeaddr_w64 8, killed %1, 8, killed %1, 8, %0, 0, 0, 0, implicit $exec{{$}}
204204

205205
---
206206
name: test_v_wmma_i32_16x16x16_iu4_twoaddr_w64

0 commit comments

Comments
 (0)