[PATCH] D21076: [DSE] Ignore dbg value when instruction iterator is reset.

Henric Karlsson via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 14 02:02:38 PDT 2016


Henric added a comment.

In http://reviews.llvm.org/D21076#456942, @dberlin wrote:

> Note: bb->eraseFromParent now returns an iterator, so you can fix this by returning and using that instead  :)


This will change the behavior quite a bit, and then I think it's better to change it so we set BBI = BB.begin()

We typically have this case:
----------------------------

Store -> A   (Dead)
nextInst      (so iterator from eraseFromParent() will point here)
...
Store -> A  (current instruction)

nextInst      (BBI typically points here)
-----------------------------------------

But this also made me realize that all this --BBI might also be unnecessary, just setting BBI to Inst->getIterator() might be good enough.
On the other hand if we also remove loads and not only the store instruction, then we might open up for detecting new dead stores, so could be worth it to revisiting the basic block from the beginning again.


http://reviews.llvm.org/D21076





More information about the llvm-commits mailing list