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, 2 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/IPO/SampleProfile.cpp b/llvm/lib/Transforms/IPO/SampleProfile.cpp
index 70c82cc3a59..f99cc23c918 100644
--- a/llvm/lib/Transforms/IPO/SampleProfile.cpp
+++ b/llvm/lib/Transforms/IPO/SampleProfile.cpp
@@ -253,8 +253,6 @@ unsigned SampleProfileLoader::getBlockWeight(BasicBlock *BB) {
if (InstWeight > Weight)
Weight = InstWeight;
}
- if (Weight > 0)
- VisitedBlocks.insert(BB);
Entry.first->second = Weight;
return Weight;
}
@@ -306,7 +304,8 @@ void SampleProfileLoader::findEquivalencesFor(
for (auto *BB2 : Descendants) {
bool IsDomParent = DomTree->dominates(BB2, BB1);
bool IsInSameLoop = LI->getLoopFor(BB1) == LI->getLoopFor(BB2);
- if (BB1 != BB2 && IsDomParent && IsInSameLoop) {
+ if (BB1 != BB2 && VisitedBlocks.insert(BB2).second && IsDomParent &&
+ IsInSameLoop) {
EquivalenceClass[BB2] = BB1;
// If BB2 is heavier than BB1, make BB2 have the same weight
OpenPOWER on IntegriCloud