[RegAlloc] Add a complexity limit in growRegion() to cap compilation time.
authorVasileios Porpodas <vporpodas@google.com>
Tue, 1 Mar 2022 06:34:45 +0000 (22:34 -0800)
committerVasileios Porpodas <vporpodas@google.com>
Thu, 3 Mar 2022 19:31:07 +0000 (11:31 -0800)
commit6f9640d6a3d57eaa2d0467d94a7b87963fbe53d7
tree3f39496e9779657bd3f3071f155b92fb7fdb8654
parent34eb15b5c30601085acb0921f5410aafc0389232
[RegAlloc] Add a complexity limit in growRegion() to cap compilation time.

growRegion() does not scale in code with BBs with a very large number of edges.
In such code growRegion() becomes a compile-time bottleneck, consuming 60% of
the total compilation time.
This patch adds a limit to the complexity of growRegion() by incrementing a counter
in each iteration. We bail out once the limit is reached.

Differential Revision: https://reviews.llvm.org/D120752
llvm/lib/CodeGen/RegAllocGreedy.cpp