[PATCH] D87344: [IndVars] Remove exiting conditions that are trivially true/false

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 28 13:41:19 PDT 2020


nikic added a comment.

In D87344#2298584 <https://reviews.llvm.org/D87344#2298584>, @reames wrote:

> If we want to generally handle icmps involving SCEVs which were not either uses of IVs (directly) or loop exits, I agree this code would be good to pull out and use.
>
> The catch is the the IV logic only visits a small subset of icmps.  If you have any form of complicated expression feeding the icmp, it gives up without every reaching it.
>
> I'll note that I think it's seriously worth considering whether we want a transform which just visits all icmps in a loop and tries to eliminate them, but that's a broader task than this patch.  :)

Okay, thanks for the clarification!



================
Comment at: llvm/lib/Transforms/Scalar/IndVarSimplify.cpp:2368
 
   // Remove all exits which aren't both rewriteable and analyzeable.
   auto NewEnd = llvm::remove_if(ExitingBlocks, [&](BasicBlock *ExitingBB) {
----------------
Nit: The mention of analyzeable exits here is stale now.


================
Comment at: llvm/lib/Transforms/Scalar/IndVarSimplify.cpp:2404
   // between them as each must dominate the latch.  The visit order only
   // matters for the provably equal case.
   llvm::sort(ExitingBlocks,
----------------
And here as well. Now we know because we explicitly checked dominance, not because the exits are analyzable.


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

https://reviews.llvm.org/D87344



More information about the llvm-commits mailing list