llvm/llvm/test/CodeGen/X86/no-split-size.ll

; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 2
; RUN: llc < %s -mtriple=x86_64-linux | FileCheck %s

; @foo is optimized for size. Variables %p2, %p3, %p4, %p5 and %p6 are not split
; in cold blocks.

define i64 @foo(ptr %ptr, i64 %p2, i64 %p3, i64 %p4, i64 %p5, i64 %p6) optsize {
; CHECK-LABEL: foo:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    pushq %r15
; CHECK-NEXT:    .cfi_def_cfa_offset 16
; CHECK-NEXT:    pushq %r14
; CHECK-NEXT:    .cfi_def_cfa_offset 24
; CHECK-NEXT:    pushq %r13
; CHECK-NEXT:    .cfi_def_cfa_offset 32
; CHECK-NEXT:    pushq %r12
; CHECK-NEXT:    .cfi_def_cfa_offset 40
; CHECK-NEXT:    pushq %rbx
; CHECK-NEXT:    .cfi_def_cfa_offset 48
; CHECK-NEXT:    .cfi_offset %rbx, -48
; CHECK-NEXT:    .cfi_offset %r12, -40
; CHECK-NEXT:    .cfi_offset %r13, -32
; CHECK-NEXT:    .cfi_offset %r14, -24
; CHECK-NEXT:    .cfi_offset %r15, -16
; CHECK-NEXT:    movq %r9, %r14
; CHECK-NEXT:    movq %r8, %rbx
; CHECK-NEXT:    movq %rcx, %r12
; CHECK-NEXT:    movq %rdx, %r15
; CHECK-NEXT:    movq %rsi, %r13
; CHECK-NEXT:    testq %rdi, %rdi
; CHECK-NEXT:    je .LBB0_1
; CHECK-NEXT:  # %bb.2: # %if.else
; CHECK-NEXT:    testq %r13, %r13
; CHECK-NEXT:    movq %r15, %rax
; CHECK-NEXT:    je .LBB0_3
; CHECK-NEXT:  .LBB0_4: # %if.end
; CHECK-NEXT:    addq %r13, %rax
; CHECK-NEXT:    addq %r12, %r15
; CHECK-NEXT:    addq %rax, %r15
; CHECK-NEXT:    addq %r14, %rbx
; CHECK-NEXT:    addq %r15, %rbx
; CHECK-NEXT:    movq %rbx, %rax
; CHECK-NEXT:    popq %rbx
; CHECK-NEXT:    .cfi_def_cfa_offset 40
; CHECK-NEXT:    popq %r12
; CHECK-NEXT:    .cfi_def_cfa_offset 32
; CHECK-NEXT:    popq %r13
; CHECK-NEXT:    .cfi_def_cfa_offset 24
; CHECK-NEXT:    popq %r14
; CHECK-NEXT:    .cfi_def_cfa_offset 16
; CHECK-NEXT:    popq %r15
; CHECK-NEXT:    .cfi_def_cfa_offset 8
; CHECK-NEXT:    retq
; CHECK-NEXT:  .LBB0_1: # %if.then
; CHECK-NEXT:    .cfi_def_cfa_offset 48
; CHECK-NEXT:    callq bar1@PLT
; CHECK-NEXT:    jmp .LBB0_4
; CHECK-NEXT:  .LBB0_3: # %if.then2
; CHECK-NEXT:    callq bar2@PLT
; CHECK-NEXT:    jmp .LBB0_4
entry:
  %tobool.not = icmp eq ptr %ptr, null
  br i1 %tobool.not, label %if.then, label %if.else, !prof !5

if.then:                                          ; preds = %entry
  %call1 = call i64 @bar1()
  br label %if.end

if.else:
  %cond = icmp eq i64 %p2, 0
  br i1 %cond, label %if.then2, label %if.end, !prof !5

if.then2:
  %call2 = call i64 @bar2()
  br label %if.end

if.end:
  %call = phi i64 [ %call1, %if.then ], [%call2, %if.then2], [ %p3, %if.else ]
  %add1 = add i64 %call, %p2
  %add2 = add i64 %add1, %p3
  %add3 = add i64 %add2, %p4
  %add4 = add i64 %add3, %p5
  %res = add i64 %add4, %p6
  ret i64 %res
}

!5 = !{!"branch_weights", i32 1, i32 2000}

declare i64 @bar1()
declare i64 @bar2()