This is an archive of the discontinued LLVM Phabricator instance.

GlobalISel: Handle more cases in getGCDType
ClosedPublic

Authored by arsenm on Jun 8 2020, 4:46 AM.

Details

Summary

Try harder to find a canonical unmerge type when trying to cover the
desired target type. Handle finding a compatible unmerge type for two
vectors with different element types. This will return the largest
multiple of the source vector element that will evenly divide the
target vector type.

Also make the handling mixing scalars and vectors, and prefer the
source element type as the unmerge target type.

Diff Detail

Event Timeline

arsenm created this revision.Jun 8 2020, 4:46 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 8 2020, 4:46 AM
aemerson added inline comments.Jul 7 2020, 4:11 PM
llvm/lib/CodeGen/GlobalISel/Utils.cpp
551

Can we reorganize this to not have so much nesting?

Maybe duplicate greatestCommonDivisor(OrigSize, TargetSize); above this for the scalar case and early exit.

560

Invert this so the else early exits?

arsenm marked 2 inline comments as done.Jul 8 2020, 1:43 PM
arsenm added inline comments.
llvm/lib/CodeGen/GlobalISel/Utils.cpp
551

I'm not sure what you mean, the fallthroughs here are significant. I don't see where duplicating greatestCommonDivisor(OrigSize, TargetSize) would help.

I also wouldn't all anything here the scalar case; care is taken to manage the behavior of vector and "not vector" to preserve pointers where appropriate. I think isScalar not being the same as !isVector is a constant source of confusion

560

These don't return though? It falls through

aemerson accepted this revision.Jul 20 2020, 11:11 AM
This revision is now accepted and ready to land.Jul 20 2020, 11:11 AM