[llvm] r300452 - [LCSSA] Don't insert tokens into the worklist at all.

Davide Italiano via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 17 07:32:05 PDT 2017


Author: davide
Date: Mon Apr 17 09:32:05 2017
New Revision: 300452

URL: http://llvm.org/viewvc/llvm-project?rev=300452&view=rev
Log:
[LCSSA] Don't insert tokens into the worklist at all.

We're gonna skip them anyway, so there's no point in inserting them
in the first place.

Modified:
    llvm/trunk/lib/Transforms/Utils/LCSSA.cpp

Modified: llvm/trunk/lib/Transforms/Utils/LCSSA.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/LCSSA.cpp?rev=300452&r1=300451&r2=300452&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/LCSSA.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/LCSSA.cpp Mon Apr 17 09:32:05 2017
@@ -85,6 +85,7 @@ bool llvm::formLCSSAForInstructions(Smal
     UsesToRewrite.clear();
 
     Instruction *I = Worklist.pop_back_val();
+    assert(!I->getType()->isTokenTy() && "Tokens shouldn't be in the worklist");
     BasicBlock *InstBB = I->getParent();
     Loop *L = LI.getLoopFor(InstBB);
     assert(L && "Instruction belongs to a BB that's not part of a loop");
@@ -96,13 +97,6 @@ bool llvm::formLCSSAForInstructions(Smal
     if (ExitBlocks.empty())
       continue;
 
-    // Tokens cannot be used in PHI nodes, so we skip over them.
-    // We can run into tokens which are live out of a loop with catchswitch
-    // instructions in Windows EH if the catchswitch has one catchpad which
-    // is inside the loop and another which is not.
-    if (I->getType()->isTokenTy())
-      continue;
-
     for (Use &U : I->uses()) {
       Instruction *User = cast<Instruction>(U.getUser());
       BasicBlock *UserBB = User->getParent();
@@ -311,6 +305,13 @@ bool llvm::formLCSSA(Loop &L, DominatorT
            !isa<PHINode>(I.user_back())))
         continue;
 
+      // Tokens cannot be used in PHI nodes, so we skip over them.
+      // We can run into tokens which are live out of a loop with catchswitch
+      // instructions in Windows EH if the catchswitch has one catchpad which
+      // is inside the loop and another which is not.
+      if (I.getType()->isTokenTy())
+        continue;
+
       Worklist.push_back(&I);
     }
   }




More information about the llvm-commits mailing list