This is an archive of the discontinued LLVM Phabricator instance.

[XRay][clang] Introduce -fxray-always-emit-customevents
ClosedPublic

Authored by dberris on Nov 29 2017, 5:51 AM.

Details

Summary

The -fxray-always-emit-customevents flag instructs clang to always emit
the LLVM IR for calls to the __xray_customevent(...) built-in
function. The default behaviour currently respects whether the function
has an [[clang::xray_never_instrument]] attribute, and thus not lower
the appropriate IR code for the custom event built-in.

This change allows users calling through to the
__xray_customevent(...) built-in to always see those calls lowered to
the corresponding LLVM IR to lay down instrumentation points for these
custom event calls.

Using this flag enables us to emit even just the user-provided custom
events even while never instrumenting the start/end of the function
where they appear. This is useful in cases where "phase markers" using
__xray_customevent(...) can have very few instructions, must never be
instrumented when entered/exited.

Diff Detail

Repository
rL LLVM

Event Timeline

dberris created this revision.Nov 29 2017, 5:51 AM
dblaikie accepted this revision.Nov 29 2017, 11:53 AM

Not totally clear to me why this feature is desirable, but assume you've got use cases/reasons :)

clang/lib/Driver/XRayArgs.cpp
32–33 ↗(On Diff #124732)

Not clear to me there's a benefit to having these defined as constants versus using the literal directly - other parts of the driver use literals directly & there's are mostly used just once?

This revision is now accepted and ready to land.Nov 29 2017, 11:53 AM
dberris updated this revision to Diff 124842.Nov 29 2017, 3:50 PM
dberris marked an inline comment as done.
dberris edited the summary of this revision. (Show Details)

Updated description, address review comment(s).

dberris added inline comments.Nov 29 2017, 3:51 PM
clang/lib/Driver/XRayArgs.cpp
32–33 ↗(On Diff #124732)

Good point. I was following the convention used in the SanitizerArgs implementation. I've moved the ones that haven't been repeated in this file in-line instead.

This revision was automatically updated to reflect the committed changes.