[PATCH] D146057: [CodeGen] Speedup stack slot sharing during stack coloring (interval overlapping test).

Valery Pykhtin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 14 08:51:13 PDT 2023


vpykhtin created this revision.
vpykhtin added reviewers: arsenm, bcahoon, craig.topper, Nicola.
Herald added subscribers: kosarev, hiraditya, tpr.
Herald added a project: All.
vpykhtin requested review of this revision.
Herald added subscribers: llvm-commits, wdng.
Herald added a project: LLVM.

AMDGPU code with enabled address sanitizer generates tons of stack objects (> 200000 in my testcase) and
takes forever to compile due to the time spent on stack slot sharing.

While LiveRange::overlaps method has logarithmic complexity on the number of segments in the involved
liveranges the problem is that when a new interval is assigned to a used color it's tested against
overlapping every other assigned interval for that color.

Instead I decided to join all assigned intervals for a color into a single interval and this allows to
have logarithmic complexity on the number of segments for the joined interval.

This patch reduced time spent on stack slot coloring pass from 628 to 3 seconds on my testcase.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D146057

Files:
  llvm/lib/CodeGen/StackSlotColoring.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D146057.505124.patch
Type: text/x-patch
Size: 4030 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230314/da1a6f53/attachment.bin>


More information about the llvm-commits mailing list