[llvm-bugs] [Bug 36719] New: [GlobalISel] i1 boolean is signed extended to -1

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Mar 13 18:27:41 PDT 2018


            Bug ID: 36719
           Summary: [GlobalISel] i1 boolean is signed extended to -1
           Product: new-bugs
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: mgrang at codeaurora.org
                CC: llvm-bugs at lists.llvm.org

echo "bool a() { return true; }" > a.cpp
clang -x c++ -target aarch64-linux-gnu a.cpp -S -o -

mov     w8, #-1     <-- 1 bit boolean true becomes -1.
mov     w0, w8

This bug is uncovered when GlobalISel is enabled by default at -O0:

I attempted to *fix* this here: https://reviews.llvm.org/D44410. But from the
comments I guess the problem is elsewhere.

Basically, an i1 is sign extended to a -1 in GlobalISel legalization. Instead,
a 1 bit boolean should be zero extended.

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/20180314/c5032d4a/attachment.html>

More information about the llvm-bugs mailing list