Revert r136503 and r136480 in an effort to fix non-determinism in the llvm-gcc buildbots on i386.  Devang is looking into the root cause.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136674 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Transforms/Scalar/Reassociate.cpp b/lib/Transforms/Scalar/Reassociate.cpp
index 1080b75..e6341ae 100644
--- a/lib/Transforms/Scalar/Reassociate.cpp
+++ b/lib/Transforms/Scalar/Reassociate.cpp
@@ -75,7 +75,6 @@
   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 @@
     void ReassociateInst(BasicBlock::iterator &BBI);
     
     void RemoveDeadBinaryOp(Value *V);
-
-    /// collectDbgValues - Collect all llvm.dbg.value intrinsics.
-    void collectDbgValues(Function &F);
   };
 }
 
@@ -348,11 +344,6 @@
 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 @@
 
 
 bool Reassociate::runOnFunction(Function &F) {
-  collectDbgValues(F);
   // Recalculate the rank map for F
   BuildRankMap(F);
 
@@ -1123,22 +1113,11 @@
   // 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();
   ValueRankMap.clear();
-  DbgValues.clear();
   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;
-}