aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorManuelJBrito <manuel.brito@tecnico.ulisboa.pt>2023-07-17 16:51:40 +0100
committerManuelJBrito <manuel.brito@tecnico.ulisboa.pt>2023-07-18 10:22:09 +0100
commit29b5666fdbefc3d2f74945f02e939ca670c295b2 (patch)
tree8e43d5faaa8e4dff1868502cd190ce8f24fcff0d
parentbc39a7a5e40860bfdb1c9fe9fd319d33a29a9a8e (diff)
downloadllvm-29b5666fdbefc3d2f74945f02e939ca670c295b2.zip
llvm-29b5666fdbefc3d2f74945f02e939ca670c295b2.tar.gz
llvm-29b5666fdbefc3d2f74945f02e939ca670c295b2.tar.bz2
[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
-rw-r--r--llvm/lib/Transforms/Scalar/NewGVN.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/llvm/lib/Transforms/Scalar/NewGVN.cpp b/llvm/lib/Transforms/Scalar/NewGVN.cpp
index 194a205..1af40e2c 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)