[SCCP] Try to follow the DRY principle, use `OpSt`.
authorDavide Italiano <davide@freebsd.org>
Mon, 11 Jul 2016 18:21:29 +0000 (18:21 +0000)
committerDavide Italiano <davide@freebsd.org>
Mon, 11 Jul 2016 18:21:29 +0000 (18:21 +0000)
Thanks to Eli Friedman for pointing out in his post-commit review!

llvm-svn: 275084

llvm/lib/Transforms/Scalar/SCCP.cpp

index 4eefc91..f93f4ee 100644 (file)
@@ -761,9 +761,8 @@ void SCCPSolver::visitCastInst(CastInst &I) {
     markOverdefined(&I);
   else if (OpSt.isConstant()) {
     // Fold the constant as we build.
-    Constant *C = ConstantFoldCastOperand(
-        I.getOpcode(), getValueState(I.getOperand(0)).getConstant(),
-        I.getType(), DL);
+    Constant *C = ConstantFoldCastOperand(I.getOpcode(), OpSt.getConstant(),
+                                          I.getType(), DL);
     if (isa<UndefValue>(C))
       return;
     // Propagate constant value