[PATCH] D48597: [LoopInstSimplify] Discard SCEV if simplification happened.
Roman Lebedev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 26 09:21:07 PDT 2018
lebedev.ri added a comment.
In https://reviews.llvm.org/D48597#1143645, @sanjoy wrote:
> IMO this doesn't seem like an invalidation bug -- SCEV Expander needs to be smarter about dealing with these kinds of simplifications.
Does this sound better?
diff --git a/lib/Analysis/ScalarEvolutionExpander.cpp b/lib/Analysis/ScalarEvolutionExpander.cpp
index f2ce0f4aa86..2058e591a77 100644
--- a/lib/Analysis/ScalarEvolutionExpander.cpp
+++ b/lib/Analysis/ScalarEvolutionExpander.cpp
@@ -1169,8 +1169,10 @@ SCEVExpander::getAddRecExprPHILiterally(const SCEVAddRecExpr *Normalized,
if (!IsMatchingSCEV && !TryNonMatchingSCEV)
continue;
- Instruction *TempIncV =
- cast<Instruction>(PN.getIncomingValueForBlock(LatchBlock));
+ Value* IncomingValue = PN.getIncomingValueForBlock(LatchBlock);
+ if(!isa<Instruction>(IncomingValue))
+ continue;
+ Instruction *TempIncV = cast<Instruction>(IncomingValue);
// Check whether we can reuse this PHI node.
if (LSRMode) {
Repository:
rL LLVM
https://reviews.llvm.org/D48597
More information about the llvm-commits
mailing list