[llvm] 7ce613f - [AMDGPU] Cleanup hasUnwantedEffectsWhenEXECEmpty function (#70206)

via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 25 09:40:20 PDT 2023


Author: Christudasan Devadasan
Date: 2023-10-25T22:10:16+05:30
New Revision: 7ce613fc77af092dd6e9db71ce3747b75bc5616e

URL: https://github.com/llvm/llvm-project/commit/7ce613fc77af092dd6e9db71ce3747b75bc5616e
DIFF: https://github.com/llvm/llvm-project/commit/7ce613fc77af092dd6e9db71ce3747b75bc5616e.diff

LOG: [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.

Added: 
    

Modified: 
    llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
    llvm/test/CodeGen/AMDGPU/remove-short-exec-branches-special-instructions.mir

Removed: 
    


################################################################################
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