This is an archive of the discontinued LLVM Phabricator instance.

[GlobalISel][AArch64] Fix contract cross-bank copies with SIMD instructions
ClosedPublic

Authored by scw on Feb 4 2020, 4:01 PM.

Details

Summary

contractCrossBankCopyIntoStore() finds the instruction defines the
source register and uses its output to replace the register. There are,
however, instructions that have multiple outputs, e.g. G_UNMERGE_VALUES.
Current implementation hardcodes to operand 0 and has no way of knowing
which output should be used.

This change adds another function to directly return the register that
is the source of the register and use that for folding.

This fixes https://bugs.llvm.org/show_bug.cgi?id=44783

Diff Detail

Event Timeline

scw created this revision.Feb 4 2020, 4:01 PM

Thanks for fixing this!

Can you attach a MIR testcase based off the one from the bugzilla bug?

llvm/lib/CodeGen/GlobalISel/Utils.cpp
303–312

Instead of a std::pair, can we do something similar to getConstantVRegValWithLookThrough, which returns an Optional struct?

Then when we bail out, we can just return None, which is a little nicer IMO.

scw updated this revision to Diff 242464.Feb 4 2020, 4:29 PM

Updated test.

scw updated this revision to Diff 242469.Feb 4 2020, 4:49 PM
scw marked an inline comment as done.
scw added inline comments.
llvm/lib/CodeGen/GlobalISel/Utils.cpp
303–312

Done.

MaskRay added a subscriber: MaskRay.Feb 4 2020, 5:01 PM
MaskRay added inline comments.
llvm/lib/CodeGen/GlobalISel/Utils.cpp
303
324

{ -> {

scw updated this revision to Diff 242472.Feb 4 2020, 5:10 PM
scw updated this revision to Diff 242473.Feb 4 2020, 5:17 PM

Update style.

scw updated this revision to Diff 242474.Feb 4 2020, 5:19 PM
paquette accepted this revision.Feb 5 2020, 9:19 AM

LGTM

This revision is now accepted and ready to land.Feb 5 2020, 9:19 AM
This revision was automatically updated to reflect the committed changes.