diff options
| author | Owen Anderson <resistor@mac.com> | 2009-07-31 20:28:14 +0000 |
|---|---|---|
| committer | Owen Anderson <resistor@mac.com> | 2009-07-31 20:28:14 +0000 |
| commit | 5a1acd99126d8b867aef4a785aae635fb98b6c08 (patch) | |
| tree | 4a7049e4b83ac61c1b374bbb168e359ff4d5268a /llvm/lib/Transforms/Scalar/Reassociate.cpp | |
| parent | ef3ef7f645cd4f070e426ed781f0104bcffb45d7 (diff) | |
| download | bcm5719-llvm-5a1acd99126d8b867aef4a785aae635fb98b6c08.tar.gz bcm5719-llvm-5a1acd99126d8b867aef4a785aae635fb98b6c08.zip | |
Move a few more APIs back to 2.5 forms. The only remaining ones left to change back are
metadata related, which I'm waiting on to avoid conflicting with Devang.
llvm-svn: 77721
Diffstat (limited to 'llvm/lib/Transforms/Scalar/Reassociate.cpp')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/Reassociate.cpp | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/llvm/lib/Transforms/Scalar/Reassociate.cpp b/llvm/lib/Transforms/Scalar/Reassociate.cpp index cade3e6c04e..e8bc859517e 100644 --- a/llvm/lib/Transforms/Scalar/Reassociate.cpp +++ b/llvm/lib/Transforms/Scalar/Reassociate.cpp @@ -201,7 +201,7 @@ static BinaryOperator *isReassociableOp(Value *V, unsigned Opcode) { static Instruction *LowerNegateToMultiply(Instruction *Neg, std::map<AssertingVH<>, unsigned> &ValueRankMap, LLVMContext &Context) { - Constant *Cst = Neg->getContext().getAllOnesValue(Neg->getType()); + Constant *Cst = Constant::getAllOnesValue(Neg->getType()); Instruction *Res = BinaryOperator::CreateMul(Neg->getOperand(1), Cst, "",Neg); ValueRankMap.erase(Neg); @@ -563,8 +563,6 @@ Value *Reassociate::OptimizeExpression(BinaryOperator *I, bool IterateOptimization = false; if (Ops.size() == 1) return Ops[0].Op; - LLVMContext &Context = I->getContext(); - unsigned Opcode = I->getOpcode(); if (Constant *V1 = dyn_cast<Constant>(Ops[Ops.size()-2].Op)) @@ -626,10 +624,10 @@ Value *Reassociate::OptimizeExpression(BinaryOperator *I, if (FoundX != i) { if (Opcode == Instruction::And) { // ...&X&~X = 0 ++NumAnnihil; - return Context.getNullValue(X->getType()); + return Constant::getNullValue(X->getType()); } else if (Opcode == Instruction::Or) { // ...|X|~X = -1 ++NumAnnihil; - return Context.getAllOnesValue(X->getType()); + return Constant::getAllOnesValue(X->getType()); } } } @@ -648,7 +646,7 @@ Value *Reassociate::OptimizeExpression(BinaryOperator *I, assert(Opcode == Instruction::Xor); if (e == 2) { ++NumAnnihil; - return Context.getNullValue(Ops[0].Op->getType()); + return Constant::getNullValue(Ops[0].Op->getType()); } // ... X^X -> ... Ops.erase(Ops.begin()+i, Ops.begin()+i+2); @@ -673,7 +671,7 @@ Value *Reassociate::OptimizeExpression(BinaryOperator *I, // Remove X and -X from the operand list. if (Ops.size() == 2) { ++NumAnnihil; - return Context.getNullValue(X->getType()); + return Constant::getNullValue(X->getType()); } else { Ops.erase(Ops.begin()+i); if (i < FoundX) |

