Skip to content

Commit 7f740be

Browse files
committed
[BasicAA] Don't assume DT is nonnull
I thought DT is required in BasicAA, but apparently it can be null in unit tests at least. This should fix the ubsan bot failures.
1 parent ff75121 commit 7f740be

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

llvm/lib/Analysis/BasicAliasAnalysis.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -199,12 +199,12 @@ bool SimpleCaptureInfo::isNotCapturedBefore(const Value *Object,
199199
return isNonEscapingLocalObject(Object, &IsCapturedCache);
200200
}
201201

202-
static bool isNotInCycle(const Instruction *I, const DominatorTree &DT,
202+
static bool isNotInCycle(const Instruction *I, const DominatorTree *DT,
203203
const LoopInfo *LI) {
204204
BasicBlock *BB = const_cast<BasicBlock *>(I->getParent());
205205
SmallVector<BasicBlock *> Succs(successors(BB));
206206
return Succs.empty() ||
207-
!isPotentiallyReachableFromMany(Succs, BB, nullptr, &DT, LI);
207+
!isPotentiallyReachableFromMany(Succs, BB, nullptr, DT, LI);
208208
}
209209

210210
bool EarliestEscapeInfo::isNotCapturedBefore(const Value *Object,
@@ -231,7 +231,7 @@ bool EarliestEscapeInfo::isNotCapturedBefore(const Value *Object,
231231
if (I == Iter.first->second) {
232232
if (OrAt)
233233
return false;
234-
return isNotInCycle(I, DT, LI);
234+
return isNotInCycle(I, &DT, LI);
235235
}
236236

237237
return !isPotentiallyReachable(Iter.first->second, I, nullptr, &DT, LI);
@@ -1721,7 +1721,7 @@ bool BasicAAResult::isValueEqualInPotentialCycles(const Value *V,
17211721
if (!Inst || Inst->getParent()->isEntryBlock())
17221722
return true;
17231723

1724-
return isNotInCycle(Inst, *DT, /*LI*/ nullptr);
1724+
return isNotInCycle(Inst, DT, /*LI*/ nullptr);
17251725
}
17261726

17271727
/// Computes the symbolic difference between two de-composed GEPs.

0 commit comments

Comments
 (0)