From 711dec260fc5ad2ec48fe73351bbfb9bd6d843d8 Mon Sep 17 00:00:00 2001 From: Dean Michael Berris Date: Fri, 8 Sep 2017 01:47:56 +0000 Subject: [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 llvm-svn: 312772 --- .../PowerPC/xray-attribute-instrumentation.ll | 44 ++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 llvm/test/CodeGen/PowerPC/xray-attribute-instrumentation.ll (limited to 'llvm/test/CodeGen/PowerPC/xray-attribute-instrumentation.ll') diff --git a/llvm/test/CodeGen/PowerPC/xray-attribute-instrumentation.ll b/llvm/test/CodeGen/PowerPC/xray-attribute-instrumentation.ll new file mode 100644 index 00000000000..3592499a03e --- /dev/null +++ b/llvm/test/CodeGen/PowerPC/xray-attribute-instrumentation.ll @@ -0,0 +1,44 @@ +; RUN: llc -filetype=asm -o - -mtriple=powerpc64le-unknown-linux-gnu < %s | FileCheck %s +; RUN: llc -filetype=asm -o - -mtriple=powerpc64le-unknown-linux-gnu \ +; RUN: -relocation-model=pic < %s | FileCheck %s + +define i32 @foo() 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 +} +; CHECK-LABEL: xray_instr_map,"awo",@progbits,.text,unique,1 +; CHECK: .Lxray_sleds_start0: +; CHECK-NEXT: .quad .Ltmp0 +; CHECK-NEXT: .quad foo +; CHECK-NEXT: .byte 0x00 +; CHECK-NEXT: .byte 0x01 +; CHECK-NEXT: .byte 0x00 +; CHECK-NEXT: .space 13 +; CHECK-NEXT: .quad .Ltmp2 +; CHECK-NEXT: .quad foo +; CHECK-NEXT: .byte 0x01 +; CHECK-NEXT: .byte 0x01 +; CHECK-NEXT: .byte 0x00 +; CHECK-NEXT: .space 13 +; CHECK-NEXT: .Lxray_sleds_end0: +; CHECK-LABEL: xray_fn_idx,"awo",@progbits,.text,unique,1 +; CHECK: .p2align 4 +; CHECK-NEXT: .quad .Lxray_sleds_start0 +; CHECK-NEXT: .quad .Lxray_sleds_end0 +; CHECK-NEXT: .text -- cgit v1.2.3