mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-12-14 11:39:35 +00:00
[Inline] Precommit tests for dead calls and willreturn.
precommit tests for D94106.
This commit is contained in:
parent
095e245e16
commit
d6c763e098
53
llvm/test/Transforms/Inline/dead-calls-willreturn.ll
Normal file
53
llvm/test/Transforms/Inline/dead-calls-willreturn.ll
Normal file
@ -0,0 +1,53 @@
|
||||
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
|
||||
; RUN: opt -inline -S %s | FileCheck %s
|
||||
|
||||
; readnone but may not return according to attributes.
|
||||
define void @readnone_may_not_return() nounwind readnone ssp {
|
||||
; CHECK-LABEL: @readnone_may_not_return(
|
||||
; CHECK-NEXT: entry:
|
||||
; CHECK-NEXT: br label [[WHILE_BODY:%.*]]
|
||||
; CHECK: while.body:
|
||||
; CHECK-NEXT: br label [[WHILE_BODY]]
|
||||
;
|
||||
entry:
|
||||
br label %while.body
|
||||
|
||||
while.body:
|
||||
br label %while.body
|
||||
}
|
||||
|
||||
; readnone and guaranteed to return according to attributes.
|
||||
define void @readnone_willreturn() willreturn nounwind readnone ssp {
|
||||
; CHECK-LABEL: @readnone_willreturn(
|
||||
; CHECK-NEXT: entry:
|
||||
; CHECK-NEXT: ret void
|
||||
;
|
||||
entry:
|
||||
ret void
|
||||
}
|
||||
|
||||
; Make sure the call to @readnone is not treated as dead, because it is not
|
||||
; marked as willreturn.
|
||||
define void @caller_may_not_return() ssp {
|
||||
; CHECK-LABEL: @caller_may_not_return(
|
||||
; CHECK-NEXT: entry:
|
||||
; CHECK-NEXT: ret void
|
||||
;
|
||||
entry:
|
||||
call void @readnone_may_not_return()
|
||||
call void @readnone_willreturn()
|
||||
ret void
|
||||
}
|
||||
|
||||
; @caller_willreturn is marked as willreturn, so all called functions also must
|
||||
; return. All calls are dead.
|
||||
define void @caller_willreturn() ssp willreturn {
|
||||
; CHECK-LABEL: @caller_willreturn(
|
||||
; CHECK-NEXT: entry:
|
||||
; CHECK-NEXT: ret void
|
||||
;
|
||||
entry:
|
||||
call void @readnone_may_not_return()
|
||||
call void @readnone_willreturn()
|
||||
ret void
|
||||
}
|
Loading…
Reference in New Issue
Block a user