[PATCH] D61075: [CodeGenPrepare] delay instruction deletion for efficiency

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 24 18:55:42 PDT 2019


reames added a comment.

I think I'm missing something basic here.  CGP will iterate until done, including trivial DCE.  Given that, why not just leave the instructions in the IR and let the next iteration remove them?  It would trigger an extra iteration, which might be undesirable, but would it be incorrect?  That would seem better than invalidating the DomTree, which just forces a new iteration anyways...

Actually, it doesn't look like it includes trivial DCE.  Maybe it should?

Assuming the answer is that yet, that would be correct, then this patch becomes a smallish optimization over an extra iteration right?

Thinking through the logic, we don't need to worry about the cmp instruction since the caller advanced the iterator beyond it.  So, the only concern is the binary operator.  But correct me if I'm wrong, don't you require the BO to dominate the Cmp?  If so, then haven't we already iterated past that instruction?  How do we have an iterator invalidation problem at all?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D61075/new/

https://reviews.llvm.org/D61075





More information about the llvm-commits mailing list