[llvm] r229061 - [unroll] Remove pointless dyn_cast<>s to Instruction - the users of an

Chandler Carruth chandlerc at gmail.com
Thu Feb 12 20:33:21 PST 2015


Author: chandlerc
Date: Thu Feb 12 22:33:21 2015
New Revision: 229061

URL: http://llvm.org/viewvc/llvm-project?rev=229061&view=rev
Log:
[unroll] Remove pointless dyn_cast<>s to Instruction - the users of an
instruction must by definition be instructions.

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=229061&r1=229060&r2=229061&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/LoopUnrollPass.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LoopUnrollPass.cpp Thu Feb 12 22:33:21 2015
@@ -468,12 +468,8 @@ public:
       if (CountedInstructions.insert(LI).second)
         NumberOfOptimizedInstructions += TTI.getUserCost(LI);
 
-      for (User *U : LI->users()) {
-        Instruction *UI = dyn_cast<Instruction>(U);
-        if (!UI)
-          continue;
-        Worklist.insert(UI);
-      }
+      for (User *U : LI->users())
+        Worklist.insert(cast<Instruction>(U));
     }
 
     // And then we try to simplify every user of every instruction from the
@@ -485,12 +481,8 @@ public:
         continue;
       if (!visit(I))
         continue;
-      for (User *U : I->users()) {
-        Instruction *UI = dyn_cast<Instruction>(U);
-        if (!UI)
-          continue;
-        Worklist.insert(UI);
-      }
+      for (User *U : I->users())
+        Worklist.insert(cast<Instruction>(U));
     }
     return NumberOfOptimizedInstructions;
   }





More information about the llvm-commits mailing list