This is an archive of the discontinued LLVM Phabricator instance.

[AArch64][GlobalISel] Split post-legalizer combiner to allow for lowering at -O0
ClosedPublic

Authored by paquette on Oct 20 2020, 1:30 PM.

Details

Reviewers
aemerson
Summary

There are a lot of combines in AArch64PostLegalizerCombiner which exist to facilitate instruction matching in the selector. (E.g. matching for G_ZIP and other shuffle vector pseudos)

It still makes sense to select these instructions at -O0.

Matching earlier in a combiner can reduce complexity in the selector significantly. For example, a good portion of our selection code for compares would be a lot easier to represent in a combine.

This patch moves matching combines into a "AArch64PostLegalizerLowering" combiner which runs at all optimization levels.

Diff Detail

Event Timeline

paquette created this revision.Oct 20 2020, 1:30 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 20 2020, 1:30 PM
paquette requested review of this revision.Oct 20 2020, 1:30 PM
aemerson added inline comments.Oct 21 2020, 11:46 AM
llvm/lib/Target/AArch64/AArch64.h
62

Not sure why the create functions use a verb instead of the noun, we should keep it consistent.

llvm/lib/Target/AArch64/GISel/AArch64PostLegalizerLowering.cpp
504

If this is a lowering pass then we may not need a dominator tree and thus IsOptNone variable plumbing through? If something needs to run only w/ optimizations that can live in the actual combiner pass.

paquette added inline comments.Oct 21 2020, 2:38 PM
llvm/lib/Target/AArch64/AArch64.h
62

I'm going to guess that someone forgot to type the 's' one day and now we have to live with the typo.

llvm/lib/Target/AArch64/GISel/AArch64PostLegalizerLowering.cpp
504

Hm yeah, good point.

We might also not need known bits either?

paquette updated this revision to Diff 299821.Oct 21 2020, 4:21 PM

Remove requirements for MachineDominatorTree.

aemerson added inline comments.Oct 21 2020, 8:57 PM
llvm/lib/Target/AArch64/AArch64.h
62

Yeah...I'm gonna need you to go ahead and add the 'r' there.

llvm/lib/Target/AArch64/GISel/AArch64PostLegalizerLowering.cpp
504

Yeah, KB shouldn't be needed either.

paquette updated this revision to Diff 300026.Oct 22 2020, 10:05 AM
  • Remove GISelKnownBits from AArch64PostLegalizerLowering
  • Remove a bunch of now-unnecessary includes from AArch64PostLegalizerCombiner
  • Improve docs (Hacktoberfest 2020)
paquette updated this revision to Diff 300033.Oct 22 2020, 10:12 AM

Add the missing 'r' to each of the createAArch64(Post/Pre)Legalize functions

aemerson accepted this revision.Oct 22 2020, 11:05 AM

LGTM with comment fixes.

llvm/lib/Target/AArch64/AArch64TargetMachine.cpp
563–564

Can remove this comment since it's now outdated.

llvm/lib/Target/AArch64/GISel/AArch64PostLegalizerLowering.cpp
15

s/U_UZP/G_UZP

This revision is now accepted and ready to land.Oct 22 2020, 11:05 AM