[JumpThreading] Put a limit on the PHI nodes when duplicating a BB.
authorUsman Nadeem <mnadeem@quicinc.com>
Mon, 31 Oct 2022 22:08:11 +0000 (15:08 -0700)
committerUsman Nadeem <mnadeem@quicinc.com>
Mon, 31 Oct 2022 22:51:56 +0000 (15:51 -0700)
commit32755786e02083980e177841bda30560dddf7685
treeebab9d92085caa297d70f148d11d045f1d6b2827
parent2a827e4a988b614bc6f70abe00308ceeb50dcd0a
[JumpThreading] Put a limit on the PHI nodes when duplicating a BB.

Do not duplicate a BB if it has a lot of PHI nodes.
If a threadable chain is too long then the number of duplicated PHI nodes
can add up, leading to a substantial increase in compile time when rewriting
the SSA.

Fixes https://github.com/llvm/llvm-project/issues/58203
Differential Revision: https://reviews.llvm.org/D136716

The threshold of 76 in this patch is reasonably high and reduces the compile
time of cldwat2m_macro.f90 in SPEC2017/cam4 from 80+min to <2min.

Change-Id: I153c89a8e0d89b206a5193dc1b908c67e320717e
llvm/lib/Transforms/Scalar/JumpThreading.cpp