<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 --- - ARM: (sub ; trivial unsigned icmp ; branch) picks wrong trivial cmp result"
href="http://llvm.org/bugs/show_bug.cgi?id=22373">22373</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>ARM: (sub ; trivial unsigned icmp ; branch) picks wrong trivial cmp result
</td>
</tr>
<tr>
<th>Product</th>
<td>tools
</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>llc
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>jvoung@google.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>Given the following .ll
===
$ cat temp.repro2.ll
; ModuleID = '/tmp/temp.repro2.ll'
target datalayout = "e-p:32:32-i64:64-n32"
@x = internal global i32 zeroinitializer, align 4
define i32 @main() {
entry:
%bf.load = load i32* @x, align 1
%sub = sub i32 %bf.load, 2
%cmp = icmp ult i32 %sub, 0
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %entry
call void @abort()
unreachable
if.end: ; preds = %entry
call void @exit(i32 0)
unreachable
}
declare void @abort()
declare void @exit(i32)
====
The icmp ult i32 %sub, 0, should always be false, so that the if.end branch is
taken.
In LLVM 3.5 we would get:
$ llc -mtriple armv7a-none-linux-gnueabihf /tmp/temp.repro2.ll -o -
main: @ @main
.fnstart
.Leh_func_begin0:
@ BB#0: @ %entry
.save {r11, lr}
push {r11, lr}
mov r0, #1
cmp r0, #0
bne .LBB0_2
@ BB#1: @ %if.then
bl abort
.LBB0_2: @ %if.end
mov r0, #0
bl exit
This correctly goes to the if.end branch.
I tried LLVM 3.7 @ 227294 and get:
main: @ @main
.fnstart
.Leh_func_begin0:
@ BB#0: @ %entry
.save {r11, lr}
push {r11, lr}
movw r0, :lower16:x
movt r0, :upper16:x
ldr r0, [r0]
subs r0, r0, #2
bhs .LBB0_2
@ BB#1: @ %if.then
bl abort
.LBB0_2: @ %if.end
mov r0, #0
bl exit
The subs will not actually set the carry bit, so this no longer goes to the
if.end branch.
====
Currently still bisecting to figure out when this started happening.</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>