diff options
author | Rong Xu <xur@google.com> | 2016-12-02 19:10:29 +0000 |
---|---|---|
committer | Rong Xu <xur@google.com> | 2016-12-02 19:10:29 +0000 |
commit | a5b5745a6239df223d55bbf28e83ac5e65b78f56 (patch) | |
tree | 2c6e1ff9fb8d5299fe72fd9393a130b01bf3f7b5 /llvm/lib/Transforms/Instrumentation/CFGMST.h | |
parent | 5419861a527820cd2f1fe1d10137ead1cd9ff346 (diff) | |
download | bcm5719-llvm-a5b5745a6239df223d55bbf28e83ac5e65b78f56.tar.gz bcm5719-llvm-a5b5745a6239df223d55bbf28e83ac5e65b78f56.zip |
[PGO] Fix PGO use ICE when there are unreachable BBs
For -O0 there might be unreachable BBs, which breaks the assumption that all the
BBs have an auxiliary data structure. In this patch, we add another interface
called findBBInfo() so that a nullptr can be returned for the unreachable BBs
(and the callers can ignore those BBs).
This fixes the bug reported
https://llvm.org/bugs/show_bug.cgi?id=31209
Differential Revision: https://reviews.llvm.org/D27280
llvm-svn: 288528
Diffstat (limited to 'llvm/lib/Transforms/Instrumentation/CFGMST.h')
-rw-r--r-- | llvm/lib/Transforms/Instrumentation/CFGMST.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Instrumentation/CFGMST.h b/llvm/lib/Transforms/Instrumentation/CFGMST.h index 3cd7351cad6..3802f9fbf7d 100644 --- a/llvm/lib/Transforms/Instrumentation/CFGMST.h +++ b/llvm/lib/Transforms/Instrumentation/CFGMST.h @@ -78,6 +78,14 @@ public: return *It->second.get(); } + // Give BB, return the auxiliary information if it's available. + BBInfo *findBBInfo(const BasicBlock *BB) const { + auto It = BBInfos.find(BB); + if (It == BBInfos.end()) + return nullptr; + return It->second.get(); + } + // Traverse the CFG using a stack. Find all the edges and assign the weight. // Edges with large weight will be put into MST first so they are less likely // to be instrumented. |