[clang] [llvm] [NFC][LLVM] Refactor IRBuilder::Create{VScale,ElementCount,TypeSize}. (PR #142803)

David Sherwood via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 5 01:24:37 PDT 2025


================
@@ -120,23 +120,30 @@ IRBuilderBase::createCallHelper(Function *Callee, ArrayRef<Value *> Ops,
   return CI;
 }
 
-Value *IRBuilderBase::CreateVScale(Constant *Scaling, const Twine &Name) {
-  assert(isa<ConstantInt>(Scaling) && "Expected constant integer");
-  if (cast<ConstantInt>(Scaling)->isZero())
-    return Scaling;
-  CallInst *CI =
-      CreateIntrinsic(Intrinsic::vscale, {Scaling->getType()}, {}, {}, Name);
-  return cast<ConstantInt>(Scaling)->isOne() ? CI : CreateMul(CI, Scaling);
+Value *IRBuilderBase::CreateVScale(Type *Ty, const Twine &Name) {
----------------
david-arm wrote:

nit: Is it worth inlining this into the header definition?

https://github.com/llvm/llvm-project/pull/142803


More information about the llvm-commits mailing list