Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[IROutliner] Adding support for swift errors in the IROutliner
Since some values can be swift errors, we need to make sure that we correctly propagate the parameter attributes. Tests found at: llvm/test/Transforms/IROutliner/outlining-swift-error.ll Reviewers: jroelofs, paquette Recommit of: 71867ed Differential Revision: https://reviews.llvm.org/D87742
- Loading branch information
1 parent
eeb99c2
commit 30feb93
Showing
2 changed files
with
72 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
; 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 |