summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorAndrea Di Biagio <Andrea_DiBiagio@sn.scee.net>2017-04-18 11:27:58 +0000
committerAndrea Di Biagio <Andrea_DiBiagio@sn.scee.net>2017-04-18 11:27:58 +0000
commit517e3fc34ce93cd29913433d3f0a472682b76422 (patch)
tree85c6b57fdc3ed4d1874a0c841c65e6b642c36e82 /llvm/lib
parent3bfe962afa502d7b12c286d6975f7d97f05ad3c3 (diff)
downloadbcm5719-llvm-517e3fc34ce93cd29913433d3f0a472682b76422.tar.gz
bcm5719-llvm-517e3fc34ce93cd29913433d3f0a472682b76422.zip
[SampleProfile] Don't assert when printing the DebugLoc of a branch. NFC.
llvm-svn: 300544
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Transforms/IPO/SampleProfile.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/IPO/SampleProfile.cpp b/llvm/lib/Transforms/IPO/SampleProfile.cpp
index 642d80e6b8a..e755e2bd8f2 100644
--- a/llvm/lib/Transforms/IPO/SampleProfile.cpp
+++ b/llvm/lib/Transforms/IPO/SampleProfile.cpp
@@ -1191,8 +1191,11 @@ void SampleProfileLoader::propagateWeights(Function &F) {
if (!isa<BranchInst>(TI) && !isa<SwitchInst>(TI))
continue;
+ DebugLoc BranchLoc = TI->getDebugLoc();
DEBUG(dbgs() << "\nGetting weights for branch at line "
- << TI->getDebugLoc().getLine() << ".\n");
+ << ((BranchLoc) ? Twine(BranchLoc.getLine())
+ : Twine("<UNKNOWN LOCATION>"))
+ << ".\n");
SmallVector<uint32_t, 4> Weights;
uint32_t MaxWeight = 0;
DebugLoc MaxDestLoc;
@@ -1229,7 +1232,6 @@ void SampleProfileLoader::propagateWeights(Function &F) {
DEBUG(dbgs() << "SUCCESS. Found non-zero weights.\n");
TI->setMetadata(llvm::LLVMContext::MD_prof,
MDB.createBranchWeights(Weights));
- DebugLoc BranchLoc = TI->getDebugLoc();
emitOptimizationRemark(
Ctx, DEBUG_TYPE, F, MaxDestLoc,
Twine("most popular destination for conditional branches at ") +
OpenPOWER on IntegriCloud