Changes For Bug 352
[oota-llvm.git] / lib / Transforms / LevelRaise.cpp
index 8e11bf3d45194b3dc649a3819a55129f752c7989..cc4e69d9acd4e24c043d68b58ef7284c7a22a413 100644 (file)
 #include "llvm/Transforms/Scalar.h"
 #include "llvm/Transforms/Utils/Local.h"
 #include "TransformInternals.h"
-#include "llvm/iOther.h"
-#include "llvm/iMemory.h"
+#include "llvm/Instructions.h"
 #include "llvm/Pass.h"
 #include "llvm/Transforms/Utils/BasicBlockUtils.h"
-#include "Support/CommandLine.h"
-#include "Support/Debug.h"
-#include "Support/Statistic.h"
-#include "Support/STLExtras.h"
+#include "llvm/Support/CommandLine.h"
+#include "llvm/Support/Debug.h"
+#include "llvm/ADT/Statistic.h"
+#include "llvm/ADT/STLExtras.h"
 #include <algorithm>
 using namespace llvm;
 
@@ -303,7 +302,8 @@ bool RPR::PeepholeOptimize(BasicBlock *BB, BasicBlock::iterator &BI) {
       // Make sure the source doesn't change type
       ConvertedTypes[Src] = Src->getType();
       if (ValueConvertibleToType(CI, Src->getType(), ConvertedTypes, TD)) {
-        PRINT_PEEPHOLE3("CAST-DEST-EXPR-CONV:in ", *Src, *CI, *BB->getParent());
+        //PRINT_PEEPHOLE3("CAST-DEST-EXPR-CONV:in ", *Src, *CI,
+        //                *BB->getParent());
 
         DEBUG(std::cerr << "\nCONVERTING EXPR TYPE:\n");
         { // ValueMap must be destroyed before function verified!
@@ -528,8 +528,6 @@ bool RPR::PeepholeOptimize(BasicBlock *BB, BasicBlock::iterator &BI) {
       Constant *ConstantCallSrc = 0;
       if (Constant *CS = dyn_cast<Constant>(CI->getCalledValue()))
         ConstantCallSrc = CS;
-      else if (GlobalValue *GV = dyn_cast<GlobalValue>(CI->getCalledValue()))
-        ConstantCallSrc = ConstantPointerRef::get(GV);
 
       if (ConstantCallSrc)
         NewCast = ConstantExpr::getCast(ConstantCallSrc, NewPFunTy);
@@ -537,10 +535,6 @@ bool RPR::PeepholeOptimize(BasicBlock *BB, BasicBlock::iterator &BI) {
         NewCast = new CastInst(CI->getCalledValue(), NewPFunTy,
                                CI->getCalledValue()->getName()+"_c",CI);
 
-      // Strip off unneeded CPR's.
-      if (ConstantPointerRef *CPR = dyn_cast<ConstantPointerRef>(NewCast))
-        NewCast = CPR->getValue();
-
       // Create a new call instruction...
       CallInst *NewCall = new CallInst(NewCast,
                            std::vector<Value*>(CI->op_begin()+1, CI->op_end()));