This is an archive of the discontinued LLVM Phabricator instance.

[CodeGen] Remove calls to getVectorNumElements in DAGTypeLegalizer::SplitVecOp_EXTRACT_SUBVECTOR
ClosedPublic

Authored by david-arm on Jul 6 2020, 2:01 AM.

Details

Summary

In DAGTypeLegalizer::SplitVecOp_EXTRACT_SUBVECTOR I have replaced
calls to getVectorNumElements with getVectorMinNumElements, since
this code path works for both fixed and scalable vector types. For
scalable vectors the index will be multiplied by VSCALE.

Fixes warnings in this test:

sve-sext-zext.ll

Diff Detail

Event Timeline

david-arm created this revision.Jul 6 2020, 2:01 AM
Herald added a project: Restricted Project. · View Herald Transcript
david-arm updated this revision to Diff 275923.Jul 6 2020, 11:55 PM
sdesmalen added inline comments.Jul 7 2020, 12:27 AM
llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp
2183

I think this assert is saying that this is not *yet* supported, because if extracting a fixed-width vector from a scalable vector is allowed then it should (at some point) also support extracting it from an illegal scalable vector.

So maybe better to change the wording to "Extracting a fixed-length vector from a scalable vector is not yet supported", and perhaps you can wrap it in a report_fatal_error(..) instead of an assert, because this is more a is-unsupported-error.

david-arm updated this revision to Diff 277697.Jul 14 2020, 1:08 AM
david-arm retitled this revision from [CodeGen] Fix warnings in DAGTypeLegalizer::SplitVecOp_EXTRACT_SUBVECTOR to [CodeGen] Remove calls to getVectorNumElements in DAGTypeLegalizer::SplitVecOp_EXTRACT_SUBVECTOR.
david-arm edited the summary of this revision. (Show Details)
david-arm marked an inline comment as done.
david-arm updated this revision to Diff 281215.Jul 28 2020, 6:44 AM
This revision is now accepted and ready to land.Jul 28 2020, 6:57 AM