mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 02:33:06 +01:00
[xray] Honor xray-never function-instrument attribute
function-instrument=xray-never wasn't actually honored before. We were getting lucky that it worked because CodeGenFunction would omit the other xray attributes when a function was annotated with xray_never_instrument. This patch adds proper support. Differential Revision: https://reviews.llvm.org/D89441
This commit is contained in:
parent
6e11fd80e6
commit
cb3e4b9e0e
@ -147,6 +147,10 @@ bool XRayInstrumentation::runOnMachineFunction(MachineFunction &MF) {
|
|||||||
auto InstrAttr = F.getFnAttribute("function-instrument");
|
auto InstrAttr = F.getFnAttribute("function-instrument");
|
||||||
bool AlwaysInstrument = InstrAttr.isStringAttribute() &&
|
bool AlwaysInstrument = InstrAttr.isStringAttribute() &&
|
||||||
InstrAttr.getValueAsString() == "xray-always";
|
InstrAttr.getValueAsString() == "xray-always";
|
||||||
|
bool NeverInstrument = InstrAttr.isStringAttribute() &&
|
||||||
|
InstrAttr.getValueAsString() == "xray-never";
|
||||||
|
if (NeverInstrument && !AlwaysInstrument)
|
||||||
|
return false;
|
||||||
auto ThresholdAttr = F.getFnAttribute("xray-instruction-threshold");
|
auto ThresholdAttr = F.getFnAttribute("xray-instruction-threshold");
|
||||||
auto IgnoreLoopsAttr = F.getFnAttribute("xray-ignore-loops");
|
auto IgnoreLoopsAttr = F.getFnAttribute("xray-ignore-loops");
|
||||||
unsigned int XRayThreshold = 0;
|
unsigned int XRayThreshold = 0;
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
; RUN: llc -filetype=asm -o - -mtriple=aarch64-unknown-linux-gnu < %s | FileCheck %s
|
; RUN: llc -filetype=asm -o - -mtriple=aarch64-unknown-linux-gnu < %s | FileCheck %s
|
||||||
|
|
||||||
define i32 @foo() nounwind noinline uwtable "function-instrument"="xray-always" {
|
define i32 @foo() nounwind noinline uwtable "function-instrument"="xray-always" {
|
||||||
|
; CHECK-LABEL: foo:
|
||||||
; CHECK-LABEL: Lxray_sled_0:
|
; CHECK-LABEL: Lxray_sled_0:
|
||||||
; CHECK-NEXT: b #32
|
; CHECK-NEXT: b #32
|
||||||
; CHECK-NEXT: nop
|
; CHECK-NEXT: nop
|
||||||
@ -24,8 +25,80 @@ define i32 @foo() nounwind noinline uwtable "function-instrument"="xray-always"
|
|||||||
; CHECK-LABEL: Ltmp1:
|
; CHECK-LABEL: Ltmp1:
|
||||||
; CHECK-NEXT: ret
|
; CHECK-NEXT: ret
|
||||||
}
|
}
|
||||||
|
|
||||||
; CHECK-LABEL: xray_instr_map
|
; CHECK-LABEL: xray_instr_map
|
||||||
; CHECK-LABEL: Lxray_sleds_start0
|
; CHECK-LABEL: Lxray_sleds_start0
|
||||||
; CHECK: .xword .Lxray_sled_0
|
; CHECK: .xword .Lxray_sled_0
|
||||||
; CHECK: .xword .Lxray_sled_1
|
; CHECK: .xword .Lxray_sled_1
|
||||||
; CHECK-LABEL: Lxray_sleds_end0
|
; CHECK-LABEL: Lxray_sleds_end0
|
||||||
|
|
||||||
|
define i32 @bar() nounwind noinline uwtable "function-instrument"="xray-never" "function-instrument"="xray-always" {
|
||||||
|
; CHECK-LABEL: bar:
|
||||||
|
; CHECK-LABEL: Lxray_sled_2:
|
||||||
|
; CHECK-NEXT: b #32
|
||||||
|
; CHECK-NEXT: nop
|
||||||
|
; CHECK-NEXT: nop
|
||||||
|
; CHECK-NEXT: nop
|
||||||
|
; CHECK-NEXT: nop
|
||||||
|
; CHECK-NEXT: nop
|
||||||
|
; CHECK-NEXT: nop
|
||||||
|
; CHECK-NEXT: nop
|
||||||
|
; CHECK-LABEL: Ltmp4:
|
||||||
|
ret i32 0
|
||||||
|
; CHECK-LABEL: Lxray_sled_3:
|
||||||
|
; CHECK-NEXT: b #32
|
||||||
|
; CHECK-NEXT: nop
|
||||||
|
; CHECK-NEXT: nop
|
||||||
|
; CHECK-NEXT: nop
|
||||||
|
; CHECK-NEXT: nop
|
||||||
|
; CHECK-NEXT: nop
|
||||||
|
; CHECK-NEXT: nop
|
||||||
|
; CHECK-NEXT: nop
|
||||||
|
; CHECK-LABEL: Ltmp5:
|
||||||
|
; CHECK-NEXT: ret
|
||||||
|
}
|
||||||
|
|
||||||
|
; 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
|
||||||
|
|
||||||
|
define i32 @instrumented() nounwind noinline uwtable "xray-instruction-threshold"="1" {
|
||||||
|
; CHECK-LABEL: instrumented:
|
||||||
|
; CHECK-LABEL: Lxray_sled_4:
|
||||||
|
; CHECK-NEXT: b #32
|
||||||
|
; CHECK-NEXT: nop
|
||||||
|
; CHECK-NEXT: nop
|
||||||
|
; CHECK-NEXT: nop
|
||||||
|
; CHECK-NEXT: nop
|
||||||
|
; CHECK-NEXT: nop
|
||||||
|
; CHECK-NEXT: nop
|
||||||
|
; CHECK-NEXT: nop
|
||||||
|
; CHECK-LABEL: Ltmp8:
|
||||||
|
ret i32 0
|
||||||
|
; CHECK-LABEL: Lxray_sled_5:
|
||||||
|
; CHECK-NEXT: b #32
|
||||||
|
; CHECK-NEXT: nop
|
||||||
|
; CHECK-NEXT: nop
|
||||||
|
; CHECK-NEXT: nop
|
||||||
|
; CHECK-NEXT: nop
|
||||||
|
; CHECK-NEXT: nop
|
||||||
|
; CHECK-NEXT: nop
|
||||||
|
; CHECK-NEXT: nop
|
||||||
|
; CHECK-LABEL: Ltmp9:
|
||||||
|
; CHECK-NEXT: ret
|
||||||
|
}
|
||||||
|
|
||||||
|
; CHECK-LABEL: xray_instr_map
|
||||||
|
; CHECK-LABEL: Lxray_sleds_start2
|
||||||
|
; CHECK: .xword .Lxray_sled_4
|
||||||
|
; CHECK: .xword .Lxray_sled_5
|
||||||
|
; CHECK-LABEL: Lxray_sleds_end2
|
||||||
|
|
||||||
|
define i32 @not_instrumented() nounwind noinline uwtable "xray-instruction-threshold"="1" "function-instrument"="xray-never" {
|
||||||
|
; CHECK-LABEL: not_instrumented
|
||||||
|
; CHECK-NOT: .Lxray_sled_6
|
||||||
|
ret i32 0
|
||||||
|
; CHECK: ret
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user