[llvm] 29b5666 - [NewGVN] Abort PHIOfOps if singleton PHI is found
via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 18 02:22:17 PDT 2023
Author: ManuelJBrito
Date: 2023-07-18T10:22:09+01:00
New Revision: 29b5666fdbefc3d2f74945f02e939ca670c295b2
URL: https://github.com/llvm/llvm-project/commit/29b5666fdbefc3d2f74945f02e939ca670c295b2
DIFF: https://github.com/llvm/llvm-project/commit/29b5666fdbefc3d2f74945f02e939ca670c295b2.diff
LOG: [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
Added:
Modified:
llvm/lib/Transforms/Scalar/NewGVN.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Scalar/NewGVN.cpp b/llvm/lib/Transforms/Scalar/NewGVN.cpp
index 194a205368e0ea..1af40e2c4e6295 100644
--- a/llvm/lib/Transforms/Scalar/NewGVN.cpp
+++ b/llvm/lib/Transforms/Scalar/NewGVN.cpp
@@ -2749,10 +2749,10 @@ NewGVN::makePossiblePHIOfOps(Instruction *I,
return nullptr;
}
// No point in doing this for one-operand phis.
- if (OpPHI->getNumOperands() == 1) {
- OpPHI = nullptr;
- continue;
- }
+ // Since all PHIs for operands must be in the same block, then they must
+ // have the same number of operands so we can just abort.
+ if (OpPHI->getNumOperands() == 1)
+ return nullptr;
}
if (!OpPHI)
More information about the llvm-commits
mailing list