diff options
author | Chris Lattner <sabre@nondot.org> | 2004-01-12 19:08:43 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2004-01-12 19:08:43 +0000 |
commit | 1b7d4d7b63d6f44fe798fcea3b69e5e0b841375a (patch) | |
tree | 2ea035d2267a78fa193f025bb4e48e27b2d7958e /llvm/lib/Transforms | |
parent | 5645e8a82d3b4e0174bf0894d66a5de9486d4095 (diff) | |
download | bcm5719-llvm-1b7d4d7b63d6f44fe798fcea3b69e5e0b841375a.tar.gz bcm5719-llvm-1b7d4d7b63d6f44fe798fcea3b69e5e0b841375a.zip |
Don't use ConstantExpr::getShift anymore
llvm-svn: 10791
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r-- | llvm/lib/Transforms/Scalar/SCCP.cpp | 29 |
1 files changed, 6 insertions, 23 deletions
diff --git a/llvm/lib/Transforms/Scalar/SCCP.cpp b/llvm/lib/Transforms/Scalar/SCCP.cpp index 7a28281a799..4e5e5156bb7 100644 --- a/llvm/lib/Transforms/Scalar/SCCP.cpp +++ b/llvm/lib/Transforms/Scalar/SCCP.cpp @@ -596,19 +596,11 @@ void SCCP::visitBinaryOperator(Instruction &I) { Result.markOverdefined(); break; // Cannot fold this operation over the PHI nodes! } else if (In1.isConstant() && In2.isConstant()) { - Constant *Val = 0; - if (isa<BinaryOperator>(I)) - Val = ConstantExpr::get(I.getOpcode(), In1.getConstant(), - In2.getConstant()); - else { - assert(isa<ShiftInst>(I) && - "Can only handle binops and shifts here!"); - Val = ConstantExpr::getShift(I.getOpcode(), In1.getConstant(), - In2.getConstant()); - } + Constant *V = ConstantExpr::get(I.getOpcode(), In1.getConstant(), + In2.getConstant()); if (Result.isUndefined()) - Result.markConstant(Val); - else if (Result.isConstant() && Result.getConstant() != Val) { + Result.markConstant(V); + else if (Result.isConstant() && Result.getConstant() != V) { Result.markOverdefined(); break; } @@ -652,17 +644,8 @@ void SCCP::visitBinaryOperator(Instruction &I) { markOverdefined(IV, &I); } else if (V1State.isConstant() && V2State.isConstant()) { - Constant *Result = 0; - if (isa<BinaryOperator>(I)) - Result = ConstantExpr::get(I.getOpcode(), V1State.getConstant(), - V2State.getConstant()); - else { - assert (isa<ShiftInst>(I) && "Can only handle binops and shifts here!"); - Result = ConstantExpr::getShift(I.getOpcode(), V1State.getConstant(), - V2State.getConstant()); - } - - markConstant(IV, &I, Result); // This instruction constant folds! + markConstant(IV, &I, ConstantExpr::get(I.getOpcode(), V1State.getConstant(), + V2State.getConstant())); } } |