Page MenuHomePhabricator

[PowerPC] Add peephole to remove redundant accumulator prime/unprime instructions
ClosedPublic

Authored by bsaleil on Nov 12 2020, 1:25 PM.

Details

Summary

In some situations, the compiler may insert an accumulator prime instruction and an accumulator unprime instruction with no use of that accumulator between the two.
That's for example the case when we store an accumulator after assembling it or restoring it. This patch adds a peephole to remove these prime and unprime instructions.

Diff Detail

Event Timeline

bsaleil created this revision.Nov 12 2020, 1:25 PM
bsaleil requested review of this revision.Nov 12 2020, 1:25 PM
NeHuang added inline comments.
llvm/lib/Target/PowerPC/PPCPreEmitPeephole.cpp
373

Question: Besides adding the operand register to the candidate, are we also recording the machine instruction used the register candidate? If I understand it properly, can we also add it in the comment? This would help understand your comment below we mark the two instructions for removal. - line 380

376

nit: do you think we need to add instruction OPC information in the message to differentiate them?

379

nit: operand -> operand register

bsaleil updated this revision to Diff 305519.Nov 16 2020, 7:57 AM

Update comments

bsaleil marked 3 inline comments as done.Nov 16 2020, 7:57 AM
NeHuang accepted this revision as: NeHuang.Nov 17 2020, 11:56 AM

LGTM.

This revision is now accepted and ready to land.Nov 17 2020, 11:56 AM
This revision was landed with ongoing or failed builds.Nov 18 2020, 1:01 PM
This revision was automatically updated to reflect the committed changes.