[PATCH] D93764: [LoopUnswitch] Implement first version of partial unswitching.
Jonas Paulsson via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Dec 27 17:10:54 PST 2020
jonpa added a comment.
> This patch applies the idea from D93734 <https://reviews.llvm.org/D93734> to LoopUnswitch.
One disadvantage here is that LoopUnswitch has a size-limitation on the loop it handles, which is not really true: If a no-side-effects loop is created and the intent is to later delete it, it should not be limited by the size heuristic.
On the other hand, I wonder if the idea here is to only isolate totally dead paths per this first draft or perhaps also paths where specifically the condition is invariant? This would be the advantage I can see compared to D93734 <https://reviews.llvm.org/D93734>: to increase unswitching where there may be side-effects that is known not to alias with the ToDuplicate instructions.
What about the original loop: If it is entered (instead of the new smaller loop your patch creates), it may still be true that the path where the condition becomes invariant is entered. So (at least theoretically) the full loop should in that case branch into the smaller loop. This would also eliminate the need to duplicate instructions in the preheader.
If we only want to achieve the "early exit" result, in other words that this patch will create a new loop with no side-effects (and then depend on later passes to remove it), it seems simpler to me to have this as a separate pass (or perhaps as a fix-up in LoopDeletion per D93734 <https://reviews.llvm.org/D93734>).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D93764/new/
https://reviews.llvm.org/D93764
More information about the llvm-commits
mailing list