[DSE,MemorySSA] Delay PointerMayBeCaptured calls until actually needed.
authorFlorian Hahn <flo@fhahn.com>
Fri, 21 Aug 2020 17:17:00 +0000 (18:17 +0100)
committerFlorian Hahn <flo@fhahn.com>
Mon, 24 Aug 2020 13:05:44 +0000 (14:05 +0100)
commitb99a5eb659c1965fc4f25a3020a358cae298ec5f
treec0c1a32a8e35933a06ce01c6f0d32779791b0a09
parent8048068c3ec55cd5dc20ecf111fe754ba1d25740
[DSE,MemorySSA] Delay PointerMayBeCaptured calls until actually needed.

Avoid computing InvisibleToCallerBefore/AfterRet up front. In most
cases, this information is not really needed. Instead, introduce helper
functions to compute and cache the result on demand.

Notably, this also does not use PointerMayBeCapturedBefore for
isInvisibleToCallerBeforeRet, as it requires the killing MemoryDef as
starting instruction, making the caching ineffective. But it appears the
use of PointerMayBeCapturedBefore has very limited benefits in practice
(e.g. on SPEC2000/SPEC2006/MultiSource there are no binary changes with
-O3 -flto). Refrain from using it for now, to limit-compile-time.

This gives some nice compile-time improvements:
http://llvm-compile-time-tracker.com/compare.php?from=db9345f6810f379a36752dc52caf5230585d0ebd&to=b4d091047e1b8a3d377d200137b79d03aca65663&stat=instructions
llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
llvm/test/Transforms/DeadStoreElimination/MSSA/multiblock-captures.ll