[llvm-bugs] [Bug 46583] New: Pointless PHI after loop rotation

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Jul 4 06:11:02 PDT 2020


https://bugs.llvm.org/show_bug.cgi?id=46583

            Bug ID: 46583
           Summary: Pointless PHI after loop rotation
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: lebedev.ri at gmail.com
                CC: llvm-bugs at lists.llvm.org

https://godbolt.org/z/d2JskK

Given

  %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.body ]
  %0 = and i32 %i.0, 1
<...>
  %inc = add nuw nsw i32 %i.0, 1

loop rotation produces

  %0 = phi i32 [ 0, %for.body.lr.ph ], [ %2, %for.body ]
  %i.010 = phi i32 [ 0, %for.body.lr.ph ], [ %inc, %for.body ]
<...>
  %inc = add nuw nsw i32 %i.010, 1
  %2 = and i32 %inc, 1


Which seems kinda sub-optimal for obvious reasons - more registers used,
%inc remains anyway, we loose potential to lower it to `test`, etc.

Where would be the best place to undo this this?

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200704/d823f022/attachment.html>


More information about the llvm-bugs mailing list