[PATCH] D78636: [CodeGen] Use SPLAT_VECTOR for zeroinitialiser with scalable types
Sander de Smalen via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 23 06:59:21 PDT 2020
sdesmalen added inline comments.
================
Comment at: llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp:1562
if (const ConstantVector *CV = dyn_cast<ConstantVector>(C)) {
- for (unsigned i = 0; i != NumElements; ++i)
+ assert(!EltCnt.Scalable && "ConstantVector used for scalable types");
+ for (unsigned i = 0; i != EltCnt.Min; ++i)
----------------
D77587 introduced FixedVectorType and ScalableVectorType, which means you can instead write:
cast<FixedVectorType>(VecTy)->getNumElements()
That also removes the need for an additional assert.
================
Comment at: llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp:1570
SDValue Op;
if (EltVT.isFloatingPoint())
----------------
I'd prefer to see the Scalable and FixedWidth cases more separated here, something like
if (isa<ScalableVectorType>(...))
// Op = splat vector
else {
if (EltVT.isFloatingPoint())
...
...
}
================
Comment at: llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp:1576
+
+ if (EltCnt.Scalable)
+ return NodeMap[V] = DAG.getSplatVector(VT, getCurSDLoc(), Op);
----------------
You can then write:
if (isa<ScalableVectorType>(VecTy))
Op = DAG.getSplatVector(VT, getCurSDLoc(), Op);
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D78636/new/
https://reviews.llvm.org/D78636
More information about the llvm-commits
mailing list