diff options
Diffstat (limited to 'llvm/lib/Transforms/Scalar/SCCP.cpp')
-rw-r--r-- | llvm/lib/Transforms/Scalar/SCCP.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/Scalar/SCCP.cpp b/llvm/lib/Transforms/Scalar/SCCP.cpp index 8d1547577b4..015c67a0d22 100644 --- a/llvm/lib/Transforms/Scalar/SCCP.cpp +++ b/llvm/lib/Transforms/Scalar/SCCP.cpp @@ -502,9 +502,15 @@ void SCCP::visitBinaryOperator(Instruction *I) { if (V1State.isOverdefined() || V2State.isOverdefined()) { markOverdefined(I); } else if (V1State.isConstant() && V2State.isConstant()) { - Constant *Result = ConstantFoldBinaryInstruction(I->getOpcode(), - V1State.getConstant(), - V2State.getConstant()); + Constant *Result = 0; + if (isa<BinaryOperator>(I)) + Result = ConstantFoldBinaryInstruction(I->getOpcode(), + V1State.getConstant(), + V2State.getConstant()); + else if (isa<ShiftInst>(I)) + Result = ConstantFoldShiftInstruction(I->getOpcode(), + V1State.getConstant(), + V2State.getConstant()); if (Result) markConstant(I, Result); // This instruction constant folds! else |