[llvm] r362761 - AMDGPU: Don't count mask branch pseudo towards skip threshold
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 6 17:14:55 PDT 2019
Author: arsenm
Date: Thu Jun 6 17:14:55 2019
New Revision: 362761
URL: http://llvm.org/viewvc/llvm-project?rev=362761&view=rev
Log:
AMDGPU: Don't count mask branch pseudo towards skip threshold
Added:
llvm/trunk/test/CodeGen/AMDGPU/insert-skips-ignored-insts.mir
Modified:
llvm/trunk/lib/Target/AMDGPU/SIInsertSkips.cpp
Modified: llvm/trunk/lib/Target/AMDGPU/SIInsertSkips.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AMDGPU/SIInsertSkips.cpp?rev=362761&r1=362760&r2=362761&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AMDGPU/SIInsertSkips.cpp (original)
+++ llvm/trunk/lib/Target/AMDGPU/SIInsertSkips.cpp Thu Jun 6 17:14:55 2019
@@ -92,15 +92,13 @@ INITIALIZE_PASS(SIInsertSkips, DEBUG_TYP
char &llvm::SIInsertSkipsPassID = SIInsertSkips::ID;
-static bool opcodeEmitsNoInsts(unsigned Opc) {
- switch (Opc) {
- case TargetOpcode::IMPLICIT_DEF:
- case TargetOpcode::KILL:
- case TargetOpcode::BUNDLE:
- case TargetOpcode::CFI_INSTRUCTION:
- case TargetOpcode::EH_LABEL:
- case TargetOpcode::GC_LABEL:
- case TargetOpcode::DBG_VALUE:
+static bool opcodeEmitsNoInsts(const MachineInstr &MI) {
+ if (MI.isMetaInstruction())
+ return true;
+
+ // Handle target specific opcodes.
+ switch (MI.getOpcode()) {
+ case AMDGPU::SI_MASK_BRANCH:
return true;
default:
return false;
@@ -118,7 +116,7 @@ bool SIInsertSkips::shouldSkip(const Mac
for (MachineBasicBlock::const_iterator I = MBB.begin(), E = MBB.end();
NumInstr < SkipThreshold && I != E; ++I) {
- if (opcodeEmitsNoInsts(I->getOpcode()))
+ if (opcodeEmitsNoInsts(*I))
continue;
// FIXME: Since this is required for correctness, this should be inserted
Added: llvm/trunk/test/CodeGen/AMDGPU/insert-skips-ignored-insts.mir
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/AMDGPU/insert-skips-ignored-insts.mir?rev=362761&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/AMDGPU/insert-skips-ignored-insts.mir (added)
+++ llvm/trunk/test/CodeGen/AMDGPU/insert-skips-ignored-insts.mir Thu Jun 6 17:14:55 2019
@@ -0,0 +1,54 @@
+# RUN: llc -mtriple=amdgcn-amd-amdhsa -run-pass si-insert-skips -amdgpu-skip-threshold=2 %s -o - | FileCheck %s
+
+---
+
+# CHECK-LABEL: name: no_count_mask_branch_pseudo
+# CHECK: $vgpr1 = V_MOV_B32_e32 7, implicit $exec
+# CHECK-NEXT: SI_MASK_BRANCH
+# CHECK-NOT: S_CBRANCH_EXECZ
+name: no_count_mask_branch_pseudo
+body: |
+ bb.0:
+ successors: %bb.1
+
+ $vgpr1 = V_MOV_B32_e32 7, implicit $exec
+ SI_MASK_BRANCH %bb.2, implicit $exec
+
+ bb.1:
+ successors: %bb.2
+ $vgpr0 = V_MOV_B32_e32 0, implicit $exec
+ SI_MASK_BRANCH %bb.3, implicit $exec
+
+ bb.2:
+ $vgpr0 = V_MOV_B32_e32 1, implicit $exec
+
+ bb.3:
+ S_ENDPGM 0
+...
+
+---
+
+# CHECK-LABEL: name: no_count_dbg_value
+# CHECK: $vgpr1 = V_MOV_B32_e32 7, implicit $exec
+# CHECK-NEXT: SI_MASK_BRANCH
+# CHECK-NOT: S_CBRANCH_EXECZ
+name: no_count_dbg_value
+body: |
+ bb.0:
+ successors: %bb.1
+
+ $vgpr1 = V_MOV_B32_e32 7, implicit $exec
+ SI_MASK_BRANCH %bb.2, implicit $exec
+
+ bb.1:
+ successors: %bb.2
+ $vgpr0 = V_MOV_B32_e32 0, implicit $exec
+ DBG_VALUE
+
+ bb.2:
+ $vgpr0 = V_MOV_B32_e32 1, implicit $exec
+
+ bb.3:
+ S_ENDPGM 0
+...
+
More information about the llvm-commits
mailing list