[all-commits] [llvm/llvm-project] 3e5173: [BPI] Compile time improvement when erasing blocks...
Teresa Johnson via All-commits
all-commits at lists.llvm.org
Fri Jul 10 16:56:20 PDT 2020
Branch: refs/heads/master
Home: https://github.com/llvm/llvm-project
Commit: 3e5173dbc352317712ca35788333c6e118cbf79c
https://github.com/llvm/llvm-project/commit/3e5173dbc352317712ca35788333c6e118cbf79c
Author: Teresa Johnson <tejohnson at google.com>
Date: 2020-07-10 (Fri, 10 Jul 2020)
Changed paths:
M llvm/lib/Analysis/BranchProbabilityInfo.cpp
Log Message:
-----------
[BPI] Compile time improvement when erasing blocks (NFC)
Summary:
eraseBlock is trying to erase all probability info for the given BB.
This info is stored in a DenseMap organized like so:
using Edge = std::pair<const BasicBlock *, unsigned>;
DenseMap<Edge, BranchProbability> Probs;
where the unsigned in the Edge key is the successor id.
It was walking through every single map entry, checking if the BB in the
key's pair matched the given BB. Much more efficient is to do what
another method (getEdgeProbability) was already doing, which is to walk
the successors of the BB, and simply do a map lookup on the key formed
from each <BB, successor id> pair.
Doing this dropped the overall compile time for a file containing a
very large function by around 32%.
Reviewers: davidxl, xur
Subscribers: llvm-commits, hiraditya
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D83596
More information about the All-commits
mailing list