[llvm-bugs] [Bug 32022] New: Multiple simplifycfg pass make some loops significantly slower

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Feb 20 10:43:30 PST 2017


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

            Bug ID: 32022
           Summary: Multiple simplifycfg pass make some loops
                    significantly slower
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Loop Optimizer
          Assignee: unassignedbugs at nondot.org
          Reporter: siu at continuum.io
                CC: llvm-bugs at lists.llvm.org

Created attachment 18011
  --> https://bugs.llvm.org/attachment.cgi?id=18011&action=edit
sample C code to demonstrate problem

With `opt -simplifycfg -sroa -simplifcfy`, loops with a if-branch in the body
gets >2x slower if they have a single backedge.  I have attached C source code
that can demonstrate this problem with clang version 3.9, 4.0 and
5.0.0-svn295492-1~exp1 from the nightly build.  (I haven't tested earlier
versions.)  In the code, the apple() function is the slow version and the
orange() function is the fast version of the same code.  Their only difference
is the location for the `++i` loop increment.

I speculate that the problem comes from the select instructions created by the
2nd simplifycfg:

  %all_missing.1 = select i1 %7, i32 0, i32 %all_missing.0
  %amin.1 = select i1 %7, double %6, double %amin.0

which probably corresponds to the following x86 assembly:

  movaps %xmm1,%xmm2
  cmpnlesd %xmm0,%xmm2
  andps  %xmm2,%xmm0
  andnps %xmm1,%xmm2
  orps   %xmm2,%xmm0



We previously thought this problem is related to bug #30452 but we were
recommended to open a new issue.

-- 
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/20170220/63aba03c/attachment.html>


More information about the llvm-bugs mailing list