This is an archive of the discontinued LLVM Phabricator instance.

[PowerPC] Check subregister defines before removing XXMFACC/XXMTACC
AbandonedPublic

Authored by qiucf on Sep 5 2021, 10:22 PM.

Details

Reviewers
nemanjai
shchenz
lkail
stefanp
jsji
Group Reviewers
Restricted Project

Diff Detail

Event Timeline

qiucf created this revision.Sep 5 2021, 10:22 PM
qiucf requested review of this revision.Sep 5 2021, 10:22 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 5 2021, 10:22 PM
lkail added inline comments.Sep 6 2021, 1:52 AM
llvm/test/CodeGen/PowerPC/ppc64-acc-regalloc-bugfix.ll
4–7

Please make adding -ppc-track-subreg-liveness another check-prefix.

qiucf updated this revision to Diff 371017.Sep 7 2021, 2:52 AM
qiucf marked an inline comment as done.

Accumulator prime and deprime instructions are quite expensive. The logic of this patch seems to be contrary to what we actually want. Namely, this will ensure that we don't remove redundant XXMTACC/XXMFACC pairs if some subregister of the associated accumulator is undefined (or defined in another basic block). If it is undefined, we don't care what its value is so it doesn't seem like a good idea to activate MMA simply because of such poorly written code.
Honestly, anything is likely better than keeping these - including simply defining the undefined register to all zeros using XXLXORz. But of course, we can't simply change this code to zero out the register in case it is actually defined in another block.

Would it be possible to delete the instructions just like we currently do and then use LivePhysRegs to eliminate any uses of dead registers? Basically, what I mean is that if any changes were made in this peephole, we do what is effectively dead instruction elimination as the last thing the peephole does on the entire function.

Doing so would turn the function in the test case into an empty one (which would be the correct thing to do here).

jsji resigned from this revision.Jun 2 2022, 7:48 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 2 2022, 7:48 AM

Do we plan to move forward @qiucf

Deleting the instruction seems can not work for all cases, for example, %r = and 0, undef, this is well defined.

IMO, can we just change the input case? For example, don't store undef(element 2) to memory, we can extract and store element 3, maybe? Storing undef should not be intended by the user and the machineverify failure can exactly tell the user there is something wrong in the source or in compiler optimizations?

qiucf planned changes to this revision.Oct 30 2022, 10:26 PM

guess this can be abandoned this now? See https://reviews.llvm.org/D139492

qiucf abandoned this revision.Mar 2 2023, 10:05 PM