This is an archive of the discontinued LLVM Phabricator instance.

[SVE][AArch64] Replace TypeSize comparisons with their integer equivalents
ClosedPublic

Authored by david-arm on Oct 9 2020, 4:25 AM.

Details

Summary

In many places in the AArch64 backend we are comparing TypeSize objects,
but in fact we are only ever expecting fixed width types. I've changed
all such comparisons to use their integer equivalents by replacing
calls to getSizeInBits() with getFixedSizeInBits(), etc.

Diff Detail

Event Timeline

david-arm created this revision.Oct 9 2020, 4:25 AM
Herald added a project: Restricted Project. · View Herald Transcript
david-arm requested review of this revision.Oct 9 2020, 4:25 AM
sdesmalen added inline comments.Oct 12 2020, 8:35 AM
llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
7489–7491

SmallestEltTy.getScalarSizeInBits()

7491

SmallestEltTy.getScalarSizeInBits()

7507

EltVT.getScalarSizeInBits()

7577

SrcEltTy.getScalarSizeInBits() / SmallestEltTy.getScalarSizeInBits()

8351

ScalarVT.getScalarSizeInBits

10143–10144

Are you sure this shouldn't also work for vectors?

If not, then it's better to use Ty1->getScalarSizeInBits()

llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp
458

DstVT.getScalarSizeInBits() < SrcVT.getScalarSizeInBits()

Please ignore my comments about getScalarSizeInBits, I thought that interface would assert that the type is not a vector (which I thought would be an extra guard that it's okay to ask for the fixed-size).
Instead, it returns the element type if the type is a vector, so in that case I agree it's better to use getFixedSizeInBits().

sdesmalen accepted this revision.Oct 16 2020, 12:39 AM

Based on what we discussed in the SVE call yesterday, I'm happy with the uses of getFixedSizeInBits. LGTM!

This revision is now accepted and ready to land.Oct 16 2020, 12:39 AM
This revision was landed with ongoing or failed builds.Oct 19 2020, 12:07 AM
This revision was automatically updated to reflect the committed changes.