diff options
author | Dean Michael Berris <dberris@google.com> | 2017-09-04 05:34:58 +0000 |
---|---|---|
committer | Dean Michael Berris <dberris@google.com> | 2017-09-04 05:34:58 +0000 |
commit | ebc165901682c0d9feb0c4490e5d9ffaee214983 (patch) | |
tree | 9421a06fa958e373674386dfe0ce6cb1def89616 /llvm/test | |
parent | 98a9628b094248c10c1be8cd4bffab74249b61be (diff) | |
download | bcm5719-llvm-ebc165901682c0d9feb0c4490e5d9ffaee214983.tar.gz bcm5719-llvm-ebc165901682c0d9feb0c4490e5d9ffaee214983.zip |
[XRay][CodeGen] Use PIC-friendly code in XRay sleds and remove synthetic references in .text
Summary:
This is a re-roll of D36615 which uses PLT relocations in the back-end
to the call to __xray_CustomEvent() when building in -fPIC and
-fxray-instrument mode.
Reviewers: pcc, djasper, bkramer
Subscribers: sdardis, javed.absar, llvm-commits
Differential Revision: https://reviews.llvm.org/D37373
llvm-svn: 312466
Diffstat (limited to 'llvm/test')
-rw-r--r-- | llvm/test/CodeGen/AArch64/xray-attribute-instrumentation.ll | 4 | ||||
-rw-r--r-- | llvm/test/CodeGen/AArch64/xray-tail-call-sled.ll | 12 | ||||
-rw-r--r-- | llvm/test/CodeGen/ARM/xray-armv6-attribute-instrumentation.ll | 7 | ||||
-rw-r--r-- | llvm/test/CodeGen/ARM/xray-armv7-attribute-instrumentation.ll | 7 | ||||
-rw-r--r-- | llvm/test/CodeGen/Mips/xray-section-group.ll | 4 | ||||
-rw-r--r-- | llvm/test/CodeGen/X86/xray-attribute-instrumentation.ll | 28 | ||||
-rw-r--r-- | llvm/test/CodeGen/X86/xray-custom-log.ll | 25 | ||||
-rw-r--r-- | llvm/test/CodeGen/X86/xray-log-args.ll | 44 | ||||
-rw-r--r-- | llvm/test/CodeGen/X86/xray-loop-detection.ll | 1 | ||||
-rw-r--r-- | llvm/test/CodeGen/X86/xray-section-group.ll | 4 | ||||
-rw-r--r-- | llvm/test/CodeGen/X86/xray-tail-call-sled.ll | 22 |
11 files changed, 73 insertions, 85 deletions
diff --git a/llvm/test/CodeGen/AArch64/xray-attribute-instrumentation.ll b/llvm/test/CodeGen/AArch64/xray-attribute-instrumentation.ll index 5f01c7c8be8..651130414be 100644 --- a/llvm/test/CodeGen/AArch64/xray-attribute-instrumentation.ll +++ b/llvm/test/CodeGen/AArch64/xray-attribute-instrumentation.ll @@ -24,9 +24,7 @@ define i32 @foo() nounwind noinline uwtable "function-instrument"="xray-always" ; CHECK-LABEL: Ltmp1: ; CHECK-NEXT: ret } -; CHECK: .p2align 4 -; CHECK-NEXT: .xword .Lxray_fn_idx_synth_0 -; CHECK-NEXT: .section xray_instr_map,{{.*}} +; CHECK-LABEL: xray_instr_map ; CHECK-LABEL: Lxray_sleds_start0 ; CHECK: .xword .Lxray_sled_0 ; CHECK: .xword .Lxray_sled_1 diff --git a/llvm/test/CodeGen/AArch64/xray-tail-call-sled.ll b/llvm/test/CodeGen/AArch64/xray-tail-call-sled.ll index a7e993b3dba..f966362b805 100644 --- a/llvm/test/CodeGen/AArch64/xray-tail-call-sled.ll +++ b/llvm/test/CodeGen/AArch64/xray-tail-call-sled.ll @@ -27,15 +27,12 @@ define i32 @callee() nounwind noinline uwtable "function-instrument"="xray-alway ; CHECK-LABEL: .Ltmp1:
; CHECK-NEXT: ret
}
-; CHECK: .p2align 4
-; CHECK-NEXT: .xword .Lxray_fn_idx_synth_0
-; CHECK-NEXT: .section xray_instr_map,{{.*}}
+; CHECK-LABEL: xray_instr_map
; CHECK-LABEL: Lxray_sleds_start0:
; CHECK: .xword .Lxray_sled_0
; CHECK: .xword .Lxray_sled_1
; CHECK-LABEL: Lxray_sleds_end0:
-; CHECK: .section xray_fn_idx,{{.*}}
-; CHECK-LABEL: Lxray_fn_idx_synth_0:
+; CHECK-LABEL: xray_fn_idx
; CHECK: .xword .Lxray_sleds_start0
; CHECK-NEXT: .xword .Lxray_sleds_end0
@@ -66,14 +63,11 @@ define i32 @caller() nounwind noinline uwtable "function-instrument"="xray-alway ; CHECK: b callee
ret i32 %retval
}
-; CHECK: .p2align 4
-; CHECK-NEXT: .xword .Lxray_fn_idx_synth_1
-; CHECK-NEXT: .section xray_instr_map,{{.*}}
+; CHECK-LABEL: xray_instr_map
; CHECK-LABEL: Lxray_sleds_start1:
; CHECK: .xword .Lxray_sled_2
; CHECK: .xword .Lxray_sled_3
; CHECK-LABEL: Lxray_sleds_end1:
; CHECK: .section xray_fn_idx,{{.*}}
-; CHECK-LABEL: Lxray_fn_idx_synth_1:
; CHECK: .xword .Lxray_sleds_start1
; CHECK-NEXT: .xword .Lxray_sleds_end1
diff --git a/llvm/test/CodeGen/ARM/xray-armv6-attribute-instrumentation.ll b/llvm/test/CodeGen/ARM/xray-armv6-attribute-instrumentation.ll index 5017de835b5..3cec7cd699a 100644 --- a/llvm/test/CodeGen/ARM/xray-armv6-attribute-instrumentation.ll +++ b/llvm/test/CodeGen/ARM/xray-armv6-attribute-instrumentation.ll @@ -23,14 +23,11 @@ define i32 @foo() nounwind noinline uwtable "function-instrument"="xray-always" ; CHECK-LABEL: Ltmp1: ; CHECK-NEXT: bx lr } -; CHECK: .p2align 4 -; CHECK-NEXT: .long {{.*}}Lxray_fn_idx_synth_0 -; CHECK-NEXT: .section {{.*}}xray_instr_map{{.*}} +; CHECK-LABEL: xray_instr_map ; CHECK-LABEL: Lxray_sleds_start0: ; CHECK: .long {{.*}}Lxray_sled_0 ; CHECK: .long {{.*}}Lxray_sled_1 ; CHECK-LABEL: Lxray_sleds_end0: -; CHECK: .section {{.*}}xray_fn_idx{{.*}} -; CHECK-LABEL: Lxray_fn_idx_synth_0: +; CHECK-LABEL: xray_fn_idx ; CHECK: .long {{.*}}Lxray_sleds_start0 ; CHECK-NEXT: .long {{.*}}Lxray_sleds_end0 diff --git a/llvm/test/CodeGen/ARM/xray-armv7-attribute-instrumentation.ll b/llvm/test/CodeGen/ARM/xray-armv7-attribute-instrumentation.ll index 118c02adeb8..e10746d3300 100644 --- a/llvm/test/CodeGen/ARM/xray-armv7-attribute-instrumentation.ll +++ b/llvm/test/CodeGen/ARM/xray-armv7-attribute-instrumentation.ll @@ -23,15 +23,12 @@ define i32 @foo() nounwind noinline uwtable "function-instrument"="xray-always" ; CHECK-LABEL: Ltmp1: ; CHECK-NEXT: bx lr } -; CHECK: .p2align 4 -; CHECK-NEXT: .long {{.*}}Lxray_fn_idx_synth_0 -; CHECK-NEXT: .section {{.*}}xray_instr_map{{.*}} +; CHECK-LABEL: xray_instr_map ; CHECK-LABEL: Lxray_sleds_start0: ; CHECK: .long {{.*}}Lxray_sled_0 ; CHECK: .long {{.*}}Lxray_sled_1 ; CHECK-LABEL: Lxray_sleds_end0: -; CHECK: .section {{.*}}xray_fn_idx{{.*}} -; CHECK-LABEL: Lxray_fn_idx_synth_0: +; CHECK-LABEL: xray_fn_idx ; CHECK: .long {{.*}}xray_sleds_start0 ; CHECK-NEXT: .long {{.*}}xray_sleds_end0 diff --git a/llvm/test/CodeGen/Mips/xray-section-group.ll b/llvm/test/CodeGen/Mips/xray-section-group.ll index d87f178ec4b..f122215c641 100644 --- a/llvm/test/CodeGen/Mips/xray-section-group.ll +++ b/llvm/test/CodeGen/Mips/xray-section-group.ll @@ -14,7 +14,7 @@ define i32 @foo() nounwind noinline uwtable "function-instrument"="xray-always" { ; CHECK: .section .text.foo,"ax",@progbits ret i32 0 -; CHECK: .section xray_instr_map,"a",@progbits +; CHECK: .section xray_instr_map,"awo",@progbits,.text.foo,unique,1 } ; CHECK-OBJ: Section { @@ -24,7 +24,7 @@ $bar = comdat any define i32 @bar() nounwind noinline uwtable "function-instrument"="xray-always" comdat($bar) { ; CHECK: .section .text.bar,"axG",@progbits,bar,comdat ret i32 1 -; CHECK: .section xray_instr_map,"aG",@progbits,bar,comdat +; CHECK: .section xray_instr_map,"aGwo",@progbits,bar,comdat,.text.bar,unique,2 } ; CHECK-OBJ: Section { diff --git a/llvm/test/CodeGen/X86/xray-attribute-instrumentation.ll b/llvm/test/CodeGen/X86/xray-attribute-instrumentation.ll index 00b45f8d95b..7fa2c0e1180 100644 --- a/llvm/test/CodeGen/X86/xray-attribute-instrumentation.ll +++ b/llvm/test/CodeGen/X86/xray-attribute-instrumentation.ll @@ -1,27 +1,25 @@ ; RUN: llc -filetype=asm -o - -mtriple=x86_64-unknown-linux-gnu < %s | FileCheck %s +; RUN: llc -filetype=asm -o - -mtriple=x86_64-unknown-linux-gnu \ +; RUN: -relocation-model=pic < %s | FileCheck %s ; RUN: llc -filetype=asm -o - -mtriple=x86_64-darwin-unknown < %s | FileCheck %s define i32 @foo() nounwind noinline uwtable "function-instrument"="xray-always" { ; CHECK: .p2align 1, 0x90 ; CHECK-LABEL: Lxray_sled_0: -; CHECK-NEXT: .ascii "\353\t" +; CHECK: .ascii "\353\t" ; CHECK-NEXT: nopw 512(%rax,%rax) -; CHECK-LABEL: Ltmp0: ret i32 0 ; CHECK: .p2align 1, 0x90 ; CHECK-LABEL: Lxray_sled_1: -; CHECK-NEXT: retq +; CHECK: retq ; CHECK-NEXT: nopw %cs:512(%rax,%rax) } -; CHECK: .p2align 4, 0x90 -; CHECK-NEXT: .quad {{.*}}xray_fn_idx_synth_0 -; CHECK-NEXT: .section {{.*}}xray_instr_map +; CHECK-LABEL: xray_instr_map ; CHECK-LABEL: Lxray_sleds_start0: ; CHECK: .quad {{.*}}xray_sled_0 ; CHECK: .quad {{.*}}xray_sled_1 ; CHECK-LABEL: Lxray_sleds_end0: -; CHECK: .section {{.*}}xray_fn_idx -; CHECK-LABEL: Lxray_fn_idx_synth_0: +; CHECK-LABEL: xray_fn_idx ; CHECK: .quad {{.*}}xray_sleds_start0 ; CHECK-NEXT: .quad {{.*}}xray_sleds_end0 @@ -31,9 +29,8 @@ define i32 @foo() nounwind noinline uwtable "function-instrument"="xray-always" define i32 @bar(i32 %i) nounwind noinline uwtable "function-instrument"="xray-always" { ; CHECK: .p2align 1, 0x90 ; CHECK-LABEL: Lxray_sled_2: -; CHECK-NEXT: .ascii "\353\t" +; CHECK: .ascii "\353\t" ; CHECK-NEXT: nopw 512(%rax,%rax) -; CHECK-LABEL: Ltmp1: Test: %cond = icmp eq i32 %i, 0 br i1 %cond, label %IsEqual, label %NotEqual @@ -41,24 +38,21 @@ IsEqual: ret i32 0 ; CHECK: .p2align 1, 0x90 ; CHECK-LABEL: Lxray_sled_3: -; CHECK-NEXT: retq +; CHECK: retq ; CHECK-NEXT: nopw %cs:512(%rax,%rax) NotEqual: ret i32 1 ; CHECK: .p2align 1, 0x90 ; CHECK-LABEL: Lxray_sled_4: -; CHECK-NEXT: retq +; CHECK: retq ; CHECK-NEXT: nopw %cs:512(%rax,%rax) } -; CHECK: .p2align 4, 0x90 -; CHECK-NEXT: .quad {{.*}}xray_fn_idx_synth_1 -; CHECK-NEXT: .section {{.*}}xray_instr_map +; CHECK-LABEL: xray_instr_map ; CHECK-LABEL: Lxray_sleds_start1: ; CHECK: .quad {{.*}}xray_sled_2 ; CHECK: .quad {{.*}}xray_sled_3 ; CHECK: .quad {{.*}}xray_sled_4 ; CHECK-LABEL: Lxray_sleds_end1: -; CHECK: .section {{.*}}xray_fn_idx -; CHECK-LABEL: Lxray_fn_idx_synth_1: +; CHECK-LABEL: xray_fn_idx ; CHECK: .quad {{.*}}xray_sleds_start1 ; CHECK-NEXT: .quad {{.*}}xray_sleds_end1 diff --git a/llvm/test/CodeGen/X86/xray-custom-log.ll b/llvm/test/CodeGen/X86/xray-custom-log.ll index 69fd0f3e9f7..7abf7e29c62 100644 --- a/llvm/test/CodeGen/X86/xray-custom-log.ll +++ b/llvm/test/CodeGen/X86/xray-custom-log.ll @@ -1,4 +1,6 @@ ; RUN: llc -filetype=asm -o - -mtriple=x86_64-unknown-linux-gnu < %s | FileCheck %s +; RUN: llc -filetype=asm -o - -mtriple=x86_64-unknown-linux-gnu \ +; RUN: -relocation-model=pic < %s | FileCheck %s -check-prefix=PIC define i32 @fn() nounwind noinline uwtable "function-instrument"="xray-always" { %eventptr = alloca i8 @@ -7,16 +9,27 @@ define i32 @fn() nounwind noinline uwtable "function-instrument"="xray-always" { %val = load i32, i32* %eventsize call void @llvm.xray.customevent(i8* %eventptr, i32 %val) ; CHECK-LABEL: Lxray_event_sled_0: - ; CHECK-NEXT: .ascii "\353\024 - ; CHECK-NEXT: pushq %rax + ; CHECK: .byte 0xeb, 0x0f + ; CHECK-NEXT: pushq %rdi ; CHECK-NEXT: movq {{.*}}, %rdi + ; CHECK-NEXT: pushq %rsi ; CHECK-NEXT: movq {{.*}}, %rsi - ; CHECK-NEXT: movabsq $__xray_CustomEvent, %rax - ; CHECK-NEXT: callq *%rax - ; CHECK-NEXT: popq %rax + ; CHECK-NEXT: callq __xray_CustomEvent + ; CHECK-NEXT: popq %rsi + ; CHECK-NEXT: popq %rdi + + ; PIC-LABEL: Lxray_event_sled_0: + ; PIC: .byte 0xeb, 0x0f + ; PIC-NEXT: pushq %rdi + ; PIC-NEXT: movq {{.*}}, %rdi + ; PIC-NEXT: pushq %rsi + ; PIC-NEXT: movq {{.*}}, %rsi + ; PIC-NEXT: callq __xray_CustomEvent@PLT + ; PIC-NEXT: popq %rsi + ; PIC-NEXT: popq %rdi ret i32 0 } -; CHECK: .section {{.*}}xray_instr_map +; CHECK-LABEL: xray_instr_map ; CHECK-LABEL: Lxray_sleds_start0: ; CHECK: .quad {{.*}}xray_event_sled_0 diff --git a/llvm/test/CodeGen/X86/xray-log-args.ll b/llvm/test/CodeGen/X86/xray-log-args.ll index 6fe450ac8ad..09d2b10f3d7 100644 --- a/llvm/test/CodeGen/X86/xray-log-args.ll +++ b/llvm/test/CodeGen/X86/xray-log-args.ll @@ -7,29 +7,33 @@ define i32 @callee(i32 %arg) nounwind noinline uwtable "function-instrument"="xr ret i32 %arg } ; CHECK-LABEL: Lxray_sleds_start0: -; CHECK: .quad {{\.?}}Lxray_sled_0 -; CHECK: .quad {{_?}}callee -; CHECK: .byte 3 -; CHECK: .byte 1 -; CHECK: .{{(zero|space)}} 14 -; CHECK: .quad {{\.?}}Lxray_sled_1 -; CHECK: .quad {{_?}}callee -; CHECK: .byte 1 -; CHECK: .byte 1 -; CHECK: .{{(zero|space)}} 14 +; CHECK: .quad {{\.?}}Lxray_sled_0 +; CHECK: .quad {{_?}}callee +; CHECK: .byte 0x03 +; CHECK: .byte 0x01 +; CHECK: .byte 0x00 +; CHECK: .{{(zero|space)}} 13 +; CHECK: .quad {{\.?}}Lxray_sled_1 +; CHECK: .quad {{_?}}callee +; CHECK: .byte 0x01 +; CHECK: .byte 0x01 +; CHECK: .byte 0x00 +; CHECK: .{{(zero|space)}} 13 define i32 @caller(i32 %arg) nounwind noinline uwtable "function-instrument"="xray-always" "xray-log-args"="1" { %retval = tail call i32 @callee(i32 %arg) ret i32 %retval } ; CHECK-LABEL: Lxray_sleds_start1: -; CHECK: .quad {{\.?}}Lxray_sled_2 -; CHECK: .quad {{_?}}caller -; CHECK: .byte 3 -; CHECK: .byte 1 -; CHECK: .{{(zero|space)}} 14 -; CHECK: .quad {{\.?}}Lxray_sled_3 -; CHECK: .quad {{_?}}caller -; CHECK: .byte 2 -; CHECK: .byte 1 -; CHECK: .{{(zero|space)}} 14 +; CHECK: .quad {{\.?}}Lxray_sled_2 +; CHECK: .quad {{_?}}caller +; CHECK: .byte 0x03 +; CHECK: .byte 0x01 +; CHECK: .byte 0x00 +; CHECK: .{{(zero|space)}} 13 +; CHECK: .quad {{\.?}}Lxray_sled_3 +; CHECK: .quad {{_?}}caller +; CHECK: .byte 0x02 +; CHECK: .byte 0x01 +; CHECK: .byte 0x00 +; CHECK: .{{(zero|space)}} 13 diff --git a/llvm/test/CodeGen/X86/xray-loop-detection.ll b/llvm/test/CodeGen/X86/xray-loop-detection.ll index 3cd6b4aa6f8..12904d76770 100644 --- a/llvm/test/CodeGen/X86/xray-loop-detection.ll +++ b/llvm/test/CodeGen/X86/xray-loop-detection.ll @@ -19,5 +19,4 @@ Exit: ; CHECK-LABEL: xray_sled_0: ; CHECK-NEXT: .ascii "\353\t" ; CHECK-NEXT: nopw 512(%rax,%rax) -; CHECK-LABEL: Ltmp0: diff --git a/llvm/test/CodeGen/X86/xray-section-group.ll b/llvm/test/CodeGen/X86/xray-section-group.ll index 7dab8c2ebf7..a4c45a0893e 100644 --- a/llvm/test/CodeGen/X86/xray-section-group.ll +++ b/llvm/test/CodeGen/X86/xray-section-group.ll @@ -5,14 +5,14 @@ define i32 @foo() nounwind noinline uwtable "function-instrument"="xray-always" { ; CHECK: .section .text.foo,"ax",@progbits ret i32 0 -; CHECK: .section xray_instr_map,"a",@progbits +; CHECK: .section xray_instr_map,"awo",@progbits,.text.foo,unique,1 } $bar = comdat any define i32 @bar() nounwind noinline uwtable "function-instrument"="xray-always" comdat($bar) { ; CHECK: .section .text.bar,"axG",@progbits,bar,comdat ret i32 1 -; CHECK: .section xray_instr_map,"aG",@progbits,bar,comdat +; CHECK: .section xray_instr_map,"aGwo",@progbits,bar,comdat,.text.bar,unique,2 } ; CHECK-OBJ: section xray_instr_map: diff --git a/llvm/test/CodeGen/X86/xray-tail-call-sled.ll b/llvm/test/CodeGen/X86/xray-tail-call-sled.ll index c4a973e529f..59ab8ea5995 100644 --- a/llvm/test/CodeGen/X86/xray-tail-call-sled.ll +++ b/llvm/test/CodeGen/X86/xray-tail-call-sled.ll @@ -4,49 +4,41 @@ define i32 @callee() nounwind noinline uwtable "function-instrument"="xray-always" { ; CHECK: .p2align 1, 0x90 ; CHECK-LABEL: Lxray_sled_0: -; CHECK-NEXT: .ascii "\353\t" +; CHECK: .ascii "\353\t" ; CHECK-NEXT: nopw 512(%rax,%rax) -; CHECK-LABEL: Ltmp0: ret i32 0 ; CHECK: .p2align 1, 0x90 ; CHECK-LABEL: Lxray_sled_1: -; CHECK-NEXT: retq +; CHECK: retq ; CHECK-NEXT: nopw %cs:512(%rax,%rax) } -; CHECK: .p2align 4, 0x90 -; CHECK-NEXT: .quad {{.*}}xray_fn_idx_synth_0{{.*}} -; CHECK-NEXT: .section {{.*}}xray_instr_map +; CHECK-LABEL: xray_instr_map ; CHECK-LABEL: Lxray_sleds_start0: ; CHECK: .quad {{.*}}xray_sled_0 ; CHECK: .quad {{.*}}xray_sled_1 ; CHECK-LABEL: Lxray_sleds_end0: -; CHECK-NEXT: .section {{.*}}xray_fn_idx -; CHECK-LABEL: Lxray_fn_idx_synth_0: +; CHECK-LABEL: xray_fn_idx ; CHECK: .quad {{.*}}xray_sleds_start0 ; CHECK-NEXT: .quad {{.*}}xray_sleds_end0 define i32 @caller() nounwind noinline uwtable "function-instrument"="xray-always" { ; CHECK: .p2align 1, 0x90 ; CHECK-LABEL: Lxray_sled_2: -; CHECK-NEXT: .ascii "\353\t" +; CHECK: .ascii "\353\t" ; CHECK-NEXT: nopw 512(%rax,%rax) -; CHECK-LABEL: Ltmp1: ; CHECK: .p2align 1, 0x90 ; CHECK-LABEL: Lxray_sled_3: ; CHECK-NEXT: .ascii "\353\t" ; CHECK-NEXT: nopw 512(%rax,%rax) -; CHECK-LABEL: Ltmp2: %retval = tail call i32 @callee() ; CHECK: jmp {{.*}}callee {{.*}}# TAILCALL ret i32 %retval } -; CHECK: .p2align 4, 0x90 -; CHECK-NEXT: .quad {{.*}}xray_fn_idx_synth_1{{.*}} +; CHECK-LABEL: xray_instr_map ; CHECK-LABEL: Lxray_sleds_start1: ; CHECK: .quad {{.*}}xray_sled_2 ; CHECK: .quad {{.*}}xray_sled_3 ; CHECK-LABEL: Lxray_sleds_end1: -; CHECK: .section {{.*}}xray_fn_idx -; CHECK-LABEL: Lxray_fn_idx_synth_1: +; CHECK-LABEL: xray_fn_idx ; CHECK: .quad {{.*}}xray_sleds_start1 ; CHECK: .quad {{.*}}xray_sleds_end1 |