This is an archive of the discontinued LLVM Phabricator instance.

[GCov] Emit memset instead of stores in __llvm_gcov_reset
ClosedPublic

Authored by aeubanks on Aug 4 2021, 10:47 PM.

Details

Summary

For a very large module, llvm_gcov_reset can become very large.
llvm_gcov_reset previously emitted stores to a bunch of globals in one
huge basic block. MemCpyOpt would turn many of these stores into
memsets, and updating MemorySSA would be extremely slow.

Verified that this makes the compile time of certain files go down
drastically (20min -> 5min).

Diff Detail

Event Timeline

aeubanks created this revision.Aug 4 2021, 10:47 PM
aeubanks requested review of this revision.Aug 4 2021, 10:47 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 4 2021, 10:47 PM

The test does not belong to module-flags.ll :)

D78477 did not add an IR test. Perhaps you need to add a new test file. Add two functions so that memset will be emitted more than once.

aeubanks updated this revision to Diff 364530.Aug 5 2021, 10:13 AM

create new test

rnk added a subscriber: rnk.Aug 5 2021, 1:35 PM

There are pre-commit test suite failures related to gcov, which seem related.

MaskRay added a comment.EditedAug 5 2021, 1:39 PM

(When making a gcov change, ninja check-llvm-transforms-gcovprofiling check-llvm-tools-llvm-cov check-clang-codegen check-profile. These directories have tests.)

aeubanks updated this revision to Diff 364613.Aug 5 2021, 2:18 PM

fix size calculation
(not sure if there's a better way to do this or not)

MaskRay accepted this revision.Aug 5 2021, 9:17 PM

Looks great!

llvm/test/Transforms/GCOVProfiling/reset.ll
35

It is more common to place a synthesized function before metadata nodes.

This revision is now accepted and ready to land.Aug 5 2021, 9:17 PM
aeubanks updated this revision to Diff 364692.Aug 5 2021, 9:20 PM

move test function

Thanks for this fix! Timings look great!