[PATCH] D36585: [AMDGPU] Eliminate no effect instructions before s_endpgm

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 14 11:32:05 PDT 2017


arsenm added a comment.

Needs MIR test



================
Comment at: lib/Target/AMDGPU/SIOptimizeExecMaskingPreRA.cpp:114
   LiveIntervals *LIS = &getAnalysis<LiveIntervals>();
+  DenseSet<unsigned> RecalcRegs({AMDGPU::EXEC_LO, AMDGPU::EXEC_HI});
   bool Changed = false;
----------------
SmallSet?


================
Comment at: lib/Target/AMDGPU/SIOptimizeExecMaskingPreRA.cpp:120
+    // Try to remove unneeded instructions before s_endpgm.
+    if (MBB.succ_size() == 0) {
+      if (MBB.empty() || MBB.back().getOpcode() != AMDGPU::S_ENDPGM)
----------------
succ_empty


================
Comment at: lib/Target/AMDGPU/SIOptimizeExecMaskingPreRA.cpp:141-143
+              (I->mayLoad() && (!I->hasOneMemOperand() ||
+                               (*I->memoperands_begin())->isVolatile() ||
+                               (*I->memoperands_begin())->isAtomic())))
----------------
hasOrderedMemoryRef


================
Comment at: lib/Target/AMDGPU/SIOptimizeExecMaskingPreRA.cpp:164
+        // Try to ascend predecessors.
+        for (auto *Pred : CurBB->predecessors())
+          if (Pred->succ_size() == 1)
----------------
Braces


================
Comment at: lib/Target/AMDGPU/SIOptimizeExecMaskingPreRA.cpp:166
+          if (Pred->succ_size() == 1)
+            Blocks.push_back(Pred);
+      }
----------------
It's seems overly aggressive to be trying to prune other blocks here. Should these types of instructions be sunk or blocks merged earlier?


https://reviews.llvm.org/D36585





More information about the llvm-commits mailing list