This is an archive of the discontinued LLVM Phabricator instance.

[CodeGen] Fix a scalable-vector crash in VSELECT legalization
ClosedPublic

Authored by frasercrmck on Jun 2 2021, 10:12 AM.

Details

Summary

The DAGTypeLegalizer::WidenVSELECTMask function is not (yet) ready for
scalable vector types, and has numerous places in which it tries to grab
either the fixed size or number of elements of its types.

I believe that it should be possible to update this method to properly
account for scalable-vector types, but we don't have test cases for
that; RISC-V bails out early on as it has legal i1 vector masks. As
such, this patch just prevents it from crashing.

Diff Detail

Event Timeline

frasercrmck created this revision.Jun 2 2021, 10:12 AM
frasercrmck requested review of this revision.Jun 2 2021, 10:12 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 2 2021, 10:12 AM
This revision is now accepted and ready to land.Jun 2 2021, 1:29 PM
sdesmalen added inline comments.Jun 3 2021, 12:52 AM
llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp
4258

nit: Can you add a FIXME to say that this support could be added in the future?
(or append "yet" after "vector types" in your current comment)

  • rebase & add a fixme
frasercrmck marked an inline comment as done.Jun 3 2021, 1:49 AM
frasercrmck added inline comments.
llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp
4258

Aye, I've just done so. I originally had a "yet" but didn't want it to just become some stale comment if there were no plans to change it. Do you think AArch64 may have a use for this function?

frasercrmck marked an inline comment as done.Jun 3 2021, 1:49 AM