[llvm] r229060 - [unroll] Don't check the loop set for whether an instruction is

Chandler Carruth chandlerc at gmail.com
Thu Feb 12 20:30:45 PST 2015


Author: chandlerc
Date: Thu Feb 12 22:30:44 2015
New Revision: 229060

URL: http://llvm.org/viewvc/llvm-project?rev=229060&view=rev
Log:
[unroll] Don't check the loop set for whether an instruction is
contained in it each time we try to add it to the worklist, just check
this when pulling it off the worklist. That way we do it at most once
per instruction with the cost of the worklist set we would need to pay
anyways.

Modified:
    llvm/trunk/lib/Transforms/Scalar/LoopUnrollPass.cpp

Modified: llvm/trunk/lib/Transforms/Scalar/LoopUnrollPass.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopUnrollPass.cpp?rev=229060&r1=229059&r2=229060&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/LoopUnrollPass.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LoopUnrollPass.cpp Thu Feb 12 22:30:44 2015
@@ -472,8 +472,6 @@ public:
         Instruction *UI = dyn_cast<Instruction>(U);
         if (!UI)
           continue;
-        if (!L->contains(UI))
-          continue;
         Worklist.insert(UI);
       }
     }
@@ -483,14 +481,14 @@ public:
     // its users as well.
     while (!Worklist.empty()) {
       Instruction *I = Worklist.pop_back_val();
+      if (!L->contains(I))
+        continue;
       if (!visit(I))
         continue;
       for (User *U : I->users()) {
         Instruction *UI = dyn_cast<Instruction>(U);
         if (!UI)
           continue;
-        if (!L->contains(UI))
-          continue;
         Worklist.insert(UI);
       }
     }





More information about the llvm-commits mailing list