diff options
author | Jay Foad <jay.foad@gmail.com> | 2009-06-06 17:49:35 +0000 |
---|---|---|
committer | Jay Foad <jay.foad@gmail.com> | 2009-06-06 17:49:35 +0000 |
commit | 0906b1bf09769d5301e62d372b363b4cd0b5a6c7 (patch) | |
tree | b37b3d75d6b4743281197a07027cf19886b6036a /lib/Transforms/Scalar/PredicateSimplifier.cpp | |
parent | 86fbf2fe4cae21febffa4bb2f64cd0c2ee834694 (diff) |
Use cast<> instead of dyn_cast<> for things that are known to be
Instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73002 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar/PredicateSimplifier.cpp')
-rw-r--r-- | lib/Transforms/Scalar/PredicateSimplifier.cpp | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/lib/Transforms/Scalar/PredicateSimplifier.cpp b/lib/Transforms/Scalar/PredicateSimplifier.cpp index a7e4d6eec4..b9b5688dfd 100644 --- a/lib/Transforms/Scalar/PredicateSimplifier.cpp +++ b/lib/Transforms/Scalar/PredicateSimplifier.cpp @@ -1525,12 +1525,12 @@ namespace { Instruction *I2 = dyn_cast<Instruction>(R); if (I2 && below(I2)) { std::vector<Instruction *> ToNotify; - for (Value::use_iterator UI = R->use_begin(), UE = R->use_end(); + for (Value::use_iterator UI = I2->use_begin(), UE = I2->use_end(); UI != UE;) { Use &TheUse = UI.getUse(); ++UI; - if (Instruction *I = dyn_cast<Instruction>(TheUse.getUser())) - ToNotify.push_back(I); + Instruction *I = cast<Instruction>(TheUse.getUser()); + ToNotify.push_back(I); } DOUT << "Simply removing " << *I2 @@ -1658,10 +1658,9 @@ namespace { ++UI; Value *V = TheUse.getUser(); if (!V->use_empty()) { - if (Instruction *Inst = dyn_cast<Instruction>(V)) { - if (aboveOrBelow(Inst)) - opsToDef(Inst); - } + Instruction *Inst = cast<Instruction>(V); + if (aboveOrBelow(Inst)) + opsToDef(Inst); } } } @@ -2262,10 +2261,9 @@ namespace { UE = O.LHS->use_end(); UI != UE;) { Use &TheUse = UI.getUse(); ++UI; - if (Instruction *I = dyn_cast<Instruction>(TheUse.getUser())) { - if (aboveOrBelow(I)) - opsToDef(I); - } + Instruction *I = cast<Instruction>(TheUse.getUser()); + if (aboveOrBelow(I)) + opsToDef(I); } } if (Instruction *I2 = dyn_cast<Instruction>(O.RHS)) { @@ -2277,10 +2275,9 @@ namespace { UE = O.RHS->use_end(); UI != UE;) { Use &TheUse = UI.getUse(); ++UI; - if (Instruction *I = dyn_cast<Instruction>(TheUse.getUser())) { - if (aboveOrBelow(I)) - opsToDef(I); - } + Instruction *I = cast<Instruction>(TheUse.getUser()); + if (aboveOrBelow(I)) + opsToDef(I); } } } |