This is an archive of the discontinued LLVM Phabricator instance.

[AArch64] Handle more zero reg cases in foldMemoryOperandImpl
AbandonedPublic

Authored by gberry on Nov 22 2016, 2:27 PM.

Details

Reviewers
qcolombet
MatzeB
Summary

Extend AArch64 foldMemoryOperandImpl() to handle folding spills of COPYs like:

%vreg0:sub_32<def,read-undef> = COPY %WZR; GPR64common:%vreg0

by generating:

STRXui %XZR <fi#0>

These cases show up mostly due to zero extended values that get
coalesced and subsequently spilled.

Event Timeline

gberry updated this revision to Diff 78950.Nov 22 2016, 2:27 PM
gberry retitled this revision from to [AArch64] Handle more zero reg cases in foldMemoryOperandImpl.
gberry updated this object.
gberry added reviewers: qcolombet, MatzeB.
MatzeB accepted this revision.Nov 22 2016, 3:12 PM
MatzeB edited edge metadata.

LGTM, with nitpicks. And obviously needs https://reviews.llvm.org/D26521 to be accepted first.

lib/Target/AArch64/AArch64InstrInfo.cpp
2636–2637

Maybe use reference variables to indicate they cannot contain nullptr.

test/CodeGen/MIR/AArch64/spill-fold-zr.mir
13

A sentece describing what you are testing here would be nice.

15

Do the defs need to be early clobbers? I would have assumed it doesn't matter...

This revision is now accepted and ready to land.Nov 22 2016, 3:12 PM
mkuper added a subscriber: mkuper.Nov 22 2016, 4:15 PM

Note that since D26521 only enables folding of stack slots for X86, it changed the MachineMemOperand size handling only in the FI version of TTI::foldMemoryOperand().
If you're enabling it for LoadMI here, you may need to do something similar for the LoadMI version (unless it happens to just work).

gberry abandoned this revision.Dec 5 2016, 1:07 PM

I'm abandoning this patch in favor of https://reviews.llvm.org/D27425, which is more general