[PATCH] D99774: [LoopUtils] Populate sibling loops in reverse program order on new pass manager

JinGu Kang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 6 11:12:54 PDT 2021


jaykang10 added a comment.

In D99774#2670925 <https://reviews.llvm.org/D99774#2670925>, @jaykang10 wrote:

> In D99774#2670209 <https://reviews.llvm.org/D99774#2670209>, @aeubanks wrote:
>
>> Actually, can you give a concrete example? The example in the description isn't clear enough
>>
>> There will probably be cases where one way is better and cases where the other way is better. Might just be better to try to fix your use case directly in the passes themselves
>
> @aeubanks Thanks for comments. Let me try to create a example for it.

@aeubanks I have added a reduced example `loop-order-on-new-loop-pass-manager.ll`.

As you can see, the second loop is read-only loop and the `IndVarSimplify` pass deletes the loop. If we use reverse order of loops, the second loop is gone and  the `%7` and `%8`  are redundant on first loop. In the end, with -O2, it causes empty function. If we use forward order of loops, the first loop is not removed because the second loop uses `%8` during optimizing first loop. I am not sure we can fix this issue directly in the passes because it needs to look at other sibling loops. From my opinion, it would be better to change the order of loops in reverse on new loop pass manager for dead uses.


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

https://reviews.llvm.org/D99774



More information about the llvm-commits mailing list