blob: a6012cdeb329bdf99d6a7b444d01ea59d759114a [file] [log] [blame]
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -S -verify -iroutliner -ir-outlining-no-cost < %s | FileCheck %s
%swift.error = type opaque
define void @outlining_swifterror1(%swift.error** swifterror %err) {
; CHECK-LABEL: @outlining_swifterror1(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[X:%.*]] = alloca i64, align 8
; CHECK-NEXT: call void @outlined_ir_func_0(i64 5, i64* [[X]], %swift.error** swifterror [[ERR:%.*]])
; CHECK-NEXT: ret void
;
entry:
%x = alloca i64
%0 = mul i64 5, 5
%1 = add i64 %0, %0
store i64 %1, i64* %x
%casted = bitcast i64* %x to %swift.error*
store %swift.error* %casted, %swift.error** %err
ret void
}
define void @outlining_swifterror2(%swift.error** swifterror %err) {
; CHECK-LABEL: @outlining_swifterror2(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[X:%.*]] = alloca i64, align 8
; CHECK-NEXT: call void @outlined_ir_func_0(i64 3, i64* [[X]], %swift.error** swifterror [[ERR:%.*]])
; CHECK-NEXT: ret void
;
entry:
%x = alloca i64
%0 = mul i64 3, 3
%1 = add i64 %0, %0
store i64 %1, i64* %x
%casted = bitcast i64* %x to %swift.error*
store %swift.error* %casted, %swift.error** %err
ret void
}
; CHECK: define internal void @outlined_ir_func_0(i64 [[ARG0:%.*]], i64* [[ARG1:%.*]], %swift.error** swifterror [[ARG2:%.*]])
; CHECK: entry_to_outline:
; CHECK-NEXT: [[TMP0:%.*]] = mul i64 [[ARG0]], [[ARG0]]
; CHECK-NEXT: [[TMP1:%.*]] = add i64 [[TMP0]], [[TMP0]]
; CHECK-NEXT: store i64 [[TMP1]], i64* [[ARG1]], align 4
; CHECK-NEXT: %casted = bitcast i64* [[ARG1]] to %swift.error*
; CHECK-NEXT: store %swift.error* %casted, %swift.error** [[ARG2]], align 8
; CHECK-NEXT: br label %entry_after_outline.exitStub