diff options
Diffstat (limited to 'llvm/lib/Analysis/ScalarEvolutionExpander.cpp')
-rw-r--r-- | llvm/lib/Analysis/ScalarEvolutionExpander.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/ScalarEvolutionExpander.cpp b/llvm/lib/Analysis/ScalarEvolutionExpander.cpp index 47bdac00ae1..57deddc80d9 100644 --- a/llvm/lib/Analysis/ScalarEvolutionExpander.cpp +++ b/llvm/lib/Analysis/ScalarEvolutionExpander.cpp @@ -1690,8 +1690,13 @@ SCEVExpander::FindValueInExprValueMap(const SCEV *S, // the LCSSA form. for (auto const &VOPair : *Set) { Value *V = VOPair.first; + dbgs() << "found " << *V << "\n"; ConstantInt *Offset = VOPair.second; Instruction *EntInst = nullptr; + if (V && isa<Constant>(V)) + return {V, Offset}; + if (V && isa<Argument>(V)) + return {V, Offset}; if (V && isa<Instruction>(V) && (EntInst = cast<Instruction>(V)) && S->getType() == V->getType() && EntInst->getFunction() == InsertPt->getFunction() && @@ -1702,6 +1707,9 @@ SCEVExpander::FindValueInExprValueMap(const SCEV *S, } } } + if (auto *C = dyn_cast<SCEVConstant>(S)) + return {C->getValue(), nullptr}; + dbgs() << "Reject: " << *S << "\n"; return {nullptr, nullptr}; } |