aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CodeGenFunction.cpp
diff options
context:
space:
mode:
authorIan Levesque <ianlevesque@fb.com>2020-01-17 13:24:16 -0800
committerShoaib Meenai <smeenai@fb.com>2020-01-17 13:32:24 -0800
commit1d62be244108547558c6d42ddcf2e4a7f3c6dd03 (patch)
tree7a3f11b861fed03556b00191773ce5f37a2929f3 /clang/lib/CodeGen/CodeGenFunction.cpp
parent7628e474a5916ed8a43c015248443f4c03077509 (diff)
downloadllvm-1d62be244108547558c6d42ddcf2e4a7f3c6dd03.zip
llvm-1d62be244108547558c6d42ddcf2e4a7f3c6dd03.tar.gz
llvm-1d62be244108547558c6d42ddcf2e4a7f3c6dd03.tar.bz2
[clang][xray] Add -fxray-ignore-loops option
XRay allows tuning by minimum function size, but also always instruments functions with loops in them. If the minimum function size is set to a large value the loop instrumention ends up causing most functions to be instrumented anyway. This adds a new flag, -fxray-ignore-loops, to disable the loop detection logic. Differential Revision: https://reviews.llvm.org/D72873
Diffstat (limited to 'clang/lib/CodeGen/CodeGenFunction.cpp')
-rw-r--r--clang/lib/CodeGen/CodeGenFunction.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp
index 2bf94f6..75f5c0e 100644
--- a/clang/lib/CodeGen/CodeGenFunction.cpp
+++ b/clang/lib/CodeGen/CodeGenFunction.cpp
@@ -818,6 +818,9 @@ void CodeGenFunction::StartFunction(GlobalDecl GD, QualType RetTy,
Fn->addFnAttr(
"xray-instruction-threshold",
llvm::itostr(CGM.getCodeGenOpts().XRayInstructionThreshold));
+ if (CGM.getCodeGenOpts().XRayIgnoreLoops) {
+ Fn->addFnAttr("xray-ignore-loops");
+ }
}
if (const auto *Attr = D->getAttr<PatchableFunctionEntryAttr>()) {