+void LICM::CleanupDbgInfoRegion(DomTreeNode *N) {
+ BasicBlock *BB = N->getBlock();
+
+ // If this subregion is not in the top level loop at all, exit.
+ if (!CurLoop->contains(BB)) return;
+
+ // We are processing blocks in reverse dfo, so process children first...
+ const std::vector<DomTreeNode*> &Children = N->getChildren();
+ for (unsigned i = 0, e = Children.size(); i != e; ++i)
+ CleanupDbgInfoRegion(Children[i]);
+
+ // Only need to process the contents of this block if it is not part of a
+ // subloop (which would already have been processed).
+ if (inSubLoop(BB)) return;
+
+ // We modify the basicblock, so don't cache end()
+ for (BasicBlock::iterator I=BB->begin(); I != BB->end();) {
+ Instruction *Last = 0;
+ // Remove consecutive dbgstoppoints, leave only last
+ do {
+ if (Last) {
+ Last->eraseFromParent();
+ Changed = true;
+ }
+ Last = I;
+ ++I;
+ } while (isa<DbgStopPointInst>(Last) && isa<DbgStopPointInst>(I));
+ }
+}