Skip to content

Commit 45c05ee

Browse files
Handle reshape intrinsic initialisation with FixedSizeArray (#2197)
1 parent 92b1bfd commit 45c05ee

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/libasr/codegen/asr_to_llvm.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2156,7 +2156,6 @@ class ASRToLLVMVisitor : public ASR::BaseVisitor<ASRToLLVMVisitor>
21562156
llvm::Type* target_type = llvm_utils->get_type_from_ttype_t_util(x_m_array_type, module.get());
21572157
llvm::Value *target = builder0.CreateAlloca(
21582158
target_type, nullptr, "fixed_size_reshaped_array");
2159-
array = llvm_utils->create_gep(array, 0);
21602159
llvm::Value* target_ = llvm_utils->create_gep(target, 0);
21612160
ASR::dimension_t* asr_dims = nullptr;
21622161
size_t asr_n_dims = ASRUtils::extract_dimensions_from_ttype(x_m_array_type, asr_dims);
@@ -3172,6 +3171,8 @@ class ASRToLLVMVisitor : public ASR::BaseVisitor<ASRToLLVMVisitor>
31723171
builder->CreateMemCpy(llvm_utils->create_gep(target_var, 0),
31733172
llvm::MaybeAlign(), init_value, llvm::MaybeAlign(), arg_size);
31743173
}
3174+
} else if (ASR::is_a<ASR::ArrayReshape_t>(*v->m_symbolic_value)) {
3175+
builder->CreateStore(LLVM::CreateLoad(*builder, init_value), target_var);
31753176
} else {
31763177
builder->CreateStore(init_value, target_var);
31773178
}

0 commit comments

Comments
 (0)