<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 - [DebugInfo@O2][Dexter] static function variables not updating in loops after LICM"
href="https://bugs.llvm.org/show_bug.cgi?id=38777">38777</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>[DebugInfo@O2][Dexter] static function variables not updating in loops after LICM
</td>
</tr>
<tr>
<th>Product</th>
<td>new-bugs
</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>normal
</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>greg.bedwell@sony.com
</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=20809" name="attach_20809" title="pre-LICM DExTer trace">attachment 20809</a> <a href="attachment.cgi?id=20809&action=edit" title="pre-LICM DExTer trace">[details]</a></span>
pre-LICM DExTer trace
Testcase (simplified version of
<a href="https://github.com/SNSystems/dexter/blob/d2a419e49/tests/nostdlib/static_loop_variables/test.cpp">https://github.com/SNSystems/dexter/blob/d2a419e49/tests/nostdlib/static_loop_variables/test.cpp</a>
):
// =====================================================
int Foo(const int iterations, const int initial) {
static int val = initial;
for (static int i = 0; i <= iterations; ++i)
val += (i % 2 ? 50 : 25) * i; // <-- BREAK HERE
return val;
}
int main(int argc, char**) {
return Foo(4 + argc, 5 + argc);
}
// =====================================================
Using LLVM/Clang r341056.
Compiling with "-O0 -g -fno-inline", if I put a breakpoint in the loop and
inspect variable "i" at each iteration, I will see "0", "1", "2", "3", "4", "5"
as expected. Similarly, if I inspect variable "val", I will see "6", "6",
"56", "106", "256", "356" as expected. On the "return val" line, I see "6" for
"i" and "606" for "val".
Compiling with "-O2 -g -fno-inline", if I put a breakpoint in the loop and
inspect variable i at each iteration, I will see "0" for each iteration, and
inspecting "val" I will see "6" at each iteration. On the "return val" line, I
still see "6" for "i" and "606" for "val".
Using DExTer's clang-opt-bisect tool:
$ dexter.py clang-opt-bisect --builder clang --debugger lldb --cflags="-O2 -g
-fno-inline" --ldflags="-g" -- tests\nostdlib\static_loop_variables
I've narrowed this change down to LICM running on the loop.</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>