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: [email protected]
          Reporter: [email protected]
                CC: [email protected]

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.
_______________________________________________
llvm-bugs mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to