mirror of
https://github.com/RPCS3/llvm.git
synced 2024-12-14 23:48:56 +00:00
[XRay] Support multiple return instructions in a single basic block
Add a .mir test to catch this case, and fix the xray-instrumentation pass to handle it appropriately. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280192 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
8b6ce0169b
commit
74727ab21e
@ -79,7 +79,6 @@ bool XRayInstrumentation::runOnMachineFunction(MachineFunction &MF) {
|
||||
for (auto &MO : T.operands())
|
||||
MIB.addOperand(MO);
|
||||
Terminators.push_back(&T);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -18,3 +18,35 @@ define i32 @foo() nounwind noinline uwtable "function-instrument"="xray-always"
|
||||
; CHECK-LABEL: Lxray_synthetic_0:
|
||||
; CHECK: .quad .Lxray_sled_0
|
||||
; CHECK: .quad .Lxray_sled_1
|
||||
|
||||
; We test multiple returns in a single function to make sure we're getting all
|
||||
; of them with XRay instrumentation.
|
||||
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-NEXT: nopw 512(%rax,%rax)
|
||||
; CHECK-LABEL: Ltmp1:
|
||||
Test:
|
||||
%cond = icmp eq i32 %i, 0
|
||||
br i1 %cond, label %IsEqual, label %NotEqual
|
||||
IsEqual:
|
||||
ret i32 0
|
||||
; CHECK: .p2align 1, 0x90
|
||||
; CHECK-LABEL: Lxray_sled_3:
|
||||
; CHECK-NEXT: 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-NEXT: nopw %cs:512(%rax,%rax)
|
||||
}
|
||||
; CHECK: .p2align 4, 0x90
|
||||
; CHECK-NEXT: .quad .Lxray_synthetic_1
|
||||
; CHECK-NEXT: .section xray_instr_map,{{.*}}
|
||||
; CHECK-LABEL: Lxray_synthetic_1:
|
||||
; CHECK: .quad .Lxray_sled_2
|
||||
; CHECK: .quad .Lxray_sled_3
|
||||
; CHECK: .quad .Lxray_sled_4
|
||||
|
28
test/CodeGen/X86/xray-multiplerets-in-blocks.mir
Normal file
28
test/CodeGen/X86/xray-multiplerets-in-blocks.mir
Normal file
@ -0,0 +1,28 @@
|
||||
# RUN: llc -run-pass xray-instrumentation -mtriple=x86_64-unknown-linux-gnu -o - %s | FileCheck %s
|
||||
#
|
||||
# Make sure we can handle multiple ret instructions in a single basic block for
|
||||
# XRay.
|
||||
|
||||
--- |
|
||||
|
||||
define i32 @foo() noinline uwtable "function-instrument"="xray-always" {
|
||||
ret i32 0
|
||||
ret i32 1
|
||||
}
|
||||
|
||||
...
|
||||
|
||||
---
|
||||
name: foo
|
||||
tracksRegLiveness: true
|
||||
liveins:
|
||||
- { reg: '%edi'}
|
||||
body: |
|
||||
bb.0:
|
||||
liveins: %edi
|
||||
; CHECK: PATCHABLE_FUNCTION_ENTER
|
||||
RETQ
|
||||
; CHECK-NEXT: PATCHABLE_RET 2508
|
||||
RETQ
|
||||
; CHECK-NEXT: PATCHABLE_RET 2508
|
||||
...
|
Loading…
Reference in New Issue
Block a user