diff options
author | Nikita Popov <npopov@redhat.com> | 2023-11-21 12:22:13 +0100 |
---|---|---|
committer | Nikita Popov <npopov@redhat.com> | 2023-11-21 12:22:13 +0100 |
commit | 7f740be4acddd8acf46796229c46117b735a9be8 (patch) | |
tree | 6e7dbc0cf2518f410ccc01045d0126e545d36349 /llvm/lib/Analysis/BasicAliasAnalysis.cpp | |
parent | ff75121d4b6c5f4023e36a4edd7296a419ed5c04 (diff) | |
download | llvm-7f740be4acddd8acf46796229c46117b735a9be8.zip llvm-7f740be4acddd8acf46796229c46117b735a9be8.tar.gz llvm-7f740be4acddd8acf46796229c46117b735a9be8.tar.bz2 |
[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.
Diffstat (limited to 'llvm/lib/Analysis/BasicAliasAnalysis.cpp')
-rw-r--r-- | llvm/lib/Analysis/BasicAliasAnalysis.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/llvm/lib/Analysis/BasicAliasAnalysis.cpp b/llvm/lib/Analysis/BasicAliasAnalysis.cpp index 476028b..bf766ee 100644 --- a/llvm/lib/Analysis/BasicAliasAnalysis.cpp +++ b/llvm/lib/Analysis/BasicAliasAnalysis.cpp @@ -199,12 +199,12 @@ bool SimpleCaptureInfo::isNotCapturedBefore(const Value *Object, return isNonEscapingLocalObject(Object, &IsCapturedCache); } -static bool isNotInCycle(const Instruction *I, const DominatorTree &DT, +static bool isNotInCycle(const Instruction *I, const DominatorTree *DT, const LoopInfo *LI) { BasicBlock *BB = const_cast<BasicBlock *>(I->getParent()); SmallVector<BasicBlock *> Succs(successors(BB)); return Succs.empty() || - !isPotentiallyReachableFromMany(Succs, BB, nullptr, &DT, LI); + !isPotentiallyReachableFromMany(Succs, BB, nullptr, DT, LI); } bool EarliestEscapeInfo::isNotCapturedBefore(const Value *Object, @@ -231,7 +231,7 @@ bool EarliestEscapeInfo::isNotCapturedBefore(const Value *Object, if (I == Iter.first->second) { if (OrAt) return false; - return isNotInCycle(I, DT, LI); + return isNotInCycle(I, &DT, LI); } return !isPotentiallyReachable(Iter.first->second, I, nullptr, &DT, LI); @@ -1721,7 +1721,7 @@ bool BasicAAResult::isValueEqualInPotentialCycles(const Value *V, if (!Inst || Inst->getParent()->isEntryBlock()) return true; - return isNotInCycle(Inst, *DT, /*LI*/ nullptr); + return isNotInCycle(Inst, DT, /*LI*/ nullptr); } /// Computes the symbolic difference between two de-composed GEPs. |