File tree Expand file tree Collapse file tree 1 file changed +7
-7
lines changed
llvm/lib/Transforms/Utils Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -1633,13 +1633,13 @@ void SCEVExpander::replaceCongruentIVInc(
16331633 // If this phi has the same width but is more canonical, replace the
16341634 // original with it. As part of the "more canonical" determination,
16351635 // respect a prior decision to use an IV chain.
1636- if (OrigPhi->getType () == Phi->getType () &&
1637- !( ChainedPhis.count (Phi) ||
1638- isExpandedAddRecExprPHI (OrigPhi, OrigInc, L)) &&
1639- (ChainedPhis. count (Phi) ||
1640- isExpandedAddRecExprPHI (Phi, IsomorphicInc, L))) {
1641- std::swap (OrigPhi, Phi );
1642- std::swap (OrigInc, IsomorphicInc);
1636+ if (OrigPhi->getType () == Phi->getType ()) {
1637+ bool Chained = ChainedPhis.contains (Phi);
1638+ if (!(Chained || isExpandedAddRecExprPHI (OrigPhi, OrigInc, L)) &&
1639+ (Chained || isExpandedAddRecExprPHI (Phi, IsomorphicInc, L))) {
1640+ std::swap (OrigPhi, Phi);
1641+ std::swap (OrigInc, IsomorphicInc );
1642+ }
16431643 }
16441644
16451645 // Replacing the congruent phi is sufficient because acyclic
You can’t perform that action at this time.
0 commit comments