[XRay][clang] Emit "never-instrument" attribute
authorDean Michael Berris <dberris@google.com>
Fri, 14 Sep 2018 01:59:12 +0000 (01:59 +0000)
committerDean Michael Berris <dberris@google.com>
Fri, 14 Sep 2018 01:59:12 +0000 (01:59 +0000)
commit05cf44346346c0308396cf59b2c7228b2b3eff30
tree03785a62a5b8f17802bc37c9d380250cb3b903e9
parentd8673901ab8fe5c104196d08b5c44da026f20870
[XRay][clang] Emit "never-instrument" attribute

Summary:
Before this change, we only emit the XRay attributes in LLVM IR when the
-fxray-instrument flag is provided. This may cause issues with thinlto
when the final binary is being built/linked with -fxray-instrument, and
the constitutent LLVM IR gets re-lowered with xray instrumentation.

With this change, we can honour the "never-instrument "attributes
provided in the source code and preserve those in the IR. This way, even
in thinlto builds, we retain the attributes which say whether functions
should never be XRay instrumented.

This change addresses llvm.org/PR38922.

Reviewers: mboerger, eizan

Subscribers: mehdi_amini, dexonsmith, cfe-commits, llvm-commits

Differential Revision: https://reviews.llvm.org/D52015

llvm-svn: 342200
clang/lib/CodeGen/CodeGenFunction.cpp
clang/lib/CodeGen/CodeGenModule.cpp
clang/test/CodeGen/xray-attributes-noxray-supported.cpp [new file with mode: 0644]
clang/test/CodeGen/xray-attributes-supported.cpp
compiler-rt/test/xray/TestCases/Posix/clang-no-xray-instrument.cc [new file with mode: 0644]