[llvm] [AMDGPU] Cleanup hasUnwantedEffectsWhenEXECEmpty function (PR #70206)
Christudasan Devadasan via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 25 05:52:36 PDT 2023
https://github.com/cdevadas created https://github.com/llvm/llvm-project/pull/70206
The readlane & writelane instructions don't really depend on the the EXEC mask and they should return false from here.
>From 45b44c65538640799adc2247b4d103ba603fbb5a Mon Sep 17 00:00:00 2001
From: Christudasan Devadasan <Christudasan.Devadasan at amd.com>
Date: Wed, 25 Oct 2023 18:14:44 +0530
Subject: [PATCH] [AMDGPU] Cleanup hasUnwantedEffectsWhenEXECEmpty function
The readlane & writelane instructions don't really depend on the
the EXEC mask and they should return false from here.
---
llvm/lib/Target/AMDGPU/SIInstrInfo.cpp | 3 +--
...ve-short-exec-branches-special-instructions.mir | 14 ++++++--------
2 files changed, 7 insertions(+), 10 deletions(-)
diff --git a/llvm/lib/Target/AMDGPU/SIInstrInfo.cpp b/llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
index 4ff7b462f0f3295..827c2c156638468 100644
--- a/llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
+++ b/llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
@@ -3906,8 +3906,7 @@ bool SIInstrInfo::hasUnwantedEffectsWhenEXECEmpty(const MachineInstr &MI) const
//
// However, executing them with EXEC = 0 causes them to operate on undefined
// data, which we avoid by returning true here.
- if (Opcode == AMDGPU::V_READFIRSTLANE_B32 ||
- Opcode == AMDGPU::V_READLANE_B32 || Opcode == AMDGPU::V_WRITELANE_B32)
+ if (Opcode == AMDGPU::V_READFIRSTLANE_B32)
return true;
return false;
diff --git a/llvm/test/CodeGen/AMDGPU/remove-short-exec-branches-special-instructions.mir b/llvm/test/CodeGen/AMDGPU/remove-short-exec-branches-special-instructions.mir
index fe4aa6a9aea68cb..8f3f70ea6287ee9 100644
--- a/llvm/test/CodeGen/AMDGPU/remove-short-exec-branches-special-instructions.mir
+++ b/llvm/test/CodeGen/AMDGPU/remove-short-exec-branches-special-instructions.mir
@@ -130,13 +130,12 @@ body: |
---
-name: need_skip_writelane_b32
+name: dont_skip_writelane_b32
body: |
- ; CHECK-LABEL: name: need_skip_writelane_b32
+ ; CHECK-LABEL: name: dont_skip_writelane_b32
; CHECK: bb.0:
- ; CHECK-NEXT: successors: %bb.1(0x40000000), %bb.2(0x40000000)
+ ; CHECK-NEXT: successors: %bb.1(0x40000000)
; CHECK-NEXT: {{ $}}
- ; CHECK-NEXT: S_CBRANCH_EXECZ %bb.2, implicit $exec
; CHECK-NEXT: {{ $}}
; CHECK-NEXT: bb.1:
; CHECK-NEXT: successors: %bb.2(0x80000000)
@@ -160,13 +159,12 @@ body: |
...
---
-name: need_skip_readlane_b32
+name: dont_skip_readlane_b32
body: |
- ; CHECK-LABEL: name: need_skip_readlane_b32
+ ; CHECK-LABEL: name: dont_skip_readlane_b32
; CHECK: bb.0:
- ; CHECK-NEXT: successors: %bb.1(0x40000000), %bb.2(0x40000000)
+ ; CHECK-NEXT: successors: %bb.1(0x40000000)
; CHECK-NEXT: {{ $}}
- ; CHECK-NEXT: S_CBRANCH_EXECZ %bb.2, implicit $exec
; CHECK-NEXT: {{ $}}
; CHECK-NEXT: bb.1:
; CHECK-NEXT: successors: %bb.2(0x80000000)
More information about the llvm-commits
mailing list