Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[IRSim][IROutliner] Ignoring Musttail Function
Musttail calls require extra handling to properly propagate the calling convention information and tail call information. The outliner does not currently do this, so we ignore call instructions that utilize the swifttailcc and tailcc calling convention as well as functions marked with the attribute musttail. Reviewers: paquette, aschwaighofer Differential Revision: https://reviews.llvm.org/D120733
- Loading branch information
1 parent
66f90fd
commit 1643f01
Showing
6 changed files
with
153 additions
and
4 deletions.
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
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,34 @@ | ||
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --include-generated-funcs | ||
; RUN: opt -S -verify -iroutliner -ir-outlining-no-cost < %s | FileCheck %s | ||
|
||
; Check that we do not outline musttail when swifttaill cc or tailcc | ||
; is not present. | ||
|
||
declare void @musttail() | ||
|
||
define void @f1() { | ||
%a = alloca i32, align 4 | ||
store i32 2, i32* %a, align 4 | ||
musttail call void @musttail() | ||
ret void | ||
} | ||
|
||
define void @f2() { | ||
%a = alloca i32, align 4 | ||
store i32 2, i32* %a, align 4 | ||
musttail call void @musttail() | ||
ret void | ||
} | ||
; CHECK-LABEL: @f1( | ||
; CHECK-NEXT: [[A:%.*]] = alloca i32, align 4 | ||
; CHECK-NEXT: store i32 2, i32* [[A]], align 4 | ||
; CHECK-NEXT: musttail call void @musttail() | ||
; CHECK-NEXT: ret void | ||
; | ||
; | ||
; CHECK-LABEL: @f2( | ||
; CHECK-NEXT: [[A:%.*]] = alloca i32, align 4 | ||
; CHECK-NEXT: store i32 2, i32* [[A]], align 4 | ||
; CHECK-NEXT: musttail call void @musttail() | ||
; CHECK-NEXT: ret void | ||
; |
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,33 @@ | ||
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --include-generated-funcs | ||
; RUN: opt -S -verify -iroutliner -ir-outlining-no-cost < %s | FileCheck %s | ||
|
||
; Check that we do not outline musttail calls when swifttailcc is present. | ||
|
||
declare swifttailcc void @musttail() | ||
|
||
define swifttailcc void @f1() { | ||
%a = alloca i32, align 4 | ||
store i32 2, i32* %a, align 4 | ||
musttail call swifttailcc void @musttail() | ||
ret void | ||
} | ||
|
||
define swifttailcc void @f2() { | ||
%a = alloca i32, align 4 | ||
store i32 2, i32* %a, align 4 | ||
musttail call swifttailcc void @musttail() | ||
ret void | ||
} | ||
; CHECK-LABEL: @f1( | ||
; CHECK-NEXT: [[A:%.*]] = alloca i32, align 4 | ||
; CHECK-NEXT: store i32 2, i32* [[A]], align 4 | ||
; CHECK-NEXT: musttail call swifttailcc void @musttail() | ||
; CHECK-NEXT: ret void | ||
; | ||
; | ||
; CHECK-LABEL: @f2( | ||
; CHECK-NEXT: [[A:%.*]] = alloca i32, align 4 | ||
; CHECK-NEXT: store i32 2, i32* [[A]], align 4 | ||
; CHECK-NEXT: musttail call swifttailcc void @musttail() | ||
; CHECK-NEXT: ret void | ||
; |
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,33 @@ | ||
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --include-generated-funcs | ||
; RUN: opt -S -verify -iroutliner -ir-outlining-no-cost < %s | FileCheck %s | ||
|
||
; Check that we not do outline musttail calls when tailcc is present. | ||
|
||
declare tailcc void @musttail() | ||
|
||
define tailcc void @f1() { | ||
%a = alloca i32, align 4 | ||
store i32 2, i32* %a, align 4 | ||
musttail call tailcc void @musttail() | ||
ret void | ||
} | ||
|
||
define tailcc void @f2() { | ||
%a = alloca i32, align 4 | ||
store i32 2, i32* %a, align 4 | ||
musttail call tailcc void @musttail() | ||
ret void | ||
} | ||
; CHECK-LABEL: @f1( | ||
; CHECK-NEXT: [[A:%.*]] = alloca i32, align 4 | ||
; CHECK-NEXT: store i32 2, i32* [[A]], align 4 | ||
; CHECK-NEXT: musttail call tailcc void @musttail() | ||
; CHECK-NEXT: ret void | ||
; | ||
; | ||
; CHECK-LABEL: @f2( | ||
; CHECK-NEXT: [[A:%.*]] = alloca i32, align 4 | ||
; CHECK-NEXT: store i32 2, i32* [[A]], align 4 | ||
; CHECK-NEXT: musttail call tailcc void @musttail() | ||
; CHECK-NEXT: ret void | ||
; |