Author: void Date: Sun Aug 3 23:22:44 2014 New Revision: 214684 URL: http://llvm.org/viewvc/llvm-project?rev=214684&view=rev Log: Merging r214423: ------------------------------------------------------------------------ r214423 | hfinkel | 2014-07-31 12:13:38 -0700 (Thu, 31 Jul 2014) | 9 lines
Fix ScalarEvolutionExpander when creating a PHI in a block with duplicate predecessors It seems that when I fixed this, almost exactly a year ago, I did not quite do it correctly. When we have duplicate block predecessors, we can indeed not have different incoming values for the same block, but we *must* have duplicate entries. So, instead of skipping the duplicates, we explicitly add the duplicate incoming values. Fixes PR20442. ------------------------------------------------------------------------ Added: llvm/branches/release_35/test/CodeGen/PowerPC/pr20442.ll - copied unchanged from r214423, llvm/trunk/test/CodeGen/PowerPC/pr20442.ll Modified: llvm/branches/release_35/ (props changed) llvm/branches/release_35/lib/Analysis/ScalarEvolutionExpander.cpp Propchange: llvm/branches/release_35/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Sun Aug 3 23:22:44 2014 @@ -1,3 +1,3 @@ /llvm/branches/Apple/Pertwee:110850,110961 /llvm/branches/type-system-rewrite:133420-134817 -/llvm/trunk:155241,213653,213749,213773,213793,213798,213815,213847,213880,213884,213894-213895,213915,214129,214180,214287,214331,214429,214519 +/llvm/trunk:155241,213653,213749,213773,213793,213798,213815,213847,213880,213884,213894-213895,213915,214129,214180,214287,214331,214423,214429,214519 Modified: llvm/branches/release_35/lib/Analysis/ScalarEvolutionExpander.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_35/lib/Analysis/ScalarEvolutionExpander.cpp?rev=214684&r1=214683&r2=214684&view=diff ============================================================================== --- llvm/branches/release_35/lib/Analysis/ScalarEvolutionExpander.cpp (original) +++ llvm/branches/release_35/lib/Analysis/ScalarEvolutionExpander.cpp Sun Aug 3 23:22:44 2014 @@ -1443,8 +1443,12 @@ Value *SCEVExpander::visitAddRecExpr(con Constant *One = ConstantInt::get(Ty, 1); for (pred_iterator HPI = HPB; HPI != HPE; ++HPI) { BasicBlock *HP = *HPI; - if (!PredSeen.insert(HP)) + if (!PredSeen.insert(HP)) { + // There must be an incoming value for each predecessor, even the + // duplicates! + CanonicalIV->addIncoming(CanonicalIV->getIncomingValueForBlock(HP), HP); continue; + } if (L->contains(HP)) { // Insert a unit add instruction right before the terminator _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-branch-commits