[llvm-bugs] [Bug 34807] New: Pre-RA Machine LICM illegally hoists div

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Oct 2 12:13:09 PDT 2017


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

            Bug ID: 34807
           Summary: Pre-RA Machine LICM illegally hoists div
           Product: tools
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: llc
          Assignee: unassignedbugs at nondot.org
          Reporter: Alberto.Magni at microsoft.com
                CC: llvm-bugs at lists.llvm.org, nunoplopes at sapo.pt

Created attachment 19216
  --> https://bugs.llvm.org/attachment.cgi?id=19216&action=edit
Repro files

The attached .c file shows an issue with Machine LICM that causes the division
in the loop to be hoisted unconditionally outside of the loop for the aarch64
target.

The .mir file in the package has been obtained from the .c file with this
command:

clang -mllvm -stop-before=machinelicm -target aarch64-- -O2 -S licm_udiv.c -o
before_licm.mir

To reproduce the hoisting:

llc -debug -mtriple=aarch64-- -run-pass=machinelicm  before_licm.mir -o -

The debug output shows that the UDIV instruction is hoisted:
Hoist non-reg-pressure: %vreg13<def> = UDIVXr %vreg7, %vreg6;
GPR64:%vreg13,%vreg7,%vreg6

Notice that the same issue does not show up for x86_64.
This is because for x86_64 in IsProfitableToHoist we actually reach the
invocation of IsGuaranteedToExecute, which returns false for the block that
contains the division.

-- 
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/20171002/94a4bbc0/attachment.html>


More information about the llvm-bugs mailing list