HomePhabricator

[RISCV] Ensure shuffle splat operands are type-legal

Authored by frasercrmck on May 18 2021, 6:08 AM.

Description

[RISCV] Ensure shuffle splat operands are type-legal

The use of SelectionDAG::getSplatValue isn't guaranteed to return a
type-legal splat value as it may implicitly extract a vector element
from another shuffle. It is not permitted to introduce an illegal type
when lowering shuffles.

This patch addresses the crash by adding a boolean flag to
getSplatValue, defaulting to false, which when set will ensure a
type-legal return value. If it is unable to do that it will fail to
return a splat value.

I've been through the existing uses of getSplatValue in other targets
and was unable to find a need or test cases showing a need to update
their uses. In some cases, the call is made during LegalizeVectorOps
which may still produce illegal scalar types. In other situations, the
illegally-typed splat value may be quickly patched up to a legal type
(such as any-extending the returned extract_vector_elt up to a legal
type) before LegalizeDAG notices.

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D102687

Details

Committed
frasercrmckMay 20 2021, 10:00 AM
Reviewer
craig.topper
Differential Revision
D102687: [RISCV] Ensure shuffle splat operands are type-legal
Parents
rG3a293cbf13a2: [WebAssembly] Fix PIC/GOT codegen for wasm64
Branches
Unknown
Tags
Unknown