s/DebugInfoEnumerator/DebugInfoFinder/g
[oota-llvm.git] / lib / Transforms / Scalar / GVNPRE.cpp
index d5098f29532fa3432768800d2858986fe4b1e471..459636156a4df091a5307cbdadd0c31781cd9f7a 100644 (file)
@@ -241,7 +241,7 @@ Expression::ExpressionOpcode
     
     // THIS SHOULD NEVER HAPPEN
     default:
-      LLVM_UNREACHABLE("Binary operator with unknown opcode?");
+      llvm_unreachable("Binary operator with unknown opcode?");
       return Expression::ADD;
   }
 }
@@ -272,7 +272,7 @@ Expression::ExpressionOpcode ValueTable::getOpcode(CmpInst* C) {
       
       // THIS SHOULD NEVER HAPPEN
       default:
-        LLVM_UNREACHABLE("Comparison with unknown predicate?");
+        llvm_unreachable("Comparison with unknown predicate?");
         return Expression::ICMPEQ;
     }
   } else {
@@ -308,7 +308,7 @@ Expression::ExpressionOpcode ValueTable::getOpcode(CmpInst* C) {
       
       // THIS SHOULD NEVER HAPPEN
       default:
-        LLVM_UNREACHABLE("Comparison with unknown predicate?");
+        llvm_unreachable("Comparison with unknown predicate?");
         return Expression::FCMPOEQ;
     }
   }
@@ -344,7 +344,7 @@ Expression::ExpressionOpcode
     
     // THIS SHOULD NEVER HAPPEN
     default:
-      LLVM_UNREACHABLE("Cast operator with unknown opcode?");
+      llvm_unreachable("Cast operator with unknown opcode?");
       return Expression::BITCAST;
   }
 }
@@ -578,7 +578,7 @@ uint32_t ValueTable::lookup(Value* V) const {
   if (VI != valueNumbering.end())
     return VI->second;
   else
-    LLVM_UNREACHABLE("Value not numbered?");
+    llvm_unreachable("Value not numbered?");
   
   return 0;
 }
@@ -768,7 +768,7 @@ Value* GVNPRE::find_leader(ValueNumberedSet& vals, uint32_t v) {
     if (v == VN.lookup(*I))
       return *I;
   
-  LLVM_UNREACHABLE("No leader found, but present bit is set?");
+  llvm_unreachable("No leader found, but present bit is set?");
   return 0;
 }
 
@@ -800,6 +800,8 @@ void GVNPRE::val_replace(ValueNumberedSet& s, Value* v) {
 Value* GVNPRE::phi_translate(Value* V, BasicBlock* pred, BasicBlock* succ) {
   if (V == 0)
     return 0;
+    
+  LLVMContext &Context = V->getContext();
   
   // Unary Operations
   if (CastInst* U = dyn_cast<CastInst>(V)) {
@@ -862,12 +864,13 @@ Value* GVNPRE::phi_translate(Value* V, BasicBlock* pred, BasicBlock* succ) {
                                         newOp1, newOp2,
                                         BO->getName()+".expr");
       else if (CmpInst* C = dyn_cast<CmpInst>(U))
-        newVal = CmpInst::Create(*Context, C->getOpcode(),
+        newVal = CmpInst::Create(Context, C->getOpcode(),
                                  C->getPredicate(),
                                  newOp1, newOp2,
                                  C->getName()+".expr");
       else if (ExtractElementInst* E = dyn_cast<ExtractElementInst>(U))
-        newVal = new ExtractElementInst(newOp1, newOp2, E->getName()+".expr");
+        newVal = ExtractElementInst::Create(newOp1, newOp2, 
+                                            E->getName()+".expr");
       
       uint32_t v = VN.lookup_or_add(newVal);
       
@@ -1594,6 +1597,7 @@ void GVNPRE::buildsets(Function& F) {
 void GVNPRE::insertion_pre(Value* e, BasicBlock* BB,
                            DenseMap<BasicBlock*, Value*>& avail,
                     std::map<BasicBlock*, ValueNumberedSet>& new_sets) {
+  LLVMContext &Context = e->getContext();
   for (pred_iterator PI = pred_begin(BB), PE = pred_end(BB); PI != PE; ++PI) {
     Value* e2 = avail[*PI];
     if (!availableOut[*PI].test(VN.lookup(e2))) {
@@ -1680,7 +1684,7 @@ void GVNPRE::insertion_pre(Value* e, BasicBlock* BB,
                                         BO->getName()+".gvnpre",
                                         (*PI)->getTerminator());
       else if (CmpInst* C = dyn_cast<CmpInst>(U))
-        newVal = CmpInst::Create(*Context, C->getOpcode(),
+        newVal = CmpInst::Create(Context, C->getOpcode(),
                                  C->getPredicate(), s1, s2,
                                  C->getName()+".gvnpre", 
                                  (*PI)->getTerminator());
@@ -1691,7 +1695,7 @@ void GVNPRE::insertion_pre(Value* e, BasicBlock* BB,
         newVal = InsertElementInst::Create(s1, s2, s3, S->getName()+".gvnpre",
                                            (*PI)->getTerminator());
       else if (ExtractElementInst* S = dyn_cast<ExtractElementInst>(U))
-        newVal = new ExtractElementInst(s1, s2, S->getName()+".gvnpre",
+        newVal = ExtractElementInst::Create(s1, s2, S->getName()+".gvnpre",
                                         (*PI)->getTerminator());
       else if (SelectInst* S = dyn_cast<SelectInst>(U))
         newVal = SelectInst::Create(s1, s2, s3, S->getName()+".gvnpre",