profi - a flow-based profile inference algorithm: Part II (out of 3)
authorspupyrev <spupyrev@fb.com>
Thu, 2 Dec 2021 18:19:32 +0000 (10:19 -0800)
committerHongtao Yu <hoy@fb.com>
Thu, 2 Dec 2021 19:04:21 +0000 (11:04 -0800)
commit98dd2f9ed3ddb0a114582d48d48f781d9c80a2da
tree1a5cf8f3389746101e6394a6436d83f6583caeae
parent543924284ff7432f1e2febcbd5b1a171136c4ccd
profi - a flow-based profile inference algorithm: Part II (out of 3)

This is a continuation of D109860.

Traditional flow-based algorithms cannot guarantee that the resulting edge
frequencies correspond to a *connected* flow in the control-flow graph. For
example, for an instance in the attached figure, a flow-based (or any other)
inference algorithm may produce an output in which the hot loop is disconnected
from the entry block (refer to the rightmost graph in the figure). Furthermore,
creating a connected minimum-cost maximum flow is a computationally NP-hard
problem. Hence, we apply a post-processing adjustments to the computed flow
by connecting all isolated flow components ("islands").

This feature helps to keep all blocks with sample counts connected and results
in significant performance wins for some binaries.
{F19077343}

Reviewed By: hoy

Differential Revision: https://reviews.llvm.org/D109903
llvm/lib/Transforms/Utils/SampleProfileInference.cpp
llvm/test/Transforms/SampleProfile/Inputs/profile-inference-islands.prof [new file with mode: 0644]
llvm/test/Transforms/SampleProfile/profile-inference-islands.ll [new file with mode: 0644]