[PATCH] D15122: AArch64FastISel: Use cbz/cbnz to branch on i1

Tim Northover via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 1 10:54:09 PST 2015


t.p.northover requested changes to this revision.
t.p.northover added a comment.
This revision now requires changes to proceed.

I don't think this is quite right. The i1 content of a register is only the low bit, isn't it? This is most easily seen outside Darwin (we're the only ones that extend incoming paramters in the caller), but I think this gets miscompiled even for us:

  define i32 @foo(i32 %in) {
  entry:
    %val = trunc i32 %in to i1
    br label %do_test
  
  do_test:
    %tst = phi i1 [%val, %entry]
    br i1 %tst, label %true, label %false
  
  true:
  
    ret i32 0
  
  false:
    ret i32 1
  }

So I think we really do need the TBZ for correctness.


Repository:
  rL LLVM

http://reviews.llvm.org/D15122





More information about the llvm-commits mailing list