[PATCH] D62880: Prepare for multi-exit LFTR [NFC]

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 4 14:26:09 PDT 2019


reames created this revision.
reames added reviewers: nikic, sanjoy, apilipenko.
Herald added subscribers: bollu, mcrosier.
Herald added a project: LLVM.

This change does the plumbing to wire an ExitingBB parameter through the LFTR implementation, and reorganizes the code to work in terms of a set of individual loop exits.  Most of it is fairly obvious, but there's one key complexity which makes it worthy of consideration.

Specifically, it turns out the existing code uses the backedge taken count from before a IV is widened.  This means that we can end up with a different a narrower BE count for the loop than requerying after widening.

For the nestedIV example from elim-extend, we end up with the following BE counts:
BEFORE: (-2 + (-1 * %innercount) + %limit)
AFTER: (-1 + (sext i32 (-1 + %limit) to i64) + (-1 * (sext i32 %innercount to i64))<nsw>)

This is the only test in tree which seems sensitive to this difference.  The actual result of using the wider BETC on this example is that we actually produce slightly better code.  :)

For the moment, the code is actually NFC.  I'd like to land this as is, and then adjust the BETC used in a separate patch.  (In particular, I want to investigate *why* they're different.  They should be equivalent.)  I'm open to being convinced that either a) I should investigate that first, or 2) I should just include the resultng test change in this commit and not worry about it.  Thoughts?


Repository:
  rL LLVM

https://reviews.llvm.org/D62880

Files:
  lib/Transforms/Scalar/IndVarSimplify.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D62880.203023.patch
Type: text/x-patch
Size: 13190 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190604/d6d45b6f/attachment.bin>


More information about the llvm-commits mailing list