llvm-6502/test/CodeGen/X86/hoist-common.ll
Tim Northover 15983b80a0 X86: use sub-register sequences for MOV*r0 operations
Instead of having a bunch of separate MOV8r0, MOV16r0, ... pseudo-instructions,
it's better to use a single MOV32r0 (which will expand to "xorl %reg, %reg")
and obtain other sizes with EXTRACT_SUBREG and SUBREG_TO_REG. The encoding is
smaller and partial register updates can sometimes be avoided.

Until recently, this sequence was a barrier to rematerialization though. That
should now be fixed so it's an appropriate time to make the change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182928 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-30 13:19:42 +00:00

29 lines
624 B
LLVM

; RUN: llc < %s -mtriple=x86_64-apple-macosx | FileCheck %s
; Common "xorb al, al" instruction in the two successor blocks should be
; moved to the entry block above the test + je.
; rdar://9145558
define zeroext i1 @t(i32 %c) nounwind ssp {
entry:
; CHECK: t:
; CHECK: xorl %eax, %eax
; CHECK: test
; CHECK: je
%tobool = icmp eq i32 %c, 0
br i1 %tobool, label %return, label %if.then
if.then:
; CHECK: callq
%call = tail call zeroext i1 (...)* @foo() nounwind
br label %return
return:
; CHECK: ret
%retval.0 = phi i1 [ %call, %if.then ], [ false, %entry ]
ret i1 %retval.0
}
declare zeroext i1 @foo(...)