summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/IPO/SampleProfile.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/IPO/SampleProfile.cpp b/llvm/lib/Transforms/IPO/SampleProfile.cpp
index f99cc23c918..70c82cc3a59 100644
--- a/llvm/lib/Transforms/IPO/SampleProfile.cpp
+++ b/llvm/lib/Transforms/IPO/SampleProfile.cpp
@@ -253,6 +253,8 @@ unsigned SampleProfileLoader::getBlockWeight(BasicBlock *BB) {
if (InstWeight > Weight)
Weight = InstWeight;
}
+ if (Weight > 0)
+ VisitedBlocks.insert(BB);
Entry.first->second = Weight;
return Weight;
}
@@ -304,8 +306,7 @@ void SampleProfileLoader::findEquivalencesFor(
for (auto *BB2 : Descendants) {
bool IsDomParent = DomTree->dominates(BB2, BB1);
bool IsInSameLoop = LI->getLoopFor(BB1) == LI->getLoopFor(BB2);
- if (BB1 != BB2 && VisitedBlocks.insert(BB2).second && IsDomParent &&
- IsInSameLoop) {
+ if (BB1 != BB2 && IsDomParent && IsInSameLoop) {
EquivalenceClass[BB2] = BB1;
// If BB2 is heavier than BB1, make BB2 have the same weight
OpenPOWER on IntegriCloud