[LLVMbugs] [Bug 9738] New: Missed optimization in clang-generated code loading bool from memory

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sat Apr 16 16:59:41 PDT 2011


http://llvm.org/bugs/show_bug.cgi?id=9738

           Summary: Missed optimization in clang-generated code loading
                    bool from memory
           Product: new-bugs
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: sharparrow1 at yahoo.com
                CC: llvmbugs at cs.uiuc.edu


Testcase:
struct s0 { _Bool x; };
int f0(struct s0 *p) { return p->x; }

clang-generated code:
    movb    (%rdi), %al
    andb    $1, %al
    movzbl    %al, %eax
    ret

gcc-generated code:
    movzbl    (%rdi), %eax
    ret

Forked off of bug 5579, which was becoming a complete mess.  The issue is that
clang loads bools as i8, then truncates them to i1, and there isn't any
indication in the IR that masking the i8 isn't necessary.

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list