[GCov] Emit memset instead of stores in __llvm_gcov_reset
authorArthur Eubanks <aeubanks@google.com>
Fri, 6 Aug 2021 04:18:53 +0000 (21:18 -0700)
committerArthur Eubanks <aeubanks@google.com>
Fri, 6 Aug 2021 05:40:15 +0000 (22:40 -0700)
commita1b21ed3fb4a9f4b85d8fa29f95c31b737e0840f
treef9bc65cec20f4f67cdccd6950e066b5a1306077b
parentdaab81cda18a1e33aa8973ee34589960b4382f25
[GCov] Emit memset instead of stores in __llvm_gcov_reset

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).

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D107538
llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp
llvm/test/Transforms/GCOVProfiling/reset.ll [new file with mode: 0644]