[PATCH] D105802: [LoopFlatten] Fix missed LoopFlatten opportunity

Rosie Sumpter via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 12 02:12:26 PDT 2021


RosieSumpter created this revision.
RosieSumpter added a reviewer: SjoerdMeijer.
Herald added a subscriber: hiraditya.
RosieSumpter requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

When the limit of the inner loop is a known integer, the InstCombine
pass now causes the transformation e.g. imcp ult i32 %inc, limit ->
icmp ult %j, limit-step (where %j is the inner loop induction variable
and %inc is add %j, step). In this case the increment can no longer be
found from this compare instruction, so a pattern match has been added
to find the increment from the induction phi instead. This is also an
acceptable use of %j (provided the step is 1) so is ignored as long as
the compare that it's used in is also the condition of the inner branch.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D105802

Files:
  llvm/lib/Transforms/Scalar/LoopFlatten.cpp
  llvm/test/Transforms/LoopFlatten/loop-flatten-negative.ll
  llvm/test/Transforms/LoopFlatten/loop-flatten.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D105802.357866.patch
Type: text/x-patch
Size: 6628 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210712/9cc4cc19/attachment.bin>


More information about the llvm-commits mailing list