[PATCH] D88499: [NFC][regalloc] Make VirtRegAuxInfo part of allocator state

Mircea Trofin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 29 10:40:17 PDT 2020


mtrofin added a comment.

In D88499#2301230 <https://reviews.llvm.org/D88499#2301230>, @qcolombet wrote:

> Hi,
>
> From the perspective of the caller, this patch exposes some implementation details that I am not sure are worth it.
>
> Put differently, what is the expected benefits of moving VRAI life-time to the allocators?
>
> VRAI are relatively light-weight objects and I wouldn't expect saving on the constructor to bring us any gain. So what are we after here?
>
> Cheers,
> -Quentin

Indeed, it's not a performance issue, I see the motivation may read that way. It's helping with readability around weight calculation. The patch clarifies that the way we calculate weights is a per-allocation algorithm concern - including which normalization function we use. When looking at Greedy, for example, it's easier to read that "weight calculation always happens the same way". My next step would be to then make the normalization a virtual, and have a PBQPVirtRegAuxInfo overriding it.

Finally, as another next step, it simplifies exploring other weight calculation strategies: we make weightCalcHelper virtual, and go from there. Same reasoning as above - in Greedy, for instance, we can then just instantiate the desired VirtRegAuxInfo variant in the one place, rather than chasing all instantiation sites.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D88499/new/

https://reviews.llvm.org/D88499



More information about the llvm-commits mailing list