summaryrefslogtreecommitdiff
path: root/test/CodeGen/PowerPC/xray-tail-call-sled.ll
diff options
context:
space:
mode:
authorDean Michael Berris <dberris@google.com>2017-09-08 01:47:56 +0000
committerDean Michael Berris <dberris@google.com>2017-09-08 01:47:56 +0000
commitf7f70f7f6c5ff20fab18bab6846b1c56a39d7a2e (patch)
treea7bb904d8f42bdea3da4096608ecd58c3cc12751 /test/CodeGen/PowerPC/xray-tail-call-sled.ll
parent575526c0828d6085078d6d6b65affd458759c12e (diff)
[XRay][CodeGen][PowerPC] Fix tail exit codegen for XRay in PPC
Summary: This fixes code-gen for XRay in PPC. The regression wasn't caught by codegen tests which we add in this change. What happened was the following: - For tail exits, we used to unconditionally prepend the returns/exits with a pseudo-instruction that gets lowered to the instrumentation sled (and leave the actual return/exit instruction as-is). - Changes to the XRay instrumentation pass caused the tail exits to suddenly also emit the tail exit pseudo-instruction, since the check for whether a return instruction was also a call instruction meant it was a tail exit instruction. - None of the tests caught the regression either due to non-existent tests, or the tests being disabled/removed for continuous breakage. This change re-introduces some of the basic tests and verifies that we're back to a state that allows the back-end to generate appropriate XRay instrumented binaries for PPC in the presence of tail exits. Reviewers: echristo, timshen Subscribers: nemanjai, kbarton, llvm-commits Differential Revision: https://reviews.llvm.org/D37570 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@312772 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/PowerPC/xray-tail-call-sled.ll')
-rw-r--r--test/CodeGen/PowerPC/xray-tail-call-sled.ll44
1 files changed, 44 insertions, 0 deletions
diff --git a/test/CodeGen/PowerPC/xray-tail-call-sled.ll b/test/CodeGen/PowerPC/xray-tail-call-sled.ll
new file mode 100644
index 00000000000..e8fe9dbaa45
--- /dev/null
+++ b/test/CodeGen/PowerPC/xray-tail-call-sled.ll
@@ -0,0 +1,44 @@
+; RUN: llc -filetype=asm -o - -mtriple=powerpc64le-unknown-linux-gnu < %s | FileCheck %s
+
+define i32 @callee() nounwind noinline uwtable "function-instrument"="xray-always" {
+; CHECK-LABEL: .Ltmp0:
+; CHECK: b .Ltmp1
+; CHECK-NEXT: nop
+; CHECK-NEXT: std 0, -8(1)
+; CHECK-NEXT: mflr 0
+; CHECK-NEXT: bl __xray_FunctionEntry
+; CHECK-NEXT: nop
+; CHECK-NEXT: mtlr 0
+; CHECK-LABEL: .Ltmp1:
+ ret i32 0
+; CHECK-LABEL: .Ltmp2:
+; CHECK: blr
+; CHECK-NEXT: nop
+; CHECK-NEXT: std 0, -8(1)
+; CHECK-NEXT: mflr 0
+; CHECK-NEXT: bl __xray_FunctionExit
+; CHECK-NEXT: nop
+; CHECK-NEXT: mtlr 0
+}
+
+define i32 @caller() nounwind noinline uwtable "function-instrument"="xray-always" {
+; CHECK-LABEL: .Ltmp3:
+; CHECK: b .Ltmp4
+; CHECK-NEXT: nop
+; CHECK-NEXT: std 0, -8(1)
+; CHECK-NEXT: mflr 0
+; CHECK-NEXT: bl __xray_FunctionEntry
+; CHECK-NEXT: nop
+; CHECK-NEXT: mtlr 0
+; CHECK-LABEL: .Ltmp4:
+ %retval = tail call i32 @callee()
+ ret i32 %retval
+; CHECK-LABEL: .Ltmp5:
+; CHECK: blr
+; CHECK-NEXT: nop
+; CHECK-NEXT: std 0, -8(1)
+; CHECK-NEXT: mflr 0
+; CHECK-NEXT: bl __xray_FunctionExit
+; CHECK-NEXT: nop
+; CHECK-NEXT: mtlr 0
+}