Skip to content

Commit

Permalink
[Clang] Allow C++11 style initialisation of SVE types.
Browse files Browse the repository at this point in the history
Fixes #63223

Differential Revision: https://reviews.llvm.org/D153560
  • Loading branch information
paulwalker-arm committed Jun 29, 2023
1 parent 6cda80b commit 989879f
Show file tree
Hide file tree
Showing 2 changed files with 898 additions and 0 deletions.
17 changes: 17 additions & 0 deletions clang/lib/CodeGen/CGExprScalar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1869,6 +1869,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
Expand Down

0 comments on commit 989879f

Please sign in to comment.