diff options
author | Dehao Chen <dehao@google.com> | 2015-09-29 17:59:58 +0000 |
---|---|---|
committer | Dehao Chen <dehao@google.com> | 2015-09-29 17:59:58 +0000 |
commit | 410a25aa7a093ee9f6de4d12e1f8aaa1cf9c0e81 (patch) | |
tree | a46051a12eecfecf5af225494f435d878c7a3391 /llvm/lib | |
parent | 2c84b29464ccc4b539cc5b78f0eb4dccd7d9e370 (diff) | |
download | bcm5719-llvm-410a25aa7a093ee9f6de4d12e1f8aaa1cf9c0e81.tar.gz bcm5719-llvm-410a25aa7a093ee9f6de4d12e1f8aaa1cf9c0e81.zip |
http://reviews.llvm.org/D13231
Change lookup functions to const functions.
llvm-svn: 248810
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Transforms/IPO/SampleProfile.cpp | 5 |
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 |