[PATCH] D93734: [LoopDeletion] Insert an early exit from dead path in loop
Johannes Doerfert via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 22 15:55:45 PST 2020
jdoerfert added a comment.
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?
One of my problems is that this is too tied to the syntax.
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.
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.
================
Comment at: llvm/lib/Transforms/Scalar/LoopDeletion.cpp:131
+ return L->getHeader()->getParent()->mustProgress() || hasMustProgress(L);
+}
+
----------------
Nit: Unrelated and misses documentation. A useful helper though, could be added to D86844 directly (if you don't mind).
================
Comment at: llvm/lib/Transforms/Scalar/LoopDeletion.cpp:278
+ if (I.mayHaveSideEffects() && !I.isDroppable())
+ return false;
+
----------------
that reminds me, we really need to make `llvm.assume` side-effect free... D89054
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D93734/new/
https://reviews.llvm.org/D93734
More information about the llvm-commits
mailing list