This is an archive of the discontinued LLVM Phabricator instance.

[AArch64][SVE] Fix ICE extracting fixedvec from scalable load
ClosedPublic

Authored by peterwaller-arm on Dec 6 2021, 7:28 AM.

Details

Summary

f526c600c043 had a concern raised because of an invalid typesize request
on a scalable vector, which this patch addresses.

Prevent shouldReduceLoadWidth from attempting to query the bit size, and
add a regression test in sve-extract-fixed-vector.ll.

Diff Detail

Event Timeline

peterwaller-arm created this revision.Dec 6 2021, 7:28 AM
peterwaller-arm requested review of this revision.Dec 6 2021, 7:28 AM
Herald added a project: Restricted Project. · View Herald TranscriptDec 6 2021, 7:28 AM
MattDevereau added inline comments.Dec 6 2021, 7:46 AM
llvm/test/CodeGen/AArch64/sve-extract-fixed-vector.ll
410–426

Consider adding a short comment explaining whats going on like the other tests in this file. It's a bit hard (at least for me) to tell exactly what regression is being asserted from the test name alone

  • Review comment: add test comment.
peterwaller-arm marked an inline comment as done.Dec 6 2021, 8:22 AM
paulwalker-arm accepted this revision.Dec 6 2021, 8:34 AM

I've added a comment regarding what I believe is a better fix. The problem is, following this advice may well trigger different code paths for other targets and so I'm happy to accept this more minimal fix. I'll leave it up to you which way to go.

llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
11803

I think the real problem is here where the code is not vector ware. For SVE at least, the index loads are based on the scalar element type and so my feeling is that the real intent here is best followed if getSizeInBits becomes getScalarSizeInBits.

So today this function likely incorrectly always returns false for fixed length vectors, which is not great but better than the crash triggered by scalable vectors.

This revision is now accepted and ready to land.Dec 6 2021, 8:34 AM
peterwaller-arm marked an inline comment as done.Dec 6 2021, 8:50 AM
peterwaller-arm added inline comments.
llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
11803

As discussed offline, we're concerned about the potential performance impact on other targets that we aren't able to test. So for now we're going to apply the band-aid we have.

This revision was landed with ongoing or failed builds.Dec 6 2021, 8:50 AM
This revision was automatically updated to reflect the committed changes.
peterwaller-arm marked an inline comment as done.