-
Notifications
You must be signed in to change notification settings - Fork 745
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[llvm][AArch64] Do not inline a function with different signing schem…
…e. (#80642) If the signing scheme is different that maybe the functions assumes different behaviours and dangerous to inline them without analysing them. This should be a rare case.
- Loading branch information
1 parent
531e8c2
commit 6fae3e7
Showing
4 changed files
with
135 additions
and
8 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
104 changes: 104 additions & 0 deletions
104
llvm/test/Transforms/Inline/inline-sign-return-address.ll
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,104 @@ | ||
; Check the inliner doesn't inline a function with different sign return address schemes. | ||
; RUN: opt < %s -passes=inline -S | FileCheck %s | ||
|
||
define internal void @foo_all() #0 { | ||
ret void | ||
} | ||
|
||
define internal void @foo_nonleaf() #1 { | ||
ret void | ||
} | ||
|
||
define internal void @foo_none() #2 { | ||
ret void | ||
} | ||
|
||
define internal void @foo_lr() #3 { | ||
ret void | ||
} | ||
|
||
define internal void @foo_bkey() #4 { | ||
ret void | ||
} | ||
|
||
define dso_local void @bar_all() #0 { | ||
; CHECK-LABEL: bar_all | ||
; CHECK-NOT: call void @foo_all() | ||
; CHECK-NEXT: call void @foo_nonleaf() | ||
; CHECK-NEXT: call void @foo_none() | ||
; CHECK-NEXT: call void @foo_lr() | ||
; CHECK-NEXT: call void @foo_bkey() | ||
call void @foo_all() | ||
call void @foo_nonleaf() | ||
call void @foo_none() | ||
call void @foo_lr() | ||
call void @foo_bkey() | ||
ret void | ||
} | ||
|
||
define dso_local void @bar_nonleaf() #1 { | ||
; CHECK-LABEL: bar_nonleaf | ||
; CHECK-NEXT: call void @foo_all() | ||
; CHECK-NOT: call void @foo_nonleaf() | ||
; CHECK-NEXT: call void @foo_none() | ||
; CHECK-NEXT: call void @foo_lr() | ||
; CHECK-NEXT: call void @foo_bkey() | ||
call void @foo_all() | ||
call void @foo_nonleaf() | ||
call void @foo_none() | ||
call void @foo_lr() | ||
call void @foo_bkey() | ||
ret void | ||
} | ||
|
||
define dso_local void @bar_none() #2 { | ||
; CHECK-LABEL: bar_none | ||
; CHECK-NEXT: call void @foo_all() | ||
; CHECK-NEXT: call void @foo_nonleaf() | ||
; CHECK-NOT: call void @foo_none() | ||
; CHECK-NEXT: call void @foo_lr() | ||
; CHECK-NEXT: call void @foo_bkey() | ||
call void @foo_all() | ||
call void @foo_nonleaf() | ||
call void @foo_none() | ||
call void @foo_lr() | ||
call void @foo_bkey() | ||
ret void | ||
} | ||
|
||
define dso_local void @bar_lr() #3 { | ||
; CHECK-LABEL: bar_lr | ||
; CHECK-NEXT: call void @foo_all() | ||
; CHECK-NEXT: call void @foo_nonleaf() | ||
; CHECK-NEXT: call void @foo_none() | ||
; CHECK-NOT: call void @foo_lr() | ||
; CHECK-NEXT: call void @foo_bkey() | ||
call void @foo_all() | ||
call void @foo_nonleaf() | ||
call void @foo_none() | ||
call void @foo_lr() | ||
call void @foo_bkey() | ||
ret void | ||
} | ||
|
||
define dso_local void @bar_bkey() #4 { | ||
; CHECK-LABEL: bar_bkey | ||
; CHECK-NEXT: call void @foo_all() | ||
; CHECK-NEXT: call void @foo_nonleaf() | ||
; CHECK-NEXT: call void @foo_none() | ||
; CHECK-NEXT: call void @foo_lr() | ||
; CHECK-NOT: call void @foo_bkey() | ||
call void @foo_all() | ||
call void @foo_nonleaf() | ||
call void @foo_none() | ||
call void @foo_lr() | ||
call void @foo_bkey() | ||
ret void | ||
} | ||
|
||
|
||
attributes #0 = { "branch-protection-pauth-lr"="false" "sign-return-address"="all" } | ||
attributes #1 = { "branch-protection-pauth-lr"="false" "sign-return-address"="non-leaf" } | ||
attributes #2 = { "branch-protection-pauth-lr"="false" "sign-return-address"="none" } | ||
attributes #3 = { "branch-protection-pauth-lr"="true" "sign-return-address"="non-leaf" } | ||
attributes #4 = { "branch-protection-pauth-lr"="true" "sign-return-address"="non-leaf" "sign-return-address-key"="b_key" } |
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