summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis/LoopAccessAnalysis.cpp
diff options
context:
space:
mode:
authorAdam Nemet <anemet@apple.com>2016-09-21 03:14:20 +0000
committerAdam Nemet <anemet@apple.com>2016-09-21 03:14:20 +0000
commite3cef93727147603667ec33feba64f6de7955818 (patch)
tree42763c354c66b4ffedc7472de70928f8de05d124 /llvm/lib/Analysis/LoopAccessAnalysis.cpp
parent556894fb10b7f8b5fd9690954588be97ce593845 (diff)
downloadbcm5719-llvm-e3cef93727147603667ec33feba64f6de7955818.tar.gz
bcm5719-llvm-e3cef93727147603667ec33feba64f6de7955818.zip
[LV] When reporting about a specific instruction without debug location use loop's
This can occur for example if some optimization drops the debug location. llvm-svn: 282048
Diffstat (limited to 'llvm/lib/Analysis/LoopAccessAnalysis.cpp')
-rw-r--r--llvm/lib/Analysis/LoopAccessAnalysis.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/llvm/lib/Analysis/LoopAccessAnalysis.cpp b/llvm/lib/Analysis/LoopAccessAnalysis.cpp
index 6cf36a82fac..978e7a524df 100644
--- a/llvm/lib/Analysis/LoopAccessAnalysis.cpp
+++ b/llvm/lib/Analysis/LoopAccessAnalysis.cpp
@@ -99,7 +99,10 @@ void LoopAccessReport::emitAnalysis(const LoopAccessReport &Message,
DebugLoc DL = TheLoop->getStartLoc();
const Value *V = TheLoop->getHeader();
if (const Instruction *I = Message.getInstr()) {
- DL = I->getDebugLoc();
+ // If there is no debug location attached to the instruction, revert back to
+ // using the loop's.
+ if (I->getDebugLoc())
+ DL = I->getDebugLoc();
V = I->getParent();
}
ORE.emitOptimizationRemarkAnalysis(PassName, DL, V, Message.str());
OpenPOWER on IntegriCloud