1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 2
2 ; RUN: llc < %s -mtriple=x86_64-linux | FileCheck %s
4 ; @foo is optimized for size. Variables %p2, %p3, %p4, %p5 and %p6 are not split
7 define i64 @foo(ptr %ptr, i64 %p2, i64 %p3, i64 %p4, i64 %p5, i64 %p6) optsize {
9 ; CHECK: # %bb.0: # %entry
10 ; CHECK-NEXT: pushq %r15
11 ; CHECK-NEXT: .cfi_def_cfa_offset 16
12 ; CHECK-NEXT: pushq %r14
13 ; CHECK-NEXT: .cfi_def_cfa_offset 24
14 ; CHECK-NEXT: pushq %r13
15 ; CHECK-NEXT: .cfi_def_cfa_offset 32
16 ; CHECK-NEXT: pushq %r12
17 ; CHECK-NEXT: .cfi_def_cfa_offset 40
18 ; CHECK-NEXT: pushq %rbx
19 ; CHECK-NEXT: .cfi_def_cfa_offset 48
20 ; CHECK-NEXT: .cfi_offset %rbx, -48
21 ; CHECK-NEXT: .cfi_offset %r12, -40
22 ; CHECK-NEXT: .cfi_offset %r13, -32
23 ; CHECK-NEXT: .cfi_offset %r14, -24
24 ; CHECK-NEXT: .cfi_offset %r15, -16
25 ; CHECK-NEXT: movq %r9, %r14
26 ; CHECK-NEXT: movq %r8, %rbx
27 ; CHECK-NEXT: movq %rcx, %r12
28 ; CHECK-NEXT: movq %rdx, %r15
29 ; CHECK-NEXT: movq %rsi, %r13
30 ; CHECK-NEXT: testq %rdi, %rdi
31 ; CHECK-NEXT: je .LBB0_1
32 ; CHECK-NEXT: # %bb.2: # %if.else
33 ; CHECK-NEXT: testq %r13, %r13
34 ; CHECK-NEXT: movq %r15, %rax
35 ; CHECK-NEXT: je .LBB0_3
36 ; CHECK-NEXT: .LBB0_4: # %if.end
37 ; CHECK-NEXT: addq %r13, %rax
38 ; CHECK-NEXT: addq %r12, %r15
39 ; CHECK-NEXT: addq %rax, %r15
40 ; CHECK-NEXT: addq %r14, %rbx
41 ; CHECK-NEXT: addq %r15, %rbx
42 ; CHECK-NEXT: movq %rbx, %rax
43 ; CHECK-NEXT: popq %rbx
44 ; CHECK-NEXT: .cfi_def_cfa_offset 40
45 ; CHECK-NEXT: popq %r12
46 ; CHECK-NEXT: .cfi_def_cfa_offset 32
47 ; CHECK-NEXT: popq %r13
48 ; CHECK-NEXT: .cfi_def_cfa_offset 24
49 ; CHECK-NEXT: popq %r14
50 ; CHECK-NEXT: .cfi_def_cfa_offset 16
51 ; CHECK-NEXT: popq %r15
52 ; CHECK-NEXT: .cfi_def_cfa_offset 8
54 ; CHECK-NEXT: .LBB0_1: # %if.then
55 ; CHECK-NEXT: .cfi_def_cfa_offset 48
56 ; CHECK-NEXT: callq bar1@PLT
57 ; CHECK-NEXT: jmp .LBB0_4
58 ; CHECK-NEXT: .LBB0_3: # %if.then2
59 ; CHECK-NEXT: callq bar2@PLT
60 ; CHECK-NEXT: jmp .LBB0_4
62 %tobool.not = icmp eq ptr %ptr, null
63 br i1 %tobool.not, label %if.then, label %if.else, !prof !5
65 if.then: ; preds = %entry
66 %call1 = call i64 @bar1()
70 %cond = icmp eq i64 %p2, 0
71 br i1 %cond, label %if.then2, label %if.end, !prof !5
74 %call2 = call i64 @bar2()
78 %call = phi i64 [ %call1, %if.then ], [%call2, %if.then2], [ %p3, %if.else ]
79 %add1 = add i64 %call, %p2
80 %add2 = add i64 %add1, %p3
81 %add3 = add i64 %add2, %p4
82 %add4 = add i64 %add3, %p5
83 %res = add i64 %add4, %p6
87 !5 = !{!"branch_weights", i32 1, i32 2000}