[llvm] [Analysis][NFC] Store CallbackVH in vector, not in map (PR #184323)
Alexis Engelke via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 3 03:21:33 PST 2026
aengelke wrote:
Btw: BlockFrequencyInfo and BranchProbabilityInfo are the only analyses that use CallbackVH to detect cases where blocks are deleted instead of requiring passes to explicitly update the analysis. The value handles were introduced to identify cases where BasicBlock pointers were recycles (reused by malloc) and thereby prevent giving out stale information.
I suspect that registering a CallbackVH for *all* basic blocks is rather costly. IMO it makes more sense to have passes update the analyses explicitly when they delete blocks. It would require some changes to these passes, however.
Using an AssertingVH on its own to identify the case above (or generally any case where required updates are omitted) is not really feasible, as it would trigger in a lot of cases where the analysis is invalidated at the end of the pass anyway.
Opinions?
https://github.com/llvm/llvm-project/pull/184323
More information about the llvm-commits
mailing list