aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Analysis/LoopAccessAnalysis.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Analysis/LoopAccessAnalysis.cpp')
-rw-r--r--llvm/lib/Analysis/LoopAccessAnalysis.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/LoopAccessAnalysis.cpp b/llvm/lib/Analysis/LoopAccessAnalysis.cpp
index 8a779ac..245cce2 100644
--- a/llvm/lib/Analysis/LoopAccessAnalysis.cpp
+++ b/llvm/lib/Analysis/LoopAccessAnalysis.cpp
@@ -942,6 +942,22 @@ static void findForkedSCEVs(
ScevList.emplace_back(Scev, !isGuaranteedNotToBeUndefOrPoison(Ptr));
break;
}
+ case Instruction::PHI: {
+ SmallVector<PointerIntPair<const SCEV *, 1, bool>, 2> ChildScevs;
+ // A phi means we've found a forked pointer, but we currently only
+ // support a single phi per pointer so if there's another behind this
+ // then we just bail out and return the generic SCEV.
+ if (I->getNumOperands() == 2) {
+ findForkedSCEVs(SE, L, I->getOperand(0), ChildScevs, Depth);
+ findForkedSCEVs(SE, L, I->getOperand(1), ChildScevs, Depth);
+ }
+ if (ChildScevs.size() == 2) {
+ ScevList.push_back(ChildScevs[0]);
+ ScevList.push_back(ChildScevs[1]);
+ } else
+ ScevList.emplace_back(Scev, !isGuaranteedNotToBeUndefOrPoison(Ptr));
+ break;
+ }
case Instruction::Add:
case Instruction::Sub: {
SmallVector<PointerIntPair<const SCEV *, 1, bool>> LScevs;