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 | b16689b647811d38ab5a5b990caed7f0014281c4 (patch) | |
tree | 096cb452a28b060dbbbf09ac6dcbb70d4dfe68a0 /lib/Transforms | |
parent | 3edd3979e1fd5f08203a0d4e0e89adc80db337a9 (diff) |
Don't use ConstantExpr::getShift anymore
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10791 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r-- | lib/Transforms/Scalar/SCCP.cpp | 29 |
1 files changed, 6 insertions, 23 deletions
diff --git a/lib/Transforms/Scalar/SCCP.cpp b/lib/Transforms/Scalar/SCCP.cpp index 7a28281a79..4e5e5156bb 100644 --- a/lib/Transforms/Scalar/SCCP.cpp +++ b/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())); } } |