diff options
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r-- | llvm/lib/Transforms/Scalar/SCCP.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Scalar/SCCP.cpp b/llvm/lib/Transforms/Scalar/SCCP.cpp index d4c156e994c..adc70d917f5 100644 --- a/llvm/lib/Transforms/Scalar/SCCP.cpp +++ b/llvm/lib/Transforms/Scalar/SCCP.cpp @@ -760,8 +760,10 @@ void SCCPSolver::visitCastInst(CastInst &I) { if (OpSt.isOverdefined()) // Inherit overdefinedness of operand markOverdefined(&I); else if (OpSt.isConstant()) { - Constant *C = - ConstantExpr::getCast(I.getOpcode(), OpSt.getConstant(), I.getType()); + // Fold the constant as we build. + Constant *C = ConstantFoldCastOperand( + I.getOpcode(), getValueState(I.getOperand(0)).getConstant(), + I.getType(), DL); if (isa<UndefValue>(C)) return; // Propagate constant value |