[PATCH] D111896: [indvars] Canonicalize exit conditions to unsigned using range info

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 19 12:24:46 PDT 2021


reames added a comment.

I went ahead and pushed a follow on to this without review.  0836a105 <https://reviews.llvm.org/rG0836a1059dcf8e4fbf408248bf5eed13dfd93f7b> extends this code to handle multiple exiting blocks.  The change is trivial; as noted in the review description here, it was left out only to make keeping a couple of reviews in sync reasonable.



================
Comment at: llvm/lib/Transforms/Scalar/IndVarSimplify.cpp:1441
+  if (!L->isLoopInvariant(RHS))
+    return false;
+
----------------
mkazantsev wrote:
> Can we end up with non-canonicalized comparison here? I.e. LHS is invariant and RHS is not. If so, we can swap them. OK if done in follow-up.
I think we can.  To be honest, I'd rather handle that with a general canonicalization towards invariant on rhs, but that'll require a bit more thought.  I won't get to this immediately, but I wrote it down to come back to in a few days.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D111896



More information about the llvm-commits mailing list