diff options
author | Chris Lattner <sabre@nondot.org> | 2001-10-01 20:11:19 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2001-10-01 20:11:19 +0000 |
commit | 38569343868ee3dad90dcdddfb9fee1ca0bcf25f (patch) | |
tree | 1b9bc0f2b6911aed0815f3a00945714c26a8a5ce /llvm/lib/Transforms/Scalar/ConstantProp.cpp | |
parent | 8f191129239552b876f2c6717fae9619a7701a03 (diff) | |
download | bcm5719-llvm-38569343868ee3dad90dcdddfb9fee1ca0bcf25f.tar.gz bcm5719-llvm-38569343868ee3dad90dcdddfb9fee1ca0bcf25f.zip |
Convert more code to use new style casts
Eliminate old style casts from value.h
llvm-svn: 696
Diffstat (limited to 'llvm/lib/Transforms/Scalar/ConstantProp.cpp')
-rw-r--r-- | llvm/lib/Transforms/Scalar/ConstantProp.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/llvm/lib/Transforms/Scalar/ConstantProp.cpp b/llvm/lib/Transforms/Scalar/ConstantProp.cpp index 8b879162426..d43f693dd17 100644 --- a/llvm/lib/Transforms/Scalar/ConstantProp.cpp +++ b/llvm/lib/Transforms/Scalar/ConstantProp.cpp @@ -88,9 +88,9 @@ bool opt::ConstantFoldTerminator(TerminatorInst *T) { BasicBlock *Dest1 = cast<BasicBlock>(BI->getOperand(0)); BasicBlock *Dest2 = cast<BasicBlock>(BI->getOperand(1)); - if (BI->getCondition()->isConstant()) { // Are we branching on constant? + if (ConstPoolBool *Cond = dyn_cast<ConstPoolBool>(BI->getCondition())) { + // Are we branching on constant? // YES. Change to unconditional branch... - ConstPoolBool *Cond = (ConstPoolBool*)BI->getCondition(); BasicBlock *Destination = Cond->getValue() ? Dest1 : Dest2; BasicBlock *OldDest = Cond->getValue() ? Dest2 : Dest1; @@ -137,14 +137,14 @@ inline static bool ConstantFoldInstruction(Method *M, Method::inst_iterator &II) { Instruction *Inst = *II; if (Inst->isBinaryOp()) { - ConstPoolVal *D1 = Inst->getOperand(0)->castConstant(); - ConstPoolVal *D2 = Inst->getOperand(1)->castConstant(); + ConstPoolVal *D1 = dyn_cast<ConstPoolVal>(Inst->getOperand(0)); + ConstPoolVal *D2 = dyn_cast<ConstPoolVal>(Inst->getOperand(1)); if (D1 && D2) return ConstantFoldBinaryInst(M, II, (BinaryOperator*)Inst, D1, D2); } else if (Inst->isUnaryOp()) { - ConstPoolVal *D = Inst->getOperand(0)->castConstant(); + ConstPoolVal *D = dyn_cast<ConstPoolVal>(Inst->getOperand(0)); if (D) return ConstantFoldUnaryInst(M, II, (UnaryOperator*)Inst, D); } else if (Inst->isTerminator()) { return opt::ConstantFoldTerminator((TerminatorInst*)Inst); |