<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 - LLVM miscompiles trivial switch for AArch64"
href="https://bugs.llvm.org/show_bug.cgi?id=43383">43383</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>LLVM miscompiles trivial switch for AArch64
</td>
</tr>
<tr>
<th>Product</th>
<td>new-bugs
</td>
</tr>
<tr>
<th>Version</th>
<td>9.0
</td>
</tr>
<tr>
<th>Hardware</th>
<td>All
</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>new bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>andrew@ziglang.org
</td>
</tr>
<tr>
<th>CC</th>
<td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>I'm filing this on behalf of downstream issue:
<a href="https://github.com/ziglang/zig/issues/3271">https://github.com/ziglang/zig/issues/3271</a>
Here's the reduced llvm-ir test case:
; Function Attrs: cold nobuiltin noreturn nounwind
define internal void @bar() unnamed_addr #1 {
unreachable
}
define i1 @foo(i1) unnamed_addr #0 {
Entry:
switch i1 %0, label %BadValue [
i1 false, label %OkValue
i1 true, label %OkValue
]
BadValue:
call fastcc void @bar()
unreachable
OkValue:
ret i1 %0
}
LLVM9 generates nonsensical code:
mov w8, #1
mov w9, w0
and w9, w9, w8
mov w10, #0
and w8, w10, w8 // w8 is turned into zero
cmp w9, w8 // Comparison against zero
str w0, [sp, #12]
b.ls .LBB1_2 // The branch is _never_ taken
Please report to the LLVM devs, I have no bugzilla account.</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>