This is an archive of the discontinued LLVM Phabricator instance.

[XRay][clang] Emit "never-instrument" attribute
ClosedPublic

Authored by dberris on Sep 13 2018, 12:19 AM.

Details

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.

Diff Detail

Repository
rC Clang

Event Timeline

dberris created this revision.Sep 13 2018, 12:19 AM
dberris planned changes to this revision.Sep 13 2018, 1:28 AM

This change is still incomplete -- we should really only convey that the 'never' attribute gets preserved. Otherwise we're going to have to invent a way to communicate to the XRay pass in LLVM that we should ignore the XRay attributes.

dberris updated this revision to Diff 165219.Sep 13 2018, 2:11 AM
dberris added a subscriber: llvm-commits.

Adding an end-to-end test in compiler-rt to ensure that we are not suddenly instrumenting functions that must not be instrumented. Making this a version-locked commit between compiler-rt and clang.

This revision is now accepted and ready to land.Sep 13 2018, 2:12 AM
dberris updated this revision to Diff 165220.Sep 13 2018, 2:13 AM
dberris edited the summary of this revision. (Show Details)

Revise description.

Harbormaster completed remote builds in B22586: Diff 165220.
dberris updated this revision to Diff 165407.Sep 13 2018, 6:49 PM
dberris retitled this revision from [XRay][clang] Always emit XRay attributes for LLVM IR to [XRay][clang] Emit "never-instrument" attribute.

Retitle, add different test case for -fno-xray-instrument.

This revision was automatically updated to reflect the committed changes.