mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-13 14:36:18 +03:00
Fixed vector global initialization for > 1 byte elements.
This commit is contained in:
parent
c9a2e534fb
commit
2bf0789364
1 changed files with 7 additions and 2 deletions
|
@ -1501,12 +1501,17 @@ LLConstant* DtoConstExpInit(Loc loc, Type* type, Expression* exp)
|
|||
if (base->ty == Tvector)
|
||||
{
|
||||
LLConstant* val = exp->toConstElem(gIR);
|
||||
|
||||
TypeVector* tv = (TypeVector*)base;
|
||||
assert(tv->basetype->ty == Tsarray);
|
||||
dinteger_t elemCount =
|
||||
static_cast<TypeSArray *>(tv->basetype)->dim->toInteger();
|
||||
|
||||
#if LDC_LLVM_VER == 300
|
||||
std::vector<LLConstant*> Elts(tv->size(loc), val);
|
||||
std::vector<LLConstant*> Elts(elemCount, val);
|
||||
return llvm::ConstantVector::get(Elts);
|
||||
#else
|
||||
return llvm::ConstantVector::getSplat(tv->size(loc), val);
|
||||
return llvm::ConstantVector::getSplat(elemCount, val);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue