[all-commits] [llvm/llvm-project] f17055: [LoopReroll] Allow for multiple loop control only ...

Joshua Cao via All-commits all-commits at lists.llvm.org
Thu Jan 12 21:01:31 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: f1705509400f4fbfb168f8f81f8eaa71dc68fa2a
      https://github.com/llvm/llvm-project/commit/f1705509400f4fbfb168f8f81f8eaa71dc68fa2a
  Author: Joshua Cao <cao.joshua at yahoo.com>
  Date:   2023-01-12 (Thu, 12 Jan 2023)

  Changed paths:
    M llvm/lib/Transforms/Scalar/LoopRerollPass.cpp
    M llvm/test/Transforms/LoopReroll/complex_reroll.ll

  Log Message:
  -----------
  [LoopReroll] Allow for multiple loop control only induction vars

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

Differential Revision: https://reviews.llvm.org/D141109




More information about the All-commits mailing list