<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 --- - Bad code generation in post-ra ARMLoadStoreOptimizer pass in thumb1 mode"
href="http://llvm.org/bugs/show_bug.cgi?id=19972">19972</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Bad code generation in post-ra ARMLoadStoreOptimizer pass in thumb1 mode
</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>sgundapa@codeaurora.org
</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>Created <span class=""><a href="attachment.cgi?id=12624" name="attach_12624" title="Test case to demonstrate the bad codegen">attachment 12624</a> <a href="attachment.cgi?id=12624&action=edit" title="Test case to demonstrate the bad codegen">[details]</a></span>
Test case to demonstrate the bad codegen
Hi,
Please find the attached test case which can demonstrate the bad code
generation in post-ra ARMLoadStoreOptimizer pass in thumb1 mode.
If I compile with tip, I get this assembly:
$ clang -target arm -Os -mthumb -mcpu=arm926ej-s -c t.c -S -o-
@ BB#0: @ %entry
push {r7, lr}
add r7, sp, #0
subs r0, #8
ldm r0!, {r1, r2}
bl bar
pop {r7, pc}
The base address is incorrectly decremented before the load, so we end up
loading the incorrect values.
If I disable the post-ra ARMLoadStoreOptimizer pass, I get this assembly:
@ BB#0: @ %entry
push {r7, lr}
add r7, sp, #0
ldr r1, [r0]
ldr r2, [r0, #4]
bl bar
pop {r7, pc}
which correctly loads the values.
I would expect the ARMLoadStoreOptimizer to generate assembly like this for the
source code:
push {r7, lr}
add r7, sp, #0
ldm r0, {r1, r2}
bl bar
pop {r7, pc}
I triage the commit which initially caused the bad codegen.
The commit is
commit 40ae57cc0a187424c8db723a51506b7192b77f71
Author: James Molloy <<a href="mailto:james.molloy@arm.com">james.molloy@arm.com</a>>
Date: Fri May 16 14:14:30 2014 +0000
Fix the Load/Store optimization pass to work with Thumb1.
Patch by Moritz Roth!
git-svn-id: <a href="https://llvm.org/svn/llvm-project/llvm/trunk@208992">https://llvm.org/svn/llvm-project/llvm/trunk@208992</a>
91177308-0d34-0410-b5e6-96231b3b80d8</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>