mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-03 11:24:18 +00:00
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@214423 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -1443,8 +1443,12 @@ Value *SCEVExpander::visitAddRecExpr(const SCEVAddRecExpr *S) {
|
||||
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
|
||||
|
Reference in New Issue
Block a user