summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms
diff options
context:
space:
mode:
authorHans Wennborg <hans@hanshq.net>2018-04-06 10:14:09 +0000
committerHans Wennborg <hans@hanshq.net>2018-04-06 10:14:09 +0000
commitb230c763a4858725b72d193c7d7b3da8e77dea53 (patch)
tree50599c701e88ba47044289637782e5f46ca2403c /llvm/test/Transforms
parentd726d04f4523bbf4d439b436757ad91108484904 (diff)
downloadbcm5719-llvm-b230c763a4858725b72d193c7d7b3da8e77dea53.tar.gz
bcm5719-llvm-b230c763a4858725b72d193c7d7b3da8e77dea53.zip
EntryExitInstrumenter: Handle musttail calls
Inserting instrumentation between a musttail call and ret instruction would create invalid IR. Instead, treat musttail calls as function exits. llvm-svn: 329385
Diffstat (limited to 'llvm/test/Transforms')
-rw-r--r--llvm/test/Transforms/EntryExitInstrumenter/mcount.ll25
1 files changed, 24 insertions, 1 deletions
diff --git a/llvm/test/Transforms/EntryExitInstrumenter/mcount.ll b/llvm/test/Transforms/EntryExitInstrumenter/mcount.ll
index 50e6b1321bb..30483606caf 100644
--- a/llvm/test/Transforms/EntryExitInstrumenter/mcount.ll
+++ b/llvm/test/Transforms/EntryExitInstrumenter/mcount.ll
@@ -44,7 +44,6 @@ entry:
; CHECK-NEXT ret void
}
-attributes #0 = { "instrument-function-entry-inlined"="mcount" "instrument-function-entry"="__cyg_profile_func_enter" "instrument-function-exit"="__cyg_profile_func_exit" }
; The mcount function has many different names.
@@ -78,10 +77,33 @@ define void @f7() #7 { entry: ret void }
; CHECK: call void @__cyg_profile_func_enter_bare
+; Treat musttail calls as terminators; inserting between the musttail call and
+; ret is not allowed.
+declare i32* @tailcallee()
+define i32* @tailcaller() #8 {
+ %1 = musttail call i32* @tailcallee()
+ ret i32* %1
+; CHECK-LABEL: define i32* @tailcaller
+; CHECK: call void @__cyg_profile_func_exit
+; CHECK: musttail call i32* @tailcallee
+; CHECK: ret
+}
+define i8* @tailcaller2() #8 {
+ %1 = musttail call i32* @tailcallee()
+ %2 = bitcast i32* %1 to i8*
+ ret i8* %2
+; CHECK-LABEL: define i8* @tailcaller2
+; CHECK: call void @__cyg_profile_func_exit
+; CHECK: musttail call i32* @tailcallee
+; CHECK: bitcast
+; CHECK: ret
+}
+
; The attributes are "consumed" when the instrumentation is inserted.
; CHECK: attributes
; CHECK-NOT: instrument-function
+attributes #0 = { "instrument-function-entry-inlined"="mcount" "instrument-function-entry"="__cyg_profile_func_enter" "instrument-function-exit"="__cyg_profile_func_exit" }
attributes #1 = { "instrument-function-entry-inlined"=".mcount" }
attributes #2 = { "instrument-function-entry-inlined"="\01__gnu_mcount_nc" }
attributes #3 = { "instrument-function-entry-inlined"="\01_mcount" }
@@ -89,3 +111,4 @@ attributes #4 = { "instrument-function-entry-inlined"="\01mcount" }
attributes #5 = { "instrument-function-entry-inlined"="__mcount" }
attributes #6 = { "instrument-function-entry-inlined"="_mcount" }
attributes #7 = { "instrument-function-entry-inlined"="__cyg_profile_func_enter_bare" }
+attributes #8 = { "instrument-function-exit"="__cyg_profile_func_exit" }
OpenPOWER on IntegriCloud