From 508652fd8b90d7590d7aec2f54fb0cbc12b1c4d9 Mon Sep 17 00:00:00 2001 From: David Nadlinger Date: Fri, 31 Aug 2012 01:11:30 +0200 Subject: [PATCH] Initialization of vector types with single value. Fixes DMD testcase 'testargtypes'. --- gen/llvmhelpers.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/gen/llvmhelpers.cpp b/gen/llvmhelpers.cpp index 625dbb7a..30279c26 100644 --- a/gen/llvmhelpers.cpp +++ b/gen/llvmhelpers.cpp @@ -1501,6 +1501,12 @@ LLConstant* DtoConstExpInit(Loc loc, Type* type, Expression* exp) Logger::println("type is a static array, building constant array initializer to single value"); return expand_to_sarray(base, exp); } + else if (base->ty == Tvector) + { + LLConstant* val = exp->toConstElem(gIR); + TypeVector* tv = (TypeVector*)base; + return llvm::ConstantVector::getSplat(tv->size(loc), val); + } else { error("cannot yet convert default initializer %s of type %s to %s", exp->toChars(), exp->type->toChars(), type->toChars());