diff options
author | Chris Lattner <sabre@nondot.org> | 2004-01-12 17:43:40 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2004-01-12 17:43:40 +0000 |
commit | 0fe5b32c01ce7a1278acaf55393b276370f45a5d (patch) | |
tree | e17c913d2e9e323c6f72f8e74734ed5375321e3e /llvm/lib/Transforms | |
parent | fe992d4332b30e687d7c79fe20df3a73ee801350 (diff) | |
download | bcm5719-llvm-0fe5b32c01ce7a1278acaf55393b276370f45a5d.tar.gz bcm5719-llvm-0fe5b32c01ce7a1278acaf55393b276370f45a5d.zip |
Use constantexprs for casts. Eliminate use of the ConstantHandling interfaces
llvm-svn: 10779
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r-- | llvm/lib/Transforms/Scalar/SCCP.cpp | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/llvm/lib/Transforms/Scalar/SCCP.cpp b/llvm/lib/Transforms/Scalar/SCCP.cpp index a570ba8b13d..7a28281a799 100644 --- a/llvm/lib/Transforms/Scalar/SCCP.cpp +++ b/llvm/lib/Transforms/Scalar/SCCP.cpp @@ -22,11 +22,12 @@ //===----------------------------------------------------------------------===// #include "llvm/Transforms/Scalar.h" -#include "llvm/ConstantHandling.h" +#include "llvm/Constants.h" #include "llvm/Function.h" #include "llvm/GlobalVariable.h" #include "llvm/Instructions.h" #include "llvm/Pass.h" +#include "llvm/Type.h" #include "llvm/Support/InstVisitor.h" #include "Support/Debug.h" #include "Support/Statistic.h" @@ -558,17 +559,10 @@ void SCCP::visitTerminatorInst(TerminatorInst &TI) { void SCCP::visitCastInst(CastInst &I) { Value *V = I.getOperand(0); InstVal &VState = getValueState(V); - if (VState.isOverdefined()) { // Inherit overdefinedness of operand + if (VState.isOverdefined()) // Inherit overdefinedness of operand markOverdefined(&I); - } else if (VState.isConstant()) { // Propagate constant value - Constant *Result = - ConstantFoldCastInstruction(VState.getConstant(), I.getType()); - - if (Result) // If this instruction constant folds! - markConstant(&I, Result); - else - markOverdefined(&I); // Don't know how to fold this instruction. :( - } + else if (VState.isConstant()) // Propagate constant value + markConstant(&I, ConstantExpr::getCast(VState.getConstant(), I.getType())); } // Handle BinaryOperators and Shift Instructions... |