<div dir="ltr">There are quite a few different ways to make constant vectors. You can create a splat of integer constants by using   ConstantInt::get(<vector type>, <scalar value>)   The scalar value can be an uint64_t or an APInt. Of if you have a Constant * you want to splat you can use ConstantVector::getSplat.   If it's not a splat, you can use ConstantDataVector::get which will take an array of uint8_t, uint16_t, uint32_t, or uin64_t and auto infer the width and element count. Or you can use ConstantVector::get  which will take an array of individual Constant * that all have the same scalar type.<div><br></div><div>I don't have any complete code for implementing a function. Most of my interaction with these APIs has been in converting intrinsics into native IR in lib/IR/AutoUpgrade.cpp and clang's lib/CodeGen/CGBuiltin.cpp. I'm sure you'll find every function I mentioned above used in one or both of those files.</div></div>