[PATCH] D79421: [CodeGen] Fix FoldConstantVectorArithmetic for scalable vectors
David Sherwood via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri May 15 01:35:44 PDT 2020
david-arm updated this revision to Diff 264176.
david-arm edited the summary of this revision.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D79421/new/
https://reviews.llvm.org/D79421
Files:
llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
===================================================================
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
@@ -4915,8 +4915,14 @@
if (GlobalAddressSDNode *GA = dyn_cast<GlobalAddressSDNode>(N2))
return FoldSymbolOffset(Opcode, VT, GA, N1);
- // For vectors, extract each constant element and fold them individually.
- // Either input may be an undef value.
+ // TODO: All the folds below are performed lane-by-lane and assume a fixed
+ // vector width, however we should be able to do constant folds involving
+ // splat vector nodes too.
+ if (VT.isScalableVector())
+ return SDValue();
+
+ // For fixed width vectors, extract each constant element and fold them
+ // individually. Either input may be an undef value.
auto *BV1 = dyn_cast<BuildVectorSDNode>(N1);
if (!BV1 && !N1->isUndef())
return SDValue();
@@ -4992,6 +4998,13 @@
if (!VT.isVector())
return SDValue();
+ // TODO: All the folds below are performed lane-by-lane and assume a fixed
+ // vector width, however we should be able to do constant folds involving
+ // splat vector nodes too.
+ if (VT.isScalableVector())
+ return SDValue();
+
+ // From this point onwards all vectors are assumed to be fixed width.
unsigned NumElts = VT.getVectorNumElements();
auto IsScalarOrSameVectorSize = [&](const SDValue &Op) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D79421.264176.patch
Type: text/x-patch
Size: 1458 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200515/07f7a1be/attachment.bin>
More information about the llvm-commits
mailing list