[llvm] [AMDGPU] Fix RewriteMFMAFormSchedStage (PR #194887)

via llvm-commits llvm-commits at lists.llvm.org
Wed May 13 06:31:18 PDT 2026


xgxanq wrote:

> 1.If the reaching use of the dst is a sub-reg, non-MFMA, and in the same basic block as the dst,
> use one COPY for all same-block uses, placed before the earliest use to minimise the live range of the bridging VGPR.
> 2.Fix region boundary sync when COPY is inserted before a region-boundary MI
> When rewrite() inserts a VGPR COPY before the earliest same-block use,
> or before a cross-block use that happens to be the first MI of a
> scheduling region, the region boundary tracked in DAG.Regions must be
> updated to point to the new COPY.  Previously only the FirstMIToRegion
> side was updated; if the same MI was also the exclusive-end of the
> preceding region (tracked in LastMIToRegion), that stale pointer was
> left behind, causing region boundary corruption on subsequent passes.
> 
> Fix by always checking and updating the LastMIToRegion entry for the
> displaced MI whenever FirstMIToRegion is updated, in all three
> insertion sites inside rewrite().  Apply the same symmetric fix to the
> path that updates LastMIToRegion for the MFMA source COPY.

https://github.com/llvm/llvm-project/pull/194887


More information about the llvm-commits mailing list