[llvm-bugs] [Bug 43383] New: LLVM miscompiles trivial switch for AArch64
via llvm-bugs
llvm-bugs at lists.llvm.org
Fri Sep 20 10:50:33 PDT 2019
https://bugs.llvm.org/show_bug.cgi?id=43383
Bug ID: 43383
Summary: LLVM miscompiles trivial switch for AArch64
Product: new-bugs
Version: 9.0
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P
Component: new bugs
Assignee: unassignedbugs at nondot.org
Reporter: andrew at ziglang.org
CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org
I'm filing this on behalf of downstream issue:
https://github.com/ziglang/zig/issues/3271
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.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190920/c9de0872/attachment.html>
More information about the llvm-bugs
mailing list