Using alloca on composite types

Hi all,

I want to allocate memory using alloca on the stack. For example, for array of 5 ints I know that it can be done by:

%size = llvm.mlir.constant(5) : !llvm.i32
%0 = llvm.alloca %size x !llvm.i32 : (!llvm.i32) -> !llvm<"i32*">

But also, I have seen that it is possible to do via:

%size = llvm.mlir.constant(1 : i32) : !llvm.i32
%0 = llvm.alloca %size x !llvm<"[5 x i32]"> : (!llvm.i32) -> !llvm<"[5 x i32]*">

Is there a difference between these two methods?

Isn’t the second allocating an array of 5 elements, each of them being an array of 5 i32?

It is, I guess my question is more on whether there is a difference in performance when balancing the size and the type: 1 of array allocation or n of its elements allocation, etc.