This is an archive of the discontinued LLVM Phabricator instance.

Replace subregister uses when processing tied operands
ClosedPublic

Authored by arsenm on Jul 19 2016, 6:33 PM.

Details

Summary

This was for some reason skipping operands that are subregisters
instead of keeping the same subregister index.

v_movreld_b32 expects src0 to be the subregister of the tied
super register use/def.

e.g.

v_movreld_b32 v0, v9, <imp-def, tied3> v[0:3], <imp-use, tied2> v[0:3]

was being replaced with

v[4:7] = copy v[0:3]
v_movreld_b32 v0, v9, <imp-def, tied3> v[4:7], <imp-use, tied2> v[4:7],

which really writes to v[0:3]

Diff Detail

Event Timeline

arsenm updated this revision to Diff 64626.Jul 19 2016, 6:33 PM
arsenm retitled this revision from to Replace other uses of register when processind tied operands.
arsenm updated this object.
arsenm added a reviewer: MatzeB.
arsenm added a subscriber: llvm-commits.

This looks good to me, but it also needs to cover the "rewrite undef" path, see the test case at https://lists.freedesktop.org/archives/mesa-dev/2016-July/124285.html

What's the status of this change? I just ran into this bug again...

Please see http://paste.ubuntu.com/22949830/ for a test case that gets broken by this.

The issue is that

%vreg8<def,tied3> = V_MAC_F32_e32 1132462080, %vreg3:sub3, %vreg3:sub2<tied0>

becomes

%vreg8<def,tied3> = V_MAC_F32_e32 1132462080, %vreg8:sub3, %vreg8<tied0>

However, something like this change is still required to fix other bugs related to v_morveld/s.

arsenm updated this revision to Diff 67942.Aug 12 2016, 5:03 PM
arsenm retitled this revision from Replace other uses of register when processind tied operands to Replace subregister uses when processing tied operands.
arsenm updated this object.
arsenm edited edge metadata.

There was already code there trying to accomplish the same thing, it was just skipping for subregisters for some reason

Please see http://paste.ubuntu.com/22949830/ for a test case that gets broken by this.

The issue is that

%vreg8<def,tied3> = V_MAC_F32_e32 1132462080, %vreg3:sub3, %vreg3:sub2<tied0>

becomes

%vreg8<def,tied3> = V_MAC_F32_e32 1132462080, %vreg8:sub3, %vreg8<tied0>

However, something like this change is still required to fix other bugs related to v_morveld/s.

This testcase and another related one I found are still broken with this, but I don't

Please see http://paste.ubuntu.com/22949830/ for a test case that gets broken by this.

The issue is that

%vreg8<def,tied3> = V_MAC_F32_e32 1132462080, %vreg3:sub3, %vreg3:sub2<tied0>

becomes

%vreg8<def,tied3> = V_MAC_F32_e32 1132462080, %vreg8:sub3, %vreg8<tied0>

However, something like this change is still required to fix other bugs related to v_morveld/s.

I think the problem with this testcase might instead be SIFoldOperands producing the subreg use on the tied operand. I'm not sure if this necessarily makes sense:
%vreg15<def,tied6> = V_MAC_F32_e64 0, %vreg14<kill>, 0, %vreg11:sub3, 0, %vreg11:sub2<tied0>, 0, 0, %EXEC<imp-use>; VGPR_32:%vreg15,%vreg14 VReg_128:%vreg11

Please see http://paste.ubuntu.com/22949830/ for a test case that gets broken by this.

The issue is that

%vreg8<def,tied3> = V_MAC_F32_e32 1132462080, %vreg3:sub3, %vreg3:sub2<tied0>

becomes

%vreg8<def,tied3> = V_MAC_F32_e32 1132462080, %vreg8:sub3, %vreg8<tied0>

However, something like this change is still required to fix other bugs related to v_morveld/s.

This testcase and another related one I found are still broken with this, but I don't

Please see http://paste.ubuntu.com/22949830/ for a test case that gets broken by this.

The issue is that

%vreg8<def,tied3> = V_MAC_F32_e32 1132462080, %vreg3:sub3, %vreg3:sub2<tied0>

becomes

%vreg8<def,tied3> = V_MAC_F32_e32 1132462080, %vreg8:sub3, %vreg8<tied0>

However, something like this change is still required to fix other bugs related to v_morveld/s.

I think the problem with this testcase might instead be SIFoldOperands producing the subreg use on the tied operand. I'm not sure if this necessarily makes sense:
%vreg15<def,tied6> = V_MAC_F32_e64 0, %vreg14<kill>, 0, %vreg11:sub3, 0, %vreg11:sub2<tied0>, 0, 0, %EXEC<imp-use>; VGPR_32:%vreg15,%vreg14 VReg_128:%vreg11

D23482 solves this. I wonder if it should be a verifier error to have an operand tied with another with different sub reg indices

MatzeB accepted this revision.Aug 25 2016, 11:34 AM
MatzeB edited edge metadata.

LGTM.

This revision is now accepted and ready to land.Aug 25 2016, 11:34 AM
arsenm closed this revision.Aug 25 2016, 11:39 PM

r279804