Reland [GlobalOpt] Preserve CFG analyses
authorArthur Eubanks <aeubanks@google.com>
Sun, 19 Jun 2022 19:20:11 +0000 (12:20 -0700)
committerArthur Eubanks <aeubanks@google.com>
Tue, 21 Jun 2022 16:19:59 +0000 (09:19 -0700)
commitb5db65e0da1748d58b0657b4ffb3a41d7fd58449
treeceff789c8758a2cf4a989c6c71c4b45efe89da9e
parent7c5c4e781b8c4a28e90e06f0a96ccdfbaa3ad433
Reland [GlobalOpt] Preserve CFG analyses

The only place we modify the CFG is when calling
removeUnreachableBlocks(), so insert a callback there which invalidates
analyses for that function (or recomputes DT in the legacy PM).

We may delete functions, make sure to clear analyses for those
functions. (this was missed in the original revision)

Small compile time wins across the board:
https://llvm-compile-time-tracker.com/compare.php?from=f444ea8ce0aaaa5ec1a4129809389da15cc41396&to=698f41f4fc26cbf1006ed5d88e9d658edfc5b749&stat=instructions

Reviewed By: nikic

Differential Revision: https://reviews.llvm.org/D128145
llvm/lib/Transforms/IPO/GlobalOpt.cpp
llvm/test/Transforms/GlobalOpt/analysis-invalidation.ll [new file with mode: 0644]