llvm/llvm/test/CodeGen/Generic/addr-sink-call-multi-arg.ll

; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -S -passes='require<profile-summary>,function(codegenprepare)' < %s | FileCheck %s
; REQUIRES: aarch64-registered-target

; Check that we don't give up if unable to sink the first argument.

target triple = "aarch64-linux"

declare void @f(ptr, ptr) cold

define void @g(i1 %c1, ptr %p, i32 %i) {
; CHECK-LABEL: @g(
; CHECK-NEXT:  entry:
; CHECK-NEXT:    [[A0:%.*]] = getelementptr ptr, ptr [[P:%.*]], i32 [[I:%.*]]
; CHECK-NEXT:    br i1 [[C1:%.*]], label [[IF_THEN:%.*]], label [[EXIT:%.*]]
; CHECK:       if.then:
; CHECK-NEXT:    [[SUNKADDR:%.*]] = getelementptr i8, ptr [[P]], i64 32
; CHECK-NEXT:    call void @f(ptr [[A0]], ptr [[SUNKADDR]])
; CHECK-NEXT:    br label [[EXIT]]
; CHECK:       exit:
; CHECK-NEXT:    ret void
;
entry:
  %a0 = getelementptr ptr, ptr %p, i32 %i
  %a1 = getelementptr ptr, ptr %p, i32 4
  br i1 %c1, label %if.then, label %exit

if.then:
  call void @f(ptr %a0, ptr %a1)
  br label %exit

exit:
  ret void
}