[PATCH] D41943: [LoopDeletion] Handle users in unreachable block

Anna Thomas via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 11 07:25:38 PST 2018


anna accepted this revision.
anna added a comment.
This revision is now accepted and ready to land.

LGTM w/ comments.



================
Comment at: lib/Transforms/Utils/LoopUtils.cpp:1359
 
+  // Strongly speaking any instruction in the loop at this moment should not
+  // have a user outside of this loop. However it is possible that there are
----------------
I think this is more clearer: "Given LCSSA form is satisfied, we should not have users of instructions within the dead loop outside of the loop. However, LCSSA doesn't take unreachable uses into account. We handle them here".


================
Comment at: lib/Transforms/Utils/LoopUtils.cpp:1364
+  // loop will be already eliminated and we have less work to do but according
+  // to API doc of User::dropAllReferences no one operation after dropping all
+  // references is valid except deletion. So let's substitute all usages of
----------------
Nit: only valid operation after dropping references, is deletion.


================
Comment at: test/Transforms/LoopDeletion/use-in-unreachable.ll:10
+; CHECK-LABEL-NOT: badloop
+badloop:
+  %indvar1 = phi i64 [ 3, %entry ], [ %indvar2, %badloop_iter ]
----------------
really, this isn't a badloop :)
It's an invariant loop that can be deleted. Perhaps rename to just loop?


https://reviews.llvm.org/D41943





More information about the llvm-commits mailing list