This is an archive of the discontinued LLVM Phabricator instance.

[GCOVProfiling] don't profile Fn's w/ noprofile attribute
ClosedPublic

Authored by nickdesaulniers on Jun 14 2021, 12:34 PM.

Details

Summary

Similar to D104475, the Linux kernel would like to avoid compiler
generated code in certain functions. The no_profile function
attribute can be used in C to generate the the noprofile fn attr in IR.
Respect that from GCOVProfiling.

Link: https://lore.kernel.org/lkml/CAKwvOdmPTi93n2L0_yQkrzLdmpxzrOR7zggSzonyaw2PGshApw@mail.gmail.com/

Diff Detail

Event Timeline

nickdesaulniers requested review of this revision.Jun 14 2021, 12:34 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 14 2021, 12:34 PM
nickdesaulniers planned changes to this revision.Jun 14 2021, 12:35 PM
nickdesaulniers added a subscriber: samitolvanen.

TODO(Nick): trim down test case further.

MaskRay added inline comments.Jun 14 2021, 1:56 PM
llvm/test/Transforms/GCOVProfiling/noprofile.ll
2

You may use module-flags.ll as a template. It is simple enough.

nickdesaulniers retitled this revision from [WIP][GCOVProfiling] don't profile Fn's w/ noprofile attribute to [GCOVProfiling] don't profile Fn's w/ noprofile attribute.
nickdesaulniers edited the summary of this revision. (Show Details)
  • reduce test case, remove WIP
nickdesaulniers marked an inline comment as done.Jun 17 2021, 4:59 PM
  • refresh utils/update_test_checks.py assertions
nickdesaulniers edited the summary of this revision. (Show Details)Jun 18 2021, 11:20 AM
MaskRay accepted this revision.Jun 18 2021, 12:16 PM
MaskRay added inline comments.
llvm/test/Transforms/GCOVProfiling/noprofile.ll
3

< %s

Add a file-level comment: Test that the noprofile attribute disables profiling.

4

s/#0/noprofile

in-line attributes are usually clearer for testing purpose.

This revision is now accepted and ready to land.Jun 18 2021, 12:16 PM

Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>

We don't use the tag.

nickdesaulniers edited the summary of this revision. (Show Details)Jun 18 2021, 12:26 PM
  • test mods: add comment, remove -o -, in-line noprofile attr
nickdesaulniers marked 2 inline comments as done.Jun 18 2021, 1:58 PM
This revision was landed with ongoing or failed builds.Jun 18 2021, 2:04 PM
This revision was automatically updated to reflect the committed changes.