1 # RUN: llc -mtriple x86_64-- -verify-machineinstrs -run-pass branch-folder -o - %s | FileCheck %s
3 # Check the TCRETURNdi64cc optimization.
6 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
8 define i64 @test(i64 %arg, i8* %arg1) optsize {
9 %tmp = icmp ult i64 %arg, 100
10 br i1 %tmp, label %1, label %4
12 %tmp3 = icmp ult i64 %arg, 10
13 br i1 %tmp3, label %2, label %3
15 %tmp5 = tail call i64 @f1(i8* %arg1, i64 %arg)
18 %tmp7 = tail call i64 @f2(i8* %arg1, i64 %arg)
24 declare i64 @f1(i8*, i64)
25 declare i64 @f2(i8*, i64)
30 tracksRegLiveness: true
36 successors: %bb.1, %bb.4
40 CMP64ri8 $rax, 99, implicit-def $eflags
41 JCC_1 %bb.4, 7, implicit $eflags
45 ; CHECK-NEXT: successors: %bb.2({{[^)]+}}){{$}}
46 ; CHECK-NEXT: liveins: $rax, $rsi
48 ; CHECK-NEXT: $rdi = COPY $rsi
49 ; CHECK-NEXT: $rsi = COPY $rax
50 ; CHECK-NEXT: CMP64ri8 $rax, 9, implicit-def $eflags
51 ; CHECK-NEXT: TCRETURNdi64cc @f1, 0, 6, csr_64, implicit $rsp, implicit $eflags, implicit $ssp, implicit $rsp, implicit $rdi, implicit $rsi, implicit $rdi, implicit-def $rdi, implicit $hsi, implicit-def $hsi, implicit $sih, implicit-def $sih, implicit $sil, implicit-def $sil, implicit $si, implicit-def $si, implicit $esi, implicit-def $esi, implicit $rsi, implicit-def $rsi, implicit $hdi, implicit-def $hdi, implicit $dih, implicit-def $dih, implicit $dil, implicit-def $dil, implicit $di, implicit-def $di, implicit $edi, implicit-def $edi
54 successors: %bb.2, %bb.3
57 CMP64ri8 $rax, 9, implicit-def $eflags
58 JCC_1 %bb.3, 7, implicit $eflags
67 TCRETURNdi64 @f1, 0, csr_64, implicit $rsp, implicit $rdi, implicit $rsi
70 ; CHECK-NEXT: liveins: $rdi, $rsi
72 ; CHECK-NEXT: TCRETURNdi64 @f2, 0, csr_64, implicit $rsp, implicit $rdi, implicit $rsi
79 TCRETURNdi64 @f2, 0, csr_64, implicit $rsp, implicit $rdi, implicit $rsi
82 dead $eax = MOV32ri 123, implicit-def $rax