[PATCH] D93734: [LoopDeletion] Insert an early exit from dead path in loop

Jonas Paulsson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 22 16:18:16 PST 2020


jonpa added a comment.

In D93734#2469137 <https://reviews.llvm.org/D93734#2469137>, @jdoerfert wrote:

> The idea is that we have
>
>   H:
>     %c = ... ; invariant wrt H and L
>     br %c, L, B
>   B: 
>     side_effects
>     br L
>   L:
>     br %x, H, Exit
>   
>   Exit:
>     ...
>
> right?

Yes, exactly (could be more blocks than 3, though, of course).

> One of my problems is that this is too tied to the syntax.

How do you mean, exactly?

> Another is that we are not deleting a loop. The former can be addressed later I guess.
>
> Isn't this more related to LoopUnswitch?
> We want to "unswitch the paths that are side-effect free", or something like that.

I thought that if we cannot delete the whole loop we can effectively delete a part of it with an early exit.

LoopUnswitching only works if the condition is loop invariant currently as far as I can see, so I am not sure how simple that would be...

> We could also make it generic by collecting the blocks that are allowed on such a path
> in order to allow different CFGs. But that can be done later as well.

Might be worth a try...


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

https://reviews.llvm.org/D93734



More information about the llvm-commits mailing list