aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Transforms/Scalar
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2001-10-01 16:18:37 +0000
committerChris Lattner <sabre@nondot.org>2001-10-01 16:18:37 +0000
commit9636a91649f168f41b477cba705287665e054f79 (patch)
tree5922b723abd6338e86c5c09ecb880f129cd85401 /lib/Transforms/Scalar
parent7295eb4ea3e3a81e697600cbca681674e4b35a20 (diff)
downloadexternal_llvm-9636a91649f168f41b477cba705287665e054f79.tar.gz
external_llvm-9636a91649f168f41b477cba705287665e054f79.tar.bz2
external_llvm-9636a91649f168f41b477cba705287665e054f79.zip
Add support for new style casts
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@694 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar')
-rw-r--r--lib/Transforms/Scalar/ADCE.cpp2
-rw-r--r--lib/Transforms/Scalar/ConstantProp.cpp4
-rw-r--r--lib/Transforms/Scalar/InductionVars.cpp2
-rw-r--r--lib/Transforms/Scalar/SCCP.cpp4
4 files changed, 6 insertions, 6 deletions
diff --git a/lib/Transforms/Scalar/ADCE.cpp b/lib/Transforms/Scalar/ADCE.cpp
index 480a2696b5..ea36745c68 100644
--- a/lib/Transforms/Scalar/ADCE.cpp
+++ b/lib/Transforms/Scalar/ADCE.cpp
@@ -152,7 +152,7 @@ bool ADCE::doADCE() {
// they are known to be alive as well...
//
for (unsigned op = 0, End = I->getNumOperands(); op != End; ++op) {
- if (Instruction *Operand = I->getOperand(op)->castInstruction())
+ if (Instruction *Operand = dyn_cast<Instruction>(I->getOperand(op)))
markInstructionLive(Operand);
}
}
diff --git a/lib/Transforms/Scalar/ConstantProp.cpp b/lib/Transforms/Scalar/ConstantProp.cpp
index fdf58cb56d..8b87916242 100644
--- a/lib/Transforms/Scalar/ConstantProp.cpp
+++ b/lib/Transforms/Scalar/ConstantProp.cpp
@@ -85,8 +85,8 @@ bool opt::ConstantFoldTerminator(TerminatorInst *T) {
if (T->getOpcode() == Instruction::Br) {
BranchInst *BI = (BranchInst*)T;
if (BI->isUnconditional()) return false; // Can't optimize uncond branch
- BasicBlock *Dest1 = BI->getOperand(0)->castBasicBlockAsserting();
- BasicBlock *Dest2 = BI->getOperand(1)->castBasicBlockAsserting();
+ BasicBlock *Dest1 = cast<BasicBlock>(BI->getOperand(0));
+ BasicBlock *Dest2 = cast<BasicBlock>(BI->getOperand(1));
if (BI->getCondition()->isConstant()) { // Are we branching on constant?
// YES. Change to unconditional branch...
diff --git a/lib/Transforms/Scalar/InductionVars.cpp b/lib/Transforms/Scalar/InductionVars.cpp
index 69521d6c8b..6815ccb9a4 100644
--- a/lib/Transforms/Scalar/InductionVars.cpp
+++ b/lib/Transforms/Scalar/InductionVars.cpp
@@ -76,7 +76,7 @@ static LIVType isLinearInductionVariableH(cfg::Interval *Int, Value *V,
if (isLoopInvariant(Int, V)) return isLIC;
// loop variant computations must be instructions!
- Instruction *I = V->castInstructionAsserting();
+ Instruction *I = cast<Instruction>(V);
switch (I->getOpcode()) { // Handle each instruction seperately
case Instruction::Add:
case Instruction::Sub: {
diff --git a/lib/Transforms/Scalar/SCCP.cpp b/lib/Transforms/Scalar/SCCP.cpp
index 268b654d14..78b6c3df7b 100644
--- a/lib/Transforms/Scalar/SCCP.cpp
+++ b/lib/Transforms/Scalar/SCCP.cpp
@@ -127,7 +127,7 @@ private:
//
inline bool markOverdefined(Value *V) {
if (ValueState[V].markOverdefined()) {
- if (Instruction *I = V->castInstruction()) {
+ if (Instruction *I = dyn_cast<Instruction>(V)) {
//cerr << "markOverdefined: " << V;
InstWorkList.push_back(I); // Only instructions go on the work list
}
@@ -497,7 +497,7 @@ void SCCP::UpdateInstruction(Instruction *I) {
//
void SCCP::OperandChangedState(User *U) {
// Only instructions use other variable values!
- Instruction *I = U->castInstructionAsserting();
+ Instruction *I = cast<Instruction>(U);
if (!BBExecutable.count(I->getParent())) return; // Inst not executable yet!
UpdateInstruction(I);