[PATCH] D141109: [LoopReroll] Allow for multiple loop control only induction vars

Joshua Cao via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 5 23:00:47 PST 2023


caojoshua created this revision.
Herald added a subscriber: hiraditya.
Herald added a project: All.
caojoshua added a reviewer: uabelho.
caojoshua published this revision for review.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Before this, LoopReroll would fail an assertion, falsely assuming that
there can only possibly a single loop control only induction variable.

For example:

  %a = phi i16 [ %dec2, %for.body ], [ 0, %entry ]
  %b = phi i16 [ %dec1, %for.body ], [ 0, %entry ]
  %a.next = add nsw i16 %1, -1
  %b.next = add nsw i16 %0, -1
  %add = add nsw i16 %a, %b
  ; ... rerollable code
  %cmp.not = icmp eq i16 -10, %add
  br i1 %cmp.not, label %exit, label %loop

Both %a and %b are valid loop control only induction vars

Additionally, some NFC changes to remove unnecessary isa<PHINode> check

Updated complex_reroll checks


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D141109

Files:
  llvm/lib/Transforms/Scalar/LoopRerollPass.cpp
  llvm/test/Transforms/LoopReroll/complex_reroll.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D141109.486751.patch
Type: text/x-patch
Size: 17058 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230106/ff236620/attachment.bin>


More information about the llvm-commits mailing list