From c8889a9219a7d6ae96f81d020ae6d8f760e84297 Mon Sep 17 00:00:00 2001 From: Martin Kinkelin Date: Wed, 26 Aug 2020 12:30:21 +0200 Subject: [PATCH] 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. --- gen/llvmhelpers.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/gen/llvmhelpers.cpp b/gen/llvmhelpers.cpp index 6024d827d3..8b5ff3c427 100644 --- a/gen/llvmhelpers.cpp +++ b/gen/llvmhelpers.cpp @@ -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()) {