This is an archive of the discontinued LLVM Phabricator instance.

[SelectionDAG] Handle promotion + widening in getCopyToPartsVector
ClosedPublic

Authored by sdesmalen on Sep 28 2021, 11:40 AM.

Details

Summary

Some vectors require both widening and promotion for their legalization.
This case is not yet handled in getCopyToPartsVector and falls back
on scalarizing by default. BBecause scalable vectors can't easily be
scalarised, we need to implement this in two separate stages:

  1. Widen the vector.
  2. Promote the vector.

As part of this patch, PromoteIntRes_CONCAT_VECTORS also needed to be
made scalable aware. Instead of falling back on scalarizing the vector
(fixed-width only), each sub-part of the CONCAT vector is promoted,
and the operation is performed on the type with the widest element type,
finally truncating the result to the promoted result type.

Diff Detail

Event Timeline

sdesmalen created this revision.Sep 28 2021, 11:40 AM
sdesmalen requested review of this revision.Sep 28 2021, 11:40 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 28 2021, 11:40 AM
david-arm added inline comments.Sep 29 2021, 5:12 AM
llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
5079

Is it worth asserting that the type action is either legal or promote here? I'm just thinking what would happen if the action was to widen?

5088

nit: Perhaps this should be 'promoted'?

sdesmalen updated this revision to Diff 375917.Sep 29 2021, 9:02 AM

Added assert and updated comment.

david-arm accepted this revision.Sep 29 2021, 9:08 AM

LGTM! Thanks for the changes. :)

This revision is now accepted and ready to land.Sep 29 2021, 9:08 AM