From a2f652d420ef3023fe105602481f750cbbbf88c5 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Tue, 16 Mar 2004 19:49:59 +0000 Subject: [PATCH] Do not try to optimize PHI nodes with incredibly high degree. This reduces SCCP time from 615s to 1.49s on a large testcase that has a gigantic switch statement that all of the blocks in the function go to (an intepreter). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12442 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/Scalar/SCCP.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/Transforms/Scalar/SCCP.cpp b/lib/Transforms/Scalar/SCCP.cpp index 26c246df000..75be39704e1 100644 --- a/lib/Transforms/Scalar/SCCP.cpp +++ b/lib/Transforms/Scalar/SCCP.cpp @@ -500,6 +500,13 @@ void SCCP::visitPHINode(PHINode &PN) { return; // Quick exit } + // Super-extra-high-degree PHI nodes are unlikely to ever be marked constant, + // and slow us down a lot. Just mark them overdefined. + if (PN.getNumIncomingValues() > 64) { + markOverdefined(PNIV, &PN); + return; + } + // Look at all of the executable operands of the PHI node. If any of them // are overdefined, the PHI becomes overdefined as well. If they are all // constant, and they agree with each other, the PHI becomes the identical -- 2.34.1