blob: b02bdc3b57242367853c0c7e97c17767d8202a15 [file] [log] [blame]
; NOTE: Assertions have been autogenerated by utils/
; RUN: opt -S -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-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
%a0 = getelementptr ptr, ptr %p, i32 %i
%a1 = getelementptr ptr, ptr %p, i32 4
br i1 %c1, label %if.then, label %exit
call void @f(ptr %a0, ptr %a1)
br label %exit
ret void