[PATCH] D157976: [RISCV] Use materialization cost when lowering constant build_vector
Luke Lau via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 18 04:20:21 PDT 2023
luke added inline comments.
================
Comment at: llvm/lib/Target/RISCV/RISCVISelLowering.cpp:3361
- SDValue Vec = DAG.getNode(ISD::INSERT_VECTOR_ELT, DL, ViaVecVT,
- DAG.getUNDEF(ViaVecVT),
- DAG.getConstant(SplatValue, DL, XLenVT),
- DAG.getConstant(0, DL, XLenVT));
- if (ViaVecLen != 1)
- Vec = DAG.getNode(ISD::EXTRACT_SUBVECTOR, DL,
- MVT::getVectorVT(ViaIntVT, 1), Vec,
- DAG.getConstant(0, DL, XLenVT));
- return DAG.getBitcast(VT, Vec);
+ // Base cost of 1 for vmv.s.x.
+ unsigned Cost = 1;
----------------
reames wrote:
> This is off when we can use a vmv.v.i to perform the insert.
I think I'm missing something, I can't find anywhere where the insert_vector_elt below would get lowered or combined to a vmv.v.i. There doesn't seem to be any vmv.v.i's introduced in the test diff in https://reviews.llvm.org/D157299 either?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D157976/new/
https://reviews.llvm.org/D157976
More information about the llvm-commits
mailing list