llvm / llvm/llvm-project

[DAG] Add SelectionDAG::getConstantBuildVector(EVT VT, const SDLoc &DL, ArrayRef<APInt> Ops, const APInt &UndefElts)

Open
#179,427 2 comments 1 reaction 1 assignee Claimed by @fbrv View on GitHub
llvm:SelectionDAG
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

As detailed on #178617 - we sometimes need to create constant build vectors after legalisation, and the vector integer element type might not be legal at this stage and will rely on ISD::BUILD_VECTOR's implicit truncation.

Instead we should do something similar to SelectionDAG::getConstant() which handles the vector element type legalisation for us.

We also need to handle undef (and poison?) elements in some cases.

As well as #178617, there are a number of places in DAGCombiner/TargetLowering that have getConstant + getBuildVector calls that can be converted to make use of this (e.g. tryToFoldExtendOfConstant).

CC @zhaoqi5

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.