diff options
author | Ian Levesque <ianlevesque@fb.com> | 2020-02-11 13:52:45 -0800 |
---|---|---|
committer | Shoaib Meenai <smeenai@fb.com> | 2020-02-11 14:00:41 -0800 |
commit | 14f870366a93ba0c6311883d900e24339681ba76 (patch) | |
tree | 7faf7a1cb1b63dbceebd3ebb9687a4088fc0d6c5 /clang/lib/CodeGen/CodeGenFunction.cpp | |
parent | 40b2eb353043f4e526575a61b0a90fe06e938db1 (diff) | |
download | llvm-14f870366a93ba0c6311883d900e24339681ba76.zip llvm-14f870366a93ba0c6311883d900e24339681ba76.tar.gz llvm-14f870366a93ba0c6311883d900e24339681ba76.tar.bz2 |
[xray][clang] Always add xray-skip-entry/exit and xray-ignore-loops attrs
The function attributes xray-skip-entry, xray-skip-exit, and
xray-ignore-loops were only being applied if a function had an
xray-instrument attribute, but they should apply if xray is enabled
globally too.
Differential Revision: https://reviews.llvm.org/D73842
Diffstat (limited to 'clang/lib/CodeGen/CodeGenFunction.cpp')
-rw-r--r-- | clang/lib/CodeGen/CodeGenFunction.cpp | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp index af0adc2..b7506b5 100644 --- a/clang/lib/CodeGen/CodeGenFunction.cpp +++ b/clang/lib/CodeGen/CodeGenFunction.cpp @@ -814,23 +814,25 @@ void CodeGenFunction::StartFunction(GlobalDecl GD, QualType RetTy, if (ShouldXRayInstrumentFunction()) Fn->addFnAttr("xray-log-args", llvm::utostr(LogArgs->getArgumentCount())); - if (!CGM.getCodeGenOpts().XRayInstrumentationBundle.has( - XRayInstrKind::FunctionExit)) { - Fn->addFnAttr("xray-skip-exit"); - } - if (!CGM.getCodeGenOpts().XRayInstrumentationBundle.has( - XRayInstrKind::FunctionEntry)) { - Fn->addFnAttr("xray-skip-entry"); - } } } else { if (ShouldXRayInstrumentFunction() && !CGM.imbueXRayAttrs(Fn, Loc)) Fn->addFnAttr( "xray-instruction-threshold", llvm::itostr(CGM.getCodeGenOpts().XRayInstructionThreshold)); - if (CGM.getCodeGenOpts().XRayIgnoreLoops) { + } + + if (ShouldXRayInstrumentFunction()) { + if (CGM.getCodeGenOpts().XRayIgnoreLoops) Fn->addFnAttr("xray-ignore-loops"); - } + + if (!CGM.getCodeGenOpts().XRayInstrumentationBundle.has( + XRayInstrKind::FunctionExit)) + Fn->addFnAttr("xray-skip-exit"); + + if (!CGM.getCodeGenOpts().XRayInstrumentationBundle.has( + XRayInstrKind::FunctionEntry)) + Fn->addFnAttr("xray-skip-entry"); } unsigned Count, Offset; |