[PATCH] D106408: Allow rematerialization of virtual reg uses

Stanislav Mekhanoshin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 2 09:53:36 PDT 2021


rampitec added a comment.

In D106408#2904058 <https://reviews.llvm.org/D106408#2904058>, @luismarques wrote:

> In D106408#2903678 <https://reviews.llvm.org/D106408#2903678>, @dmgreen wrote:
>
>> Tail predication being awkward aside - do you have performance results for this patch? Something to show it is beneficial to do over a set of benchmarks.
>
> I had earlier benchmarked this patch for an embedded RISC-V system (Ibex simple system). Not a comprehensive set of results at all, but in case it's useful:
>
> - For CoreMark it had negligible size impact. At Oz and Os it had a small performance benefit (+1.17% and +0.178%, respectively). At O2 <https://reviews.llvm.org/owners/package/2/> and O3 <https://reviews.llvm.org/owners/package/3/> the performance difference was negligible (-0.016% and +0.038%, respectively).
> - For Embench it had no performance impact but improved size a bit, overall. The best case was O2 <https://reviews.llvm.org/owners/package/2/>, where the size was overall reduced by 440 bytes, or 0.276%. Most programs of that benchmark suite had minor differences, some positive and some negative, but for picojpeg it shaved up to 384 bytes.
>
> (Raw results here, in a confusing format: https://gist.github.com/luismarques/01948685c6a1d16ab1c1a0229252b0f1. Please ignore the absolute performance values).

Thanks for measuring this!

For AMDGPU target there is no visible change just yet. It will need at least one more patch to make a difference there. The reason is we are doing this for years now because of the custom `isReallyTriviallyReMaterializable` implementation which skips the check for virtual registers. That needs to be updated in a way similar to this patch so we skip MachineLICM hoisting on the grounds that an instruction is rematerializable without a check that rematerialization will really happen. Then I have no means to measure other targets.

That said AMDGPU is a target where any spilling is extremely expensive. Not just expensive like on CPU targets, but way more expensive. What I see as a result of this patch is a decrease of spilling across the board, which must be a good thing even for a less sensitive target. Code size might increase though, which is generally a case with any rematerialization.


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

https://reviews.llvm.org/D106408



More information about the llvm-commits mailing list