Skip to content

Commit 29b5666

Browse files
committed
[NewGVN] Abort PHIOfOps if singleton PHI is found
Currently we just bypass singleton phis, however we know that in order to create the phi of ops all phis must be in the same block. Therefore if one phi is a singleton then the rest are as well. Differential Revision: https://reviews.llvm.org/D155478
1 parent bc39a7a commit 29b5666

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

llvm/lib/Transforms/Scalar/NewGVN.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2749,10 +2749,10 @@ NewGVN::makePossiblePHIOfOps(Instruction *I,
27492749
return nullptr;
27502750
}
27512751
// No point in doing this for one-operand phis.
2752-
if (OpPHI->getNumOperands() == 1) {
2753-
OpPHI = nullptr;
2754-
continue;
2755-
}
2752+
// Since all PHIs for operands must be in the same block, then they must
2753+
// have the same number of operands so we can just abort.
2754+
if (OpPHI->getNumOperands() == 1)
2755+
return nullptr;
27562756
}
27572757

27582758
if (!OpPHI)

0 commit comments

Comments
 (0)