<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - Multiple simplifycfg pass make some loops significantly slower"
href="https://bugs.llvm.org/show_bug.cgi?id=32022">32022</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Multiple simplifycfg pass make some loops significantly slower
</td>
</tr>
<tr>
<th>Product</th>
<td>libraries
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Loop Optimizer
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>siu@continuum.io
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=18011" name="attach_18011" title="sample C code to demonstrate problem">attachment 18011</a> <a href="attachment.cgi?id=18011&action=edit" title="sample C code to demonstrate problem">[details]</a></span>
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 <a class="bz_bug_link
bz_status_NEW "
title="NEW - CFG simplify sink performance regression on AArch64 in libcxx std::map"
href="show_bug.cgi?id=30452">bug #30452</a> but we were
recommended to open a new issue.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>