This is an archive of the discontinued LLVM Phabricator instance.

GlobalISel: Avoid use of G_INSERT in insertParts
ClosedPublic

Authored by arsenm on Jun 7 2021, 5:47 PM.

Details

Summary

G_INSERT legalization is incomplete and doesn't work very
well. Instead try to use sequences of G_MERGE_VALUES/G_UNMERGE_VALUES
padding with undef values (although this can get pretty large).

For the case of load/store narrowing, this is still performing the
load/stores in irregularly sized pieces. It might be cleaner to split
this down into equal sized pieces, and rely on load/store merging to
optimize it.

Diff Detail

Event Timeline

arsenm created this revision.Jun 7 2021, 5:47 PM
arsenm requested review of this revision.Jun 7 2021, 5:47 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 7 2021, 5:47 PM
Herald added a subscriber: wdng. · View Herald Transcript
bogner accepted this revision.Jun 8 2021, 10:14 AM

Some of the test case updates show a lot more code coming out of the legalizer, which is a little bit concerning, but it looks like that's mostly with very unusual types like s112 (though it looks like it comes up a bit for things like s24 as well). That's probably okay though, as I'm guessing later passes will see all the constants and clean this up without too much trouble. Most of the cases with more normal types look like strict improvements I think.

This revision is now accepted and ready to land.Jun 8 2021, 10:14 AM

Some of the test case updates show a lot more code coming out of the legalizer, which is a little bit concerning, but it looks like that's mostly with very unusual types like s112 (though it looks like it comes up a bit for things like s24 as well). That's probably okay though, as I'm guessing later passes will see all the constants and clean this up without too much trouble. Most of the cases with more normal types look like strict improvements I think.

Some of these cases (especially the larger ones) actually show legalizing to completion now, whereas before they were failing on s24 inserts

llvm/test/CodeGen/AMDGPU/GlobalISel/legalize-load-flat.mir