[LLVMbugs] [Bug 12360] codegen of booleans still not as efficient as gcc's (followup to pr12251)

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Apr 9 09:18:49 PDT 2012


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

Rafael Ávila de Espíndola <rafael.espindola at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED

--- Comment #4 from Rafael Ávila de Espíndola <rafael.espindola at gmail.com> 2012-04-09 11:18:49 CDT ---
With 154322 we still irgen

_Bool foo(_Bool *x)  {
  return *x;
}
int bar(_Bool *x) {
    return foo(x) & 1;
}

to

define zeroext i1 @foo(i8* %x) {
entry:
  %0 = load i8* %x, align 1, !range !0
  %tobool = icmp ne i8 %0, 0
  ret i1 %tobool
}
define i32 @bar(i8* %x) {
entry:
  %call = tail call zeroext i1 @foo(i8* %x)
  %conv = zext i1 %call to i32
  ret i32 %conv
}
!0 = metadata !{i8 0, i8 2}

but at least we codegen that to


foo:
    movb    (%rdi), %al
    ret


bar:
    pushq    %rax
    callq    foo
    movzbl    %al, %eax
    popq    %rdx
    ret

I still think we should be able to remove the sign extensions in the IL, but
that can now wait for 3.2.

-- 
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