//===----------------------------------------------------------------------===//
#include "TransformInternals.h"
+#include "llvm/Constants.h"
#include "llvm/iOther.h"
#include "llvm/iPHINode.h"
#include "llvm/iMemory.h"
-#include "llvm/ConstantHandling.h"
+
#include "llvm/Analysis/Expressions.h"
#include "Support/STLExtras.h"
#include "Support/Debug.h"
if (CTMI != CTMap.end()) return CTMI->second == Ty;
// If it's a constant... all constants can be converted to a different
- // type. We just ask the constant propagator to see if it can convert the
- // value...
+ // type.
//
if (Constant *CPV = dyn_cast<Constant>(V))
- return ConstantFoldCastInstruction(CPV, Ty);
+ return true;
CTMap[V] = Ty;
if (V->getType() == Ty) return true; // Expression already correct type!
Constant *CPV = cast<Constant>(V);
// Constants are converted by constant folding the cast that is required.
// We assume here that all casts are implemented for constant prop.
- Value *Result = ConstantFoldCastInstruction(CPV, Ty);
- assert(Result && "ConstantFoldCastInstruction Failed!!!");
- assert(Result->getType() == Ty && "Const prop of cast failed!");
-
+ Value *Result = ConstantExpr::getCast(CPV, Ty);
// Add the instruction to the expression map
//VMC.ExprMap[V] = Result;
return Result;
#include "llvm/iOther.h"
#include "llvm/iMemory.h"
#include "llvm/Pass.h"
-#include "llvm/ConstantHandling.h"
#include "llvm/Transforms/Utils/BasicBlockUtils.h"
#include "Support/CommandLine.h"
#include "Support/Debug.h"