From a7a3de1bcf9c811f174addbe670cd6b52aed58d2 Mon Sep 17 00:00:00 2001 From: Andrew Trick Date: Tue, 22 May 2012 17:39:59 +0000 Subject: LSR fix: add a missing phi check during IV hoisting. Fixes PR12898: SCEVExpander crash. llvm-svn: 157263 --- llvm/lib/Analysis/ScalarEvolutionExpander.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'llvm/lib/Analysis/ScalarEvolutionExpander.cpp') diff --git a/llvm/lib/Analysis/ScalarEvolutionExpander.cpp b/llvm/lib/Analysis/ScalarEvolutionExpander.cpp index 69507be..e7fe672 100644 --- a/llvm/lib/Analysis/ScalarEvolutionExpander.cpp +++ b/llvm/lib/Analysis/ScalarEvolutionExpander.cpp @@ -955,7 +955,8 @@ bool SCEVExpander::hoistIVInc(Instruction *IncV, Instruction *InsertPos) { // InsertPos must itself dominate IncV so that IncV's new position satisfies // its existing users. - if (!SE.DT->dominates(InsertPos->getParent(), IncV->getParent())) + if (isa(InsertPos) + || !SE.DT->dominates(InsertPos->getParent(), IncV->getParent())) return false; // Check that the chain of IV operands leading back to Phi can be hoisted. -- cgit v1.1