LLVM Discussion Forums

How can I create a constant vector?

Hello,

Is there a straightforward way of creating a constant vector of values?
Something that through llvm lowering and code generation would naturally go to .rodata? This vector would have to be randomly read, but never written.

It looks like std.constant does not take vector values as arguments, so it is not the answer.

Best,
Dumitru

std.constant dense<[0,1,2,3]> : vector<4xi32> works perfectly fine for me.

Where LLVM code generator decides to put constants is out of MLIR’s control.

1 Like