<div dir="ltr"><div>Hi,<br></div><div><br></div><div>apologies. I totally missed the <a class="gmail-code" href="https://llvm.org/doxygen/classllvm_1_1ConstantDataVector.html#a44124e702dc442346bd6202bb03e593b">ConstantDataVector::getSplat</a>.</div><div><br></div><div>Kind regards</div><div><br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Missatge de Roger Ferrer Ibáñez <<a href="mailto:rofirrim@gmail.com">rofirrim@gmail.com</a>> del dia dt., 26 de nov. 2019 a les 18:43:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Hi all,</div><div><br></div><div>IRBuilder has a method CreateNot which may invoke BinaryOperator::CreateNot. However there isn't actually a `not` operation in LLVM IR so BinaryOperator::CreateNot acts as a helper by creating a `xor` against a suitable constant of all ones, the exact nature of such constant depends on the operand and may end being a (fixed-size) vector.</div><br><div>However the creation of the "all ones" constant is not feasible when the operand we want to `not` is a scalable vector (vector constants are described by extension).</div><div><div><br></div><div>I guess we can change IRBuilder::CreateNot to check this case and emit the LLVM IR we customarily use for splats via IRBuilder::CreateVectorSplat so we get a value of a scalable vector of "all ones".</div></div><div><br></div><div>However, a cursory `grep` reveals a few direct users of BinaryOperator::CreateNot (note that this is a pessimistic stance as not all of them may end being invoked on vectors) so we might want to do better here.<br></div><div><br></div><div>I don't have a good solution here but I will assume that introducing a "splatted constant" in LLVM IR is not desirable.</div><div><br></div><div>One option may be asserting in BinaryOperator::CreateNot (and other helpers impacted by the same issue). This seems a bit hostile for users of BinaryOperator.<br></div><div><br></div><div>Maybe move around the code in IRBuilder::CreateVectorSplat so it is useable outside IRBuilder and then use it in BinaryOperator::CreateNot?</div><div><br></div><div>Perhaps there are better alternatives already used in practice for those working with scalable vectors?<br></div><div><br></div><div>Thanks a lot,<br></div><div><br>-- <br><div dir="ltr">Roger Ferrer Ibáñez<br></div></div></div>
</blockquote></div><br clear="all"><br>-- <br><div dir="ltr" class="gmail_signature">Roger Ferrer Ibáñez<br></div>