<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 - compile time over an hour under LTO+O3"
href="https://bugs.llvm.org/show_bug.cgi?id=47382">47382</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>compile time over an hour under LTO+O3
</td>
</tr>
<tr>
<th>Product</th>
<td>new-bugs
</td>
</tr>
<tr>
<th>Version</th>
<td>11.0
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</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>new bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>zhangtiehu@huawei.com
</td>
</tr>
<tr>
<th>CC</th>
<td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>//test.c
int a, b, c, d;
void e()
{
short f = &c;
int g = d = 0;
for (; d <= 3; d++) {
a = 0;
for (; a <= 4; a++)
g ^= g ?: f;
b = g;
}
}
void main() {}
clang -O3 -Wl,-z,notext -flto=full test.c -w
In this case, the compile time is over an hour. I use "-opt-bisect-limit" to
locate the fault. There are two passes may cause the problem:
1. "Combine redundant instructions on function"
There is an operation of "ConstantFoldInstruction(Inst, DL, TLI)", it will
substitue the value from the former expressions into any instructions later
that use the final values. In this case, there are many group of instructions
like this, and the later group is depend on the result of former.
=======================================
%xor.3 = xor i32 %cond.3, %xor.2
%tobool.4 = icmp ne i32 %xor.3, 0
%cond.4 = select i1 %tobool.4, i32 %xor.3, i32 sext (i16 ptrtoint (i32* @c to
i16) to i32)
%xor.4 = xor i32 %cond.4, %xor.3
============================================
We can describe the lenth of expression as preA, A, B, C, after an iteration,
the lenth of C will be three times of preA:
==============
A = preA
B = A + preA = 2 * preA
C = B + preA = 3 * preA
==============
After N group of "ConstantFoldInstruction", the lenth of final expression will
be preA * 3^N. In this case the IR lenth is about preA * 3^20. It is too large
to process which causes the issue.
2. "Induction Variable Simplification on loop"
This pass has similar problem with InstCombine when executing
"rewriteLoopExitValues".</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>