[PATCH] D91513: [DeadMachineInstrctionElim] Iteratively run DeadMachineInstructionElim pass until nothing dead

guopeilin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 17 18:29:49 PST 2020


guopeilin added a comment.

In D91513#2401470 <https://reviews.llvm.org/D91513#2401470>, @guopeilin wrote:

> In D91513#2400468 <https://reviews.llvm.org/D91513#2400468>, @hliao wrote:
>
>> Using post-order is quite straight-forward and only involves several lines of change. Please check the attachment. F14044934: 0001-DeadMachineInstructionElim-Use-post-order-for-basic-.patch <https://reviews.llvm.org/F14044934> That test passed with this traverse order change.
>
> That's a great help, I pass all my related cases with this patch, Thanks a lot.

Now that we decide to use post order to visit all blocks of a function, I think we need to consider that what if CFG contains cycles?F14055467: DG with cycles.PNG <https://reviews.llvm.org/F14055467>
>From this picture, we can see that post order is not clearly defined cause there exits cycles, one of the possible orders is that `[ m, g, d, e, c, b, t, x]`
So `m` comes before `g`, if we define something in `m` and use it in `g`. Then even though both def and use are useless, cause we visit `m` first, we will still get a dead definition after we post-order visit all blocks.
So is it possible there still exist some cases theoretically that cannot be fixed by post-order visit? That is we may still need to iteratively run?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D91513



More information about the llvm-commits mailing list