[DAG] Add SelectionDAG::getConstantBuildVector(EVT VT, const SDLoc &DL, ArrayRef<APInt> Ops, const APInt &UndefElts)
Open
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
Assessment
This issue has not been assessed yet.