This is an archive of the discontinued LLVM Phabricator instance.

[NFC][AMDGPU] Small cleanup to R600 CF Finalizer
Needs ReviewPublic

Authored by ldrumm on Aug 29 2023, 7:50 AM.

Details

Reviewers
arsenm
Summary

A static analyzer was getting aggravated about the use of potentially
uninitialized DstMI / SrcMI. I don't think that's possible for the
present case which will only use VTX_INST || TEX_INST instructions - all
having a source and destination register - but it couldn't hurt to
ensure that's invariant.

optional will do the asserting for us.

Diff Detail

Event Timeline

ldrumm created this revision.Aug 29 2023, 7:50 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 29 2023, 7:50 AM
ldrumm requested review of this revision.Aug 29 2023, 7:50 AM
arsenm added inline comments.Aug 29 2023, 11:57 AM
llvm/lib/Target/AMDGPU/R600ControlFlowFinalizer.cpp
268

Should just use Register in place of optional<unsigned>

ldrumm updated this revision to Diff 554656.Aug 30 2023, 3:17 AM

Use Register instead of `optional<unsigned>

ldrumm marked an inline comment as done.Aug 30 2023, 3:17 AM

This now asserts for renamable $t0_xy = VTX_READ_64_eg killed renamable $t0_x, 0, 1

DstMI is set to zero which is apparently an invalid Register

TRI->getMatchingSuperReg(t0_xy, 1, R600_Reg128RegClass) is the culprit returning zero. Is that expected? I see t0_Xy is part of the R600_Reg64 class, but not part of the 128bit register class.

DstMI is set to zero which is apparently an invalid Register

Correct

TRI->getMatchingSuperReg(t0_xy, 1, R600_Reg128RegClass) is the culprit returning zero. Is that expected? I see t0_Xy is part of the R600_Reg64 class, but not part of the 128bit register class.

getMatchingSuperReg should use a subreg index, not a 1? Assuming 1=sub0, Using a 32-bit subregister here with a 64-bit class doesn't make sense to me. It would need to use sub0_sub1. I don't know what getMatchingSuperReg is supposed to do in that case

arsenm added inline comments.Sep 12 2023, 4:19 AM
llvm/lib/Target/AMDGPU/R600ControlFlowFinalizer.cpp
294

is_contained