aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2023-12-04 17:59:02 +0000
committerDimitry Andric <dim@FreeBSD.org>2023-12-04 17:59:11 +0000
commit641efdd10cc3ad05fb7eaeeae20b15c5ad4128c8 (patch)
tree667d95a9e2c87ecef5135c796895e6c6069dee61
parent0eea265a58f942f7f189ba758f4cac4355d42221 (diff)
downloadsrc-641efdd10cc3ad05fb7eaeeae20b15c5ad4128c8.tar.gz
src-641efdd10cc3ad05fb7eaeeae20b15c5ad4128c8.zip
Merge commit 989879f8fded from llvm git (by Paul Walker):
[Clang] Allow C++11 style initialisation of SVE types. Fixes https://github.com/llvm/llvm-project/issues/63223 Differential Revision: https://reviews.llvm.org/D153560 Requested by: andrew MFC after: 3 days
-rw-r--r--contrib/llvm-project/clang/lib/CodeGen/CGExprScalar.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/contrib/llvm-project/clang/lib/CodeGen/CGExprScalar.cpp b/contrib/llvm-project/clang/lib/CodeGen/CGExprScalar.cpp
index a0dcb978b1ac..ba8b5ab502d2 100644
--- a/contrib/llvm-project/clang/lib/CodeGen/CGExprScalar.cpp
+++ b/contrib/llvm-project/clang/lib/CodeGen/CGExprScalar.cpp
@@ -1861,6 +1861,23 @@ Value *ScalarExprEmitter::VisitInitListExpr(InitListExpr *E) {
return Visit(E->getInit(0));
}
+ if (isa<llvm::ScalableVectorType>(VType)) {
+ if (NumInitElements == 0) {
+ // C++11 value-initialization for the vector.
+ return EmitNullValue(E->getType());
+ }
+
+ if (NumInitElements == 1) {
+ Expr *InitVector = E->getInit(0);
+
+ // Initialize from another scalable vector of the same type.
+ if (InitVector->getType() == E->getType())
+ return Visit(InitVector);
+ }
+
+ llvm_unreachable("Unexpected initialization of a scalable vector!");
+ }
+
unsigned ResElts = cast<llvm::FixedVectorType>(VType)->getNumElements();
// Loop over initializers collecting the Value for each, and remembering