[indvars] Allow rotation (narrowing) of exit test when discovering trip count
authorPhilip Reames <listmail@philipreames.com>
Thu, 4 Nov 2021 21:46:20 +0000 (14:46 -0700)
committerPhilip Reames <listmail@philipreames.com>
Thu, 4 Nov 2021 21:49:24 +0000 (14:49 -0700)
commitc0d9bf2f6afdceca53cda1a294ceeb74385142d1
tree7835d4fdadd896be2889fe107ee199fe52b4f525
parent2125eb3446d30c49f0997b5cd24535ded36528e0
[indvars] Allow rotation (narrowing) of exit test when discovering trip count

This relaxes the one-use requirement on the rotation transform specifically for the case where we know we're zexting an IV of the loop.  This allows us to discover trip count information in SCEV, which seems worth a single extra loop invariant truncate.  Honestly, I'd prefer if SCEV could just compute the trip count directly (e.g. D109457), but this unblocks practical benefit.
llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
llvm/test/Transforms/IndVarSimplify/finite-exit-comparisons.ll