[llvm] r344713 - [TI removal] Switch an analysis to just use Instruction.

Chandler Carruth via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 17 17:36:16 PDT 2018


Author: chandlerc
Date: Wed Oct 17 17:36:15 2018
New Revision: 344713

URL: http://llvm.org/viewvc/llvm-project?rev=344713&view=rev
Log:
[TI removal] Switch an analysis to just use Instruction.

Modified:
    llvm/trunk/lib/Analysis/LegacyDivergenceAnalysis.cpp

Modified: llvm/trunk/lib/Analysis/LegacyDivergenceAnalysis.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/LegacyDivergenceAnalysis.cpp?rev=344713&r1=344712&r2=344713&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/LegacyDivergenceAnalysis.cpp (original)
+++ llvm/trunk/lib/Analysis/LegacyDivergenceAnalysis.cpp Wed Oct 17 17:36:15 2018
@@ -93,7 +93,7 @@ private:
   // A helper function that explores data dependents of V.
   void exploreDataDependency(Value *V);
   // A helper function that explores sync dependents of TI.
-  void exploreSyncDependency(TerminatorInst *TI);
+  void exploreSyncDependency(Instruction *TI);
   // Computes the influence region from Start to End. This region includes all
   // basic blocks on any simple path from Start to End.
   void computeInfluenceRegion(BasicBlock *Start, BasicBlock *End,
@@ -128,7 +128,7 @@ void DivergencePropagator::populateWithS
   }
 }
 
-void DivergencePropagator::exploreSyncDependency(TerminatorInst *TI) {
+void DivergencePropagator::exploreSyncDependency(Instruction *TI) {
   // Propagation rule 1: if branch TI is divergent, all PHINodes in TI's
   // immediate post dominator are divergent. This rule handles if-then-else
   // patterns. For example,
@@ -252,11 +252,11 @@ void DivergencePropagator::propagate() {
   while (!Worklist.empty()) {
     Value *V = Worklist.back();
     Worklist.pop_back();
-    if (TerminatorInst *TI = dyn_cast<TerminatorInst>(V)) {
+    if (Instruction *I = dyn_cast<Instruction>(V)) {
       // Terminators with less than two successors won't introduce sync
       // dependency. Ignore them.
-      if (TI->getNumSuccessors() > 1)
-        exploreSyncDependency(TI);
+      if (I->isTerminator() && I->getNumSuccessors() > 1)
+        exploreSyncDependency(I);
     }
     exploreDataDependency(V);
   }




More information about the llvm-commits mailing list