[MemDep] DBG intrinsics don't impact abort limit for call site dependence analysis
Summary:
Memory dependence analysis no longer counts DbgInfoIntrinsics towards the
limit where to abort the analysis. Before, a bunch of calls to dbg.value
could affect the generated code, meaning that with -g we could generate
different code than without.
Reviewers: chandlerc, Prazek, davide, efriedma
Reviewed By: efriedma
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D39181
llvm-svn: 316551
diff --git a/llvm/lib/Analysis/MemoryDependenceAnalysis.cpp b/llvm/lib/Analysis/MemoryDependenceAnalysis.cpp
index a6ffe20..ba90f1c 100644
--- a/llvm/lib/Analysis/MemoryDependenceAnalysis.cpp
+++ b/llvm/lib/Analysis/MemoryDependenceAnalysis.cpp
@@ -196,14 +196,17 @@
// Walk backwards through the block, looking for dependencies.
while (ScanIt != BB->begin()) {
+ Instruction *Inst = &*--ScanIt;
+ // Debug intrinsics don't cause dependences and should not affect Limit
+ if (isa<DbgInfoIntrinsic>(Inst))
+ continue;
+
// Limit the amount of scanning we do so we don't end up with quadratic
// running time on extreme testcases.
--Limit;
if (!Limit)
return MemDepResult::getUnknown();
- Instruction *Inst = &*--ScanIt;
-
// If this inst is a memory op, get the pointer it accessed
MemoryLocation Loc;
ModRefInfo MR = GetLocation(Inst, Loc, TLI);
@@ -215,9 +218,6 @@
}
if (auto InstCS = CallSite(Inst)) {
- // Debug intrinsics don't cause dependences.
- if (isa<DbgInfoIntrinsic>(Inst))
- continue;
// If these two calls do not interfere, look past it.
switch (AA.getModRefInfo(CS, InstCS)) {
case MRI_NoModRef: