[PATCH] D106408: Allow rematerialization of virtual reg uses

Stanislav Mekhanoshin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 16 10:11:18 PDT 2021


rampitec added a comment.

In D106408#2946735 <https://reviews.llvm.org/D106408#2946735>, @dmgreen wrote:

> Have you gone through the uses of isTriviallyReMaterializable to check they line up to the new semantics?

I believe I did:

> It looks like it's used in CalcSpillWeight,

Checked, spill weight calculation matches what LiveRangeEdit/RA in general do. Prohibiting vreg uses there did a worse job.

> LiveRangeEdits (you've fixed recently?)

LRE handles it for a long time already, it has a check in the allUsesAvailableAt(). AMDGPU allows vreg uses, also ARM for VCTP. This is already the case.

> MachineLICM (is getting an updated costmodel),

Yes, D107677 <https://reviews.llvm.org/D107677>.

> Register Coalescer,

One corner case was fixed in D106396 <https://reviews.llvm.org/D106396>, otherwise shall work.

> shouldRegionSplitForVirtReg,

Part or RA logic, works.

> WebAssemblyRegStackifty.

Allows rematerialization of CONST_* opcodes only. These have immediate operands and no register uses at all. Should work and does not have any test changes.

> Are they all expected to keep working with the change here?

Overall yes. The only per-requestity is MachineLICM change in the D107677 <https://reviews.llvm.org/D107677> at this point.

> I feel like the new behavior isn't really "Trivial" any more, and it may be worth keeping the old method for trivial cases, which is just the base case plus a virtual reg use check. Essentially MachineLICMBase::isTriviallyReMaterializable from D107677 <https://reviews.llvm.org/D107677>. I'm not sure what to call the new method though, and not sure its worth it if all the uses above are OK as-is.

The uses above are OK as far as I can tell. I can see how that is possible to wrap one method into another, but as usual have problem with names. We already have isRematerializable, isTriviallyRematerializable, and isReallyTriviallyRematerializable. Creating something like isReallyReallyTriviallyRematerializable looks like going down a rabbit hole ;) But I am open to opinions.


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

https://reviews.llvm.org/D106408



More information about the llvm-commits mailing list