Use the 'regalloc' debug tag for most register allocator tracing.
[oota-llvm.git] / lib / Transforms / Scalar / Reassociate.cpp
index 578e8e035c03b73ece95db51428f01fb6aae3662..8f98a5b6503e15a981f3d12753fd580122bb42dc 100644 (file)
@@ -75,7 +75,6 @@ namespace {
   class Reassociate : public FunctionPass {
     DenseMap<BasicBlock*, unsigned> RankMap;
     DenseMap<AssertingVH<>, unsigned> ValueRankMap;
-    DenseMap<Value *, DbgValueInst *> DbgValues;
     SmallVector<WeakVH, 8> RedoInsts;
     SmallVector<WeakVH, 8> DeadInsts;
     bool MadeChange;
@@ -105,9 +104,6 @@ namespace {
     void ReassociateInst(BasicBlock::iterator &BBI);
     
     void RemoveDeadBinaryOp(Value *V);
-
-    /// collectDbgValues - Collect all llvm.dbg.value intrinsics.
-    void collectDbgValues(Function &F);
   };
 }
 
@@ -313,7 +309,7 @@ void Reassociate::LinearizeExprTree(BinaryOperator *I,
     std::swap(LHS, RHS);
     bool Success = !I->swapOperands();
     assert(Success && "swapOperands failed");
-    Success = false;
+    (void)Success;
     MadeChange = true;
   } else if (RHSBO) {
     // Turn (A+B)+(C+D) -> (((A+B)+C)+D).  This guarantees the RHS is not
@@ -348,11 +344,6 @@ void Reassociate::LinearizeExprTree(BinaryOperator *I,
 void Reassociate::RewriteExprTree(BinaryOperator *I,
                                   SmallVectorImpl<ValueEntry> &Ops,
                                   unsigned i) {
-  // If this operation was representing debug info of a value then it
-  // is no longer true, so remove the dbg.value instrinsic.
-  if (DbgValueInst *DVI = DbgValues.lookup(I))
-    DeadInsts.push_back(DVI);
-
   if (i+2 == Ops.size()) {
     if (I->getOperand(0) != Ops[i].Op ||
         I->getOperand(1) != Ops[i+1].Op) {
@@ -1103,7 +1094,6 @@ Value *Reassociate::ReassociateExpression(BinaryOperator *I) {
 
 
 bool Reassociate::runOnFunction(Function &F) {
-  collectDbgValues(F);
   // Recalculate the rank map for F
   BuildRankMap(F);
 
@@ -1123,9 +1113,7 @@ bool Reassociate::runOnFunction(Function &F) {
   // Now that we're done, delete any instructions which are no longer used.
   while (!DeadInsts.empty())
     if (Value *V = DeadInsts.pop_back_val())
-      if (!RecursivelyDeleteTriviallyDeadInstructions(V))
-        if (DbgValueInst *DVI = dyn_cast<DbgValueInst>(V))
-          DVI->eraseFromParent();
+      RecursivelyDeleteTriviallyDeadInstructions(V);
 
   // We are done with the rank map.
   RankMap.clear();
@@ -1133,11 +1121,3 @@ bool Reassociate::runOnFunction(Function &F) {
   return MadeChange;
 }
 
-/// collectDbgValues - Collect all llvm.dbg.value intrinsics.
-void Reassociate::collectDbgValues(Function &F) {
-  for (Function::iterator FI = F.begin(), FE = F.end(); FI != FE; ++FI)
-    for (BasicBlock::iterator BI = FI->begin(), BE = FI->end(); 
-         BI != BE; ++BI)
-      if (DbgValueInst *DVI = dyn_cast<DbgValueInst>(BI))
-        DbgValues[DVI->getValue()] = DVI;
-}