This is an archive of the discontinued LLVM Phabricator instance.

[GlobalISel][Legalizer] Look thro copies while combining G_UNMERGE's
ClosedPublic

Authored by rtereshin on Apr 13 2018, 4:10 PM.

Details

Summary

G_UNMERGE legalization artifact combine is the only one that doesn't look through COPY's for no apparent reason.

As we're becoming stricter w/ respect to not allowing vregs having LLTs and regclasses assigned both mid-globalisel pipeline, the number of extra copies grows, some of which separate G_UNMERGE's from their corresponding G_MERGE's, becoming a performance concern.

This is related to, but not dependent on https://reviews.llvm.org/D45732 and https://reviews.llvm.org/D45640

Diff Detail

Repository
rL LLVM

Event Timeline

rtereshin created this revision.Apr 13 2018, 4:10 PM
rtereshin added inline comments.Apr 13 2018, 4:16 PM
test/CodeGen/AArch64/GlobalISel/legalize-combines.mir
94 ↗(On Diff #142479)

test_combines_5 prior to the patch is an exact copy of test_combines_3, so just changing it in place doesn't reduce the coverage nor it does create tests that test more than one thing.

119 ↗(On Diff #142479)

same as test_combines_5, but uses one of the copies in the middle of the COPY-chain to see how look-thro-copies thing would deal with it.

test/CodeGen/AArch64/GlobalISel/legalize-nonpowerof2eltsvec.mir
25 ↗(On Diff #142479)

My understanding of the test is that it needs to see how the G_MERGE_VALUES would be legalized as an instruction, not as a legalization artifact. To make sure it doesn't get combined out as a legalization artifact instead, we need to use the merged vector value more reliably than by just inserting a copy between G_MERGE_VALUES and G_UNMERGE_VALUES

rtereshin edited the summary of this revision. (Show Details)Apr 17 2018, 11:49 AM

LGTM. Thanks

This revision is now accepted and ready to land.Apr 23 2018, 10:58 AM

LGTM. Thanks

Hi Aditya,

Thanks for looking into this!

Roman

This revision was automatically updated to reflect the committed changes.