1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-22 20:43:44 +02:00
llvm-mirror/test/CodeGen/X86/h-registers-3.ll
Matthias Braun 08762f9f1e VirtRegMap: Replace some identity copies with KILL instructions.
An identity COPY like this:
   %AL = COPY %AL, %EAX<imp-def>
has no semantic effect, but encodes liveness information: Further users
of %EAX only depend on this instruction even though it does not define
the full register.

Replace the COPY with a KILL instruction in those cases to maintain this
liveness information. (This reverts a small part of r238588 but this
time adds a comment explaining why a KILL instruction is useful).

llvm-svn: 274952
2016-07-09 00:19:07 +00:00

36 lines
800 B
LLVM

; RUN: llc < %s -mtriple=i686-unknown-linux-gnu | FileCheck %s -check-prefix=X86
; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu | FileCheck %s -check-prefix=X64
; RUN: llc < %s -mtriple=x86_64-linux-gnux32 | FileCheck %s -check-prefix=X32
define zeroext i8 @foo() nounwind ssp {
entry:
%0 = tail call zeroext i16 (...) @bar() nounwind
%1 = lshr i16 %0, 8
%2 = trunc i16 %1 to i8
ret i8 %2
; X86-LABEL: foo
; X86: calll
; X86-NEXT: movb %ah, %al
; X86-NEXT: addl $12, %esp
; X86-NEXT: retl
; X64-LABEL: foo
; X64: callq
; X64-NEXT: # kill
; X64-NEXT: shrl $8, %eax
; X64-NEXT: # kill
; X64-NEXT: popq
; X64-NEXT: retq
; X32-LABEL: foo
; X32: callq
; X32-NEXT: # kill
; X32-NEXT: shrl $8, %eax
; X32-NEXT: # kill
; X32-NEXT: popq
; X32-NEXT: retq
}
declare zeroext i16 @bar(...)