[llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp

Chris Lattner lattner at cs.uiuc.edu
Thu Nov 18 13:41:51 PST 2004



Changes in directory llvm/lib/Transforms/Scalar:

InstructionCombining.cpp updated: 1.285 -> 1.286
---
Log message:

Delete stoppoints that occur for the same source line.


---
Diffs of the changes:  (+11 -1)

Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.285 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.286
--- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.285	Sun Nov 14 23:54:07 2004
+++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp	Thu Nov 18 15:41:39 2004
@@ -182,7 +182,7 @@
       assert(I.use_empty() && "Cannot erase instruction that is used!");
       AddUsesToWorkList(I);
       removeFromWorkList(&I);
-      I.getParent()->getInstList().erase(&I);
+      I.eraseFromParent();
       return 0;  // Don't do anything with FI
     }
 
@@ -3217,6 +3217,16 @@
         }
 
     if (Changed) return &CI;
+  } else if (DbgStopPointInst *SPI = dyn_cast<DbgStopPointInst>(&CI)) {
+    // If this stoppoint is at the same source location as the previous
+    // stoppoint in the chain, it is not needed.
+    if (DbgStopPointInst *PrevSPI =
+        dyn_cast<DbgStopPointInst>(SPI->getChain()))
+      if (SPI->getLineNo() == PrevSPI->getLineNo() &&
+          SPI->getColNo() == PrevSPI->getColNo()) {
+        SPI->replaceAllUsesWith(PrevSPI);
+        return EraseInstFromFunction(CI);
+      }
   }
 
   return visitCallSite(&CI);






More information about the llvm-commits mailing list