Page MenuHomePhabricator

[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

Unit TestsFailed

TimeTest
2,020 msx64 debian > libFuzzer.libFuzzer::dataflow.test
Script: -- : 'RUN: at line 5'; /var/lib/buildkite-agent/builds/llvm-project/build/./bin/clang --driver-mode=g++ -O2 -gline-tables-only -fsanitize=address -I/var/lib/buildkite-agent/builds/llvm-project/compiler-rt/lib/fuzzer -m64 -c -fno-sanitize=all -fsanitize=dataflow /var/lib/buildkite-agent/builds/llvm-project/compiler-rt/test/fuzzer/../../lib/fuzzer/dataflow/DataFlow.cpp -o /var/lib/buildkite-agent/builds/llvm-project/build/projects/compiler-rt/test/fuzzer/X86_64DefaultLinuxConfig/Output/dataflow.test.tmp-DataFlow.o
119,860 msx64 debian > libFuzzer.libFuzzer::only-some-bytes-fork.test
Script: -- : 'RUN: at line 5'; /var/lib/buildkite-agent/builds/llvm-project/build/./bin/clang --driver-mode=g++ -O2 -gline-tables-only -fsanitize=address -I/var/lib/buildkite-agent/builds/llvm-project/compiler-rt/lib/fuzzer -m64 -c -fno-sanitize=all -fsanitize=dataflow /var/lib/buildkite-agent/builds/llvm-project/compiler-rt/test/fuzzer/../../lib/fuzzer/dataflow/DataFlow.cpp -o /var/lib/buildkite-agent/builds/llvm-project/build/projects/compiler-rt/test/fuzzer/X86_64DefaultLinuxConfig/Output/only-some-bytes-fork.test.tmp-DataFlow.o
8,650 msx64 debian > libFuzzer.libFuzzer::only-some-bytes.test
Script: -- : 'RUN: at line 5'; /var/lib/buildkite-agent/builds/llvm-project/build/./bin/clang --driver-mode=g++ -O2 -gline-tables-only -fsanitize=address -I/var/lib/buildkite-agent/builds/llvm-project/compiler-rt/lib/fuzzer -m64 -c -fno-sanitize=all -fsanitize=dataflow /var/lib/buildkite-agent/builds/llvm-project/compiler-rt/test/fuzzer/../../lib/fuzzer/dataflow/DataFlow.cpp -o /var/lib/buildkite-agent/builds/llvm-project/build/projects/compiler-rt/test/fuzzer/X86_64DefaultLinuxConfig/Output/only-some-bytes.test.tmp-DataFlow.o

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.