Skip to content

Commit 7ce613f

Browse files
authored
[AMDGPU] Cleanup hasUnwantedEffectsWhenEXECEmpty function (#70206)
The readlane & writelane instructions don't really depend on the the EXEC mask and they should return false from here.
1 parent 9d712d2 commit 7ce613f

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

llvm/lib/Target/AMDGPU/SIInstrInfo.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3906,8 +3906,7 @@ bool SIInstrInfo::hasUnwantedEffectsWhenEXECEmpty(const MachineInstr &MI) const
39063906
//
39073907
// However, executing them with EXEC = 0 causes them to operate on undefined
39083908
// data, which we avoid by returning true here.
3909-
if (Opcode == AMDGPU::V_READFIRSTLANE_B32 ||
3910-
Opcode == AMDGPU::V_READLANE_B32 || Opcode == AMDGPU::V_WRITELANE_B32)
3909+
if (Opcode == AMDGPU::V_READFIRSTLANE_B32)
39113910
return true;
39123911

39133912
return false;

llvm/test/CodeGen/AMDGPU/remove-short-exec-branches-special-instructions.mir

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -130,13 +130,12 @@ body: |
130130

131131
---
132132

133-
name: need_skip_writelane_b32
133+
name: dont_skip_writelane_b32
134134
body: |
135-
; CHECK-LABEL: name: need_skip_writelane_b32
135+
; CHECK-LABEL: name: dont_skip_writelane_b32
136136
; CHECK: bb.0:
137-
; CHECK-NEXT: successors: %bb.1(0x40000000), %bb.2(0x40000000)
137+
; CHECK-NEXT: successors: %bb.1(0x40000000)
138138
; CHECK-NEXT: {{ $}}
139-
; CHECK-NEXT: S_CBRANCH_EXECZ %bb.2, implicit $exec
140139
; CHECK-NEXT: {{ $}}
141140
; CHECK-NEXT: bb.1:
142141
; CHECK-NEXT: successors: %bb.2(0x80000000)
@@ -160,13 +159,12 @@ body: |
160159
...
161160

162161
---
163-
name: need_skip_readlane_b32
162+
name: dont_skip_readlane_b32
164163
body: |
165-
; CHECK-LABEL: name: need_skip_readlane_b32
164+
; CHECK-LABEL: name: dont_skip_readlane_b32
166165
; CHECK: bb.0:
167-
; CHECK-NEXT: successors: %bb.1(0x40000000), %bb.2(0x40000000)
166+
; CHECK-NEXT: successors: %bb.1(0x40000000)
168167
; CHECK-NEXT: {{ $}}
169-
; CHECK-NEXT: S_CBRANCH_EXECZ %bb.2, implicit $exec
170168
; CHECK-NEXT: {{ $}}
171169
; CHECK-NEXT: bb.1:
172170
; CHECK-NEXT: successors: %bb.2(0x80000000)

0 commit comments

Comments
 (0)