[PGO] Add a threshold for number of critical edges in PGO
authorRong Xu <xur@google.com>
Wed, 2 Nov 2022 17:11:34 +0000 (10:11 -0700)
committerRong Xu <xur@google.com>
Wed, 2 Nov 2022 17:14:04 +0000 (10:14 -0700)
commit8acb881c19270ac487c8fc1d0041bc257d824dd5
treef1d1390c4aa87818fc10df205ffbf2874e7b5546
parentc10a8473f48bca32ef5e8ab78d30e3557e66d431
[PGO] Add a threshold for number of critical edges in PGO

For some auto-generated sources, we have a huge number of critical
edges (like from switch statements). We have seen instance of 183777
critical edges in one function.

After we split the critical edges in PGO instrumentation/profile-use
pass, the CFG is so large that we have compiler time issues in
downstream passes (like in machine CSE and block placement). Here I
add a threshold to skip PGO if the number of critical edges are too
large.

The threshold is large enough so that it will not affect the majority
of PGO compilation.

Also sync the logic for skipping instrumentation and profile-use. I
think this is the correct thing to do.

Differential Revision: https://reviews.llvm.org/D137184
llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
llvm/test/Transforms/PGOProfile/critical-edge-threshold.ll [new file with mode: 0644]