[PATCH] D77442: [SVE] Take constant fold fast path for splatted vscale vectors
Christopher Tetreault via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 3 17:21:40 PDT 2020
ctetreau created this revision.
Herald added subscribers: llvm-commits, psnobl, rkruppe, hiraditya, tschuett.
Herald added a reviewer: efriedma.
Herald added a project: LLVM.
- This should be a perfectly reasonable operation for scalable vectors
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D77442
Files:
llvm/lib/IR/ConstantFold.cpp
Index: llvm/lib/IR/ConstantFold.cpp
===================================================================
--- llvm/lib/IR/ConstantFold.cpp
+++ llvm/lib/IR/ConstantFold.cpp
@@ -2009,11 +2009,6 @@
}
} else if (auto *C1VTy = dyn_cast<VectorType>(C1->getType())) {
- // Do not iterate on scalable vector. The number of elements is unknown at
- // compile-time.
- if (C1VTy->isScalable())
- return nullptr;
-
// Fast path for splatted constants.
if (Constant *C1Splat = C1->getSplatValue())
if (Constant *C2Splat = C2->getSplatValue())
@@ -2021,6 +2016,11 @@
C1VTy->getElementCount(),
ConstantExpr::getCompare(pred, C1Splat, C2Splat));
+ // Do not iterate on scalable vector. The number of elements is unknown at
+ // compile-time.
+ if (C1VTy->isScalable())
+ return nullptr;
+
// If we can constant fold the comparison of each element, constant fold
// the whole vector comparison.
SmallVector<Constant*, 4> ResElts;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D77442.254953.patch
Type: text/x-patch
Size: 1010 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200404/b49148ed/attachment.bin>
More information about the llvm-commits
mailing list