[PATCH] D102766: [SelectionDAG] Implement PromoteIntRes_INSERT_SUBVECTOR

Joe Ellis via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 19 06:01:55 PDT 2021


joechrisellis created this revision.
joechrisellis added reviewers: paulwalker-arm, peterwaller-arm, DavidTruby, bsmith, efriedma.
Herald added subscribers: ecnelises, hiraditya.
joechrisellis requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Inserting into a smaller-than-legal scalable vector would result in an
internal compiler error. For example, inserting a <vscale x 4 x i8> into
a <vscale x 8 x i8> (both illegal vector types for SVE) would cause a
crash.

This crash was happening because there was no code to promote (legalise)
the result of an INSERT_SUBVECTOR node.

This patch implements PromoteIntRes_INSERT_SUBVECTOR, which legalises
the ISD node. This is currently done by going through memory. This is
necessary because of the requirement that the SubVec parameter of the
INSERT_SUBVECTOR node must be smaller than the Vec parameter, which
means that INSERT_SUBVECTOR cannot always have a legal result/operand
types.

This commit also includes tests which defend against the crash behaviour
described in the commit with message:

  "[SelectionDAG] Add stub implementation of ReplaceInsertSubVectorResults"

Depends on: https://reviews.llvm.org/D102765


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D102766

Files:
  llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
  llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.h
  llvm/test/CodeGen/AArch64/insert-subvector-res-legalization.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D102766.346426.patch
Type: text/x-patch
Size: 15898 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210519/9eded823/attachment.bin>


More information about the llvm-commits mailing list