<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" class="gmail_signature" data-smartmail="gmail_signature">Roger Ferrer Ibáñez<br></div></div></div>