<html>
<head>
<base href="http://llvm.org/bugs/" />
</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 --- - Reassociate should somtimes be redone after loop canonicalization"
href="http://llvm.org/bugs/show_bug.cgi?id=16116">16116</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Reassociate should somtimes be redone after loop canonicalization
</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>Windows NT
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Scalar Optimizations
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>jeroen.dobbelaere@synopsys.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>The normal order of passes are:
- reassociate
- loop simplication/rotate
- licm (loop invariant code motion)
I found a speed regression between 3.1 and 3.2 (and later) because of
the following :
---
In the samples below I observer the following behavior:
Both start with the same expression:
%add = add i32 %total.0, %next.0
%add1 = add i32 %add, 1
-LLVM-3.1 converts this into:
--after Reassociate expressions:
%add = add i32 %next.0, 1
%add1 = add i32 %add, %total.0
-- after Canonicalize natural loops:
%add = add i32 %next.0.ph, 1
%add1 = add i32 %add, %total.0
-- and during 'loop invariant code motion':
LICM hoisting to while.cond.outer: %add = add i32 %next.0.ph, 1
- LLVM-3.2 converts it into: (Notice the reversion of %total.0 and %next.0)
--after Reassociate expressions:
%add = add i32 %total.0, 1
%add1 = add i32 %add, %next.0
-- after Canonicalize natural loops:
%add = add i32 %total.0, 1
%add1 = add i32 %add, %next.0.ph
-- and during 'loop invariant code motion':
-> %next.0.ph and '1' are loop invariant, but because those are spreaded, they
are not moved any more.
----
So:
- loop canonicalization introduces new opportunities for variables to be moved
outside the loop, but as reassociate expression is not redone, it depends on
'luck' (= order of the expression) if the opportunity is indeed seen.</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>