Fix alignment issue when casting vector rvalue to static array

Previously, the static-array alloca wasn't suitably aligned for the
store instruction, which uses the greater vector alignment.
This has surfaced now with LLVM 11 on Win32 - this fixes dmd-testsuite's
runnable/ldc_llvm_inline_ir.d.
This commit is contained in:
Martin Kinkelin 2020-08-26 12:30:21 +02:00
parent 7aea2e73e9
commit c8889a9219

View file

@ -637,8 +637,7 @@ DValue *DtoCastVector(Loc &loc, DValue *val, Type *to) {
LLValue *vector = DtoRVal(val);
IF_LOG Logger::cout() << "src: " << *vector << "to type: " << *tolltype
<< " (creating temporary)\n";
LLValue *array = DtoAlloca(to);
DtoStore(vector, DtoBitCast(array, getPtrToType(vector->getType())));
LLValue *array = DtoAllocaDump(vector, tolltype, DtoAlignment(val->type));
return new DLValue(to, array);
}
if (totype->ty == Tvector && to->size() == val->type->size()) {