From 52f55639732cffc7615f71d4f7521a19c1db43d8 Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Tue, 2 Mar 2010 01:59:21 +0000 Subject: Non-affine post-inc SCEV expansions have more code which must be emitted after the increment. Make sure the insert position reflects this. This fixes PR6453. llvm-svn: 97537 --- llvm/lib/Analysis/ScalarEvolutionExpander.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'llvm/lib/Analysis/ScalarEvolutionExpander.cpp') diff --git a/llvm/lib/Analysis/ScalarEvolutionExpander.cpp b/llvm/lib/Analysis/ScalarEvolutionExpander.cpp index 9aa8bfb..b6c7ce6 100644 --- a/llvm/lib/Analysis/ScalarEvolutionExpander.cpp +++ b/llvm/lib/Analysis/ScalarEvolutionExpander.cpp @@ -1087,7 +1087,7 @@ Value *SCEVExpander::expand(const SCEV *S) { // If the SCEV is computable at this level, insert it into the header // after the PHIs (and after any other instructions that we've inserted // there) so that it is guaranteed to dominate any user inside the loop. - if (L && S->hasComputableLoopEvolution(L)) + if (L && S->hasComputableLoopEvolution(L) && L != PostIncLoop) InsertPt = L->getHeader()->getFirstNonPHI(); while (isInsertedInstruction(InsertPt)) InsertPt = llvm::next(BasicBlock::iterator(InsertPt)); -- cgit v1.1