[unroll] Remove pointless dyn_cast<>s to Instruction - the users of an
authorChandler Carruth <chandlerc@gmail.com>
Fri, 13 Feb 2015 04:33:21 +0000 (04:33 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Fri, 13 Feb 2015 04:33:21 +0000 (04:33 +0000)
instruction must by definition be instructions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229061 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/LoopUnrollPass.cpp

index 8cf0450dd9ed1b88829abb547e64a7ec5a8d2b18..0d9e2d156524b09c66718888b9050fcad7ea2b8f 100644 (file)
@@ -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;
   }