aboutsummaryrefslogtreecommitdiff
path: root/lib/Transforms/IPO
diff options
context:
space:
mode:
authorJay Foad <jay.foad@gmail.com>2009-06-06 17:49:35 +0000
committerJay Foad <jay.foad@gmail.com>2009-06-06 17:49:35 +0000
commit0906b1bf09769d5301e62d372b363b4cd0b5a6c7 (patch)
treeb37b3d75d6b4743281197a07027cf19886b6036a /lib/Transforms/IPO
parent86fbf2fe4cae21febffa4bb2f64cd0c2ee834694 (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/IPO')
-rw-r--r--lib/Transforms/IPO/GlobalOpt.cpp3
-rw-r--r--lib/Transforms/IPO/IPConstantPropagation.cpp6
2 files changed, 2 insertions, 7 deletions
diff --git a/lib/Transforms/IPO/GlobalOpt.cpp b/lib/Transforms/IPO/GlobalOpt.cpp
index 2c01cc30bd..5f12825f04 100644
--- a/lib/Transforms/IPO/GlobalOpt.cpp
+++ b/lib/Transforms/IPO/GlobalOpt.cpp
@@ -932,8 +932,7 @@ static bool ValueIsOnlyUsedLocallyOrStoredToOneGlobal(Instruction *V,
GlobalVariable *GV,
SmallPtrSet<PHINode*, 8> &PHIs) {
for (Value::use_iterator UI = V->use_begin(), E = V->use_end(); UI != E;++UI){
- Instruction *Inst = dyn_cast<Instruction>(*UI);
- if (Inst == 0) return false;
+ Instruction *Inst = cast<Instruction>(*UI);
if (isa<LoadInst>(Inst) || isa<CmpInst>(Inst)) {
continue; // Fine, ignore.
diff --git a/lib/Transforms/IPO/IPConstantPropagation.cpp b/lib/Transforms/IPO/IPConstantPropagation.cpp
index 2dc8558246..e4a9deadd9 100644
--- a/lib/Transforms/IPO/IPConstantPropagation.cpp
+++ b/lib/Transforms/IPO/IPConstantPropagation.cpp
@@ -241,15 +241,11 @@ bool IPCP::PropagateConstantReturn(Function &F) {
for (Value::use_iterator I = Call->use_begin(), E = Call->use_end();
I != E;) {
- Instruction *Ins = dyn_cast<Instruction>(*I);
+ Instruction *Ins = cast<Instruction>(*I);
// Increment now, so we can remove the use
++I;
- // Not an instruction? Ignore
- if (!Ins)
- continue;
-
// Find the index of the retval to replace with
int index = -1;
if (ExtractValueInst *EV = dyn_cast<ExtractValueInst>(Ins))