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

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 15 09:29:50 PDT 2021


reames created this revision.
reames added reviewers: mkazantsev, fhahn, efriedma.
Herald added subscribers: javed.absar, bollu, hiraditya, mcrosier.
reames requested review of this revision.
Herald added a project: LLVM.

This is a companion patch to D111836 <https://reviews.llvm.org/D111836>.  They share a bunch of common code, and whichever one lands second will be rebased over the other.

This patch duplicates a bit of logic we apply to comparisons encountered during the IV users walk to conditions which feed exit conditions.   Why?  simplifyAndExtend has a very limited list of users it walks. In particular, in the examples is stops at the zext and never visits the icmp. (Because we can't fold the zext to an addrec yet in SCEV.) Being willing to visit when we haven't simplified regresses multiple tests (seemingly because of less optimal results when computing trip counts).

Note that this can be trivially extended to multiple exiting blocks.  I'm leaving that to a future patch (solely to cut down on the number of versions of the same code in review at once.)


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D111896

Files:
  llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
  llvm/test/Transforms/IndVarSimplify/finite-exit-comparisons.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D111896.380036.patch
Type: text/x-patch
Size: 6304 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211015/b522aa19/attachment.bin>


More information about the llvm-commits mailing list