[llvm] [LLVM-C] Support operand bundles (PR #73914)
Quinton Miller via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 7 10:13:44 PST 2023
https://github.com/HertzDevil updated https://github.com/llvm/llvm-project/pull/73914
>From 08dd313544d3fc1aa8c499e44c7187cb90326c1a Mon Sep 17 00:00:00 2001
From: Quinton Miller <nicetas.c at gmail.com>
Date: Thu, 30 Nov 2023 00:30:11 +0800
Subject: [PATCH 1/4] Support operand bundles in the C API
---
llvm/include/llvm-c/Core.h | 118 ++++++++++++++++++++++++++++++
llvm/include/llvm-c/Types.h | 5 ++
llvm/lib/IR/Core.cpp | 81 ++++++++++++++++++++
llvm/test/Bindings/llvm-c/echo.ll | 11 +++
llvm/tools/llvm-c-test/echo.cpp | 44 +++++++++--
5 files changed, 252 insertions(+), 7 deletions(-)
diff --git a/llvm/include/llvm-c/Core.h b/llvm/include/llvm-c/Core.h
index b16f67ef02f33..1e63a7d63af04 100644
--- a/llvm/include/llvm-c/Core.h
+++ b/llvm/include/llvm-c/Core.h
@@ -3000,6 +3000,83 @@ LLVMValueRef LLVMMDNodeInContext(LLVMContextRef C, LLVMValueRef *Vals,
/** Deprecated: Use LLVMMDNodeInContext2 instead. */
LLVMValueRef LLVMMDNode(LLVMValueRef *Vals, unsigned Count);
+/**
+ * @}
+ */
+
+/**
+ * @defgroup LLVMCCoreOperandBundle Operand Bundles
+ *
+ * Functions in this group operate on LLVMOperandBundleRef instances that
+ * correspond to llvm::OperandBundleDef instances.
+ *
+ * @see llvm::OperandBundleDef
+ *
+ * @{
+ */
+
+/**
+ * Create a new operand bundle.
+ *
+ * Every invocation should be paired with LLVMDisposeOperandBundle() or memory
+ * will be leaked.
+ *
+ * @param Tag Tag name of the operand bundle
+ * @param TagLen Length of Tag
+ * @param Args Memory address of an array of bundle operands
+ * @param NumArgs Length of Args
+ */
+LLVMOperandBundleRef LLVMCreateOperandBundle(const char *Tag, unsigned TagLen,
+ LLVMValueRef *Args,
+ unsigned NumArgs);
+
+/**
+ * Destroy an operand bundle.
+ *
+ * This must be called for every created operand bundle or memory will be
+ * leaked.
+ */
+void LLVMDisposeOperandBundle(LLVMOperandBundleRef Bundle);
+
+/**
+ * Obtain the tag of an operand bundle as a string.
+ *
+ * @param Bundle Operand bundle to obtain tag of.
+ * @param Len Out parameter which holds the length of the returned string.
+ * @return The tag name of Bundle.
+ * @see OperandBundleDef::getTag()
+ */
+const char *LLVMGetOperandBundleTag(LLVMOperandBundleRef Bundle, size_t *Len);
+
+/**
+ * Obtain the number of operands for an operand bundle.
+ *
+ * @param Bundle Operand bundle to obtain operand count of.
+ * @return The number of operands.
+ * @see OperandBundleDef::input_size()
+ */
+unsigned LLVMGetNumOperandBundleArgs(LLVMOperandBundleRef Bundle);
+
+/**
+ * Obtain the operands for an operand bundle.
+ *
+ * @param Bundle Operand bundle to obtain operands of.
+ * @param Dest Memory address of an array to be filled with operands.
+ * @see OperandBundleDef::inputs()
+ */
+void LLVMGetOperandBundleArgs(LLVMOperandBundleRef Bundle, LLVMValueRef *Dest);
+
+/**
+ * Obtain the operand for an operand bundle at the given index.
+ *
+ * @param Bundle Operand bundle to obtain operand of.
+ * @param Index An operand index, must be less than
+ * LLVMGetNumOperandBundleArgs().
+ * @return The operand.
+ */
+LLVMValueRef LLVMGetOperandBundleArgAtIndex(LLVMOperandBundleRef Bundle,
+ unsigned Index);
+
/**
* @}
*/
@@ -3451,6 +3528,38 @@ LLVMTypeRef LLVMGetCalledFunctionType(LLVMValueRef C);
*/
LLVMValueRef LLVMGetCalledValue(LLVMValueRef Instr);
+/**
+ * Obtain the number of operand bundles attached to this instruction.
+ *
+ * This only works on llvm::CallInst and llvm::InvokeInst instructions.
+ *
+ * @see llvm::CallInst::getNumOperandBundles()
+ * @see llvm::InvokeInst::getNumOperandBundles()
+ */
+unsigned LLVMGetNumOperandBundles(LLVMValueRef C);
+
+/**
+ * Obtain the operand bundles attached to this instruction. Use
+ * LLVMDisposeOperandBundle to free the operand bundles.
+ *
+ * The Dest parameter should point to a pre-allocated array of
+ * LLVMOperandBundleRef at least LLVMGetNumOperandBundles() large. On return,
+ * the first LLVMGetNumOperandBundles() entries in the array will be populated
+ * with LLVMOperandBundleRef instances.
+ *
+ * This only works on llvm::CallInst and llvm::InvokeInst instructions.
+ */
+void LLVMGetOperandBundles(LLVMValueRef C, LLVMOperandBundleRef *Dest);
+
+/**
+ * Obtain the operand bundle attached to this instruction at the given index.
+ * Use LLVMDisposeOperandBundle to free the operand bundle.
+ *
+ * This only works on llvm::CallInst and llvm::InvokeInst instructions.
+ */
+LLVMOperandBundleRef LLVMGetOperandBundleAtIndex(LLVMValueRef C,
+ unsigned Index);
+
/**
* Obtain whether a call instruction is a tail call.
*
@@ -3815,6 +3924,11 @@ LLVMValueRef LLVMBuildInvoke2(LLVMBuilderRef, LLVMTypeRef Ty, LLVMValueRef Fn,
LLVMValueRef *Args, unsigned NumArgs,
LLVMBasicBlockRef Then, LLVMBasicBlockRef Catch,
const char *Name);
+LLVMValueRef LLVMBuildInvoke3(LLVMBuilderRef, LLVMTypeRef Ty, LLVMValueRef Fn,
+ LLVMValueRef *Args, unsigned NumArgs,
+ LLVMBasicBlockRef Then, LLVMBasicBlockRef Catch,
+ LLVMOperandBundleRef *Bundles,
+ unsigned NumBundles, const char *Name);
LLVMValueRef LLVMBuildUnreachable(LLVMBuilderRef);
/* Exception Handling */
@@ -4110,6 +4224,10 @@ LLVMValueRef LLVMBuildPhi(LLVMBuilderRef, LLVMTypeRef Ty, const char *Name);
LLVMValueRef LLVMBuildCall2(LLVMBuilderRef, LLVMTypeRef, LLVMValueRef Fn,
LLVMValueRef *Args, unsigned NumArgs,
const char *Name);
+LLVMValueRef LLVMBuildCall3(LLVMBuilderRef, LLVMTypeRef, LLVMValueRef Fn,
+ LLVMValueRef *Args, unsigned NumArgs,
+ LLVMOperandBundleRef *Bundles, unsigned NumBundles,
+ const char *Name);
LLVMValueRef LLVMBuildSelect(LLVMBuilderRef, LLVMValueRef If,
LLVMValueRef Then, LLVMValueRef Else,
const char *Name);
diff --git a/llvm/include/llvm-c/Types.h b/llvm/include/llvm-c/Types.h
index 4e9967372d79f..d5474d986309f 100644
--- a/llvm/include/llvm-c/Types.h
+++ b/llvm/include/llvm-c/Types.h
@@ -132,6 +132,11 @@ typedef struct LLVMOpaquePassManager *LLVMPassManagerRef;
* @see llvm::Use */
typedef struct LLVMOpaqueUse *LLVMUseRef;
+/**
+ * @see llvm::OperandBundleDef
+ */
+typedef struct LLVMOpaqueOperandBundle *LLVMOperandBundleRef;
+
/**
* Used to represent an attributes.
*
diff --git a/llvm/lib/IR/Core.cpp b/llvm/lib/IR/Core.cpp
index e07664f8a17c6..93de5c120949a 100644
--- a/llvm/lib/IR/Core.cpp
+++ b/llvm/lib/IR/Core.cpp
@@ -43,6 +43,8 @@
using namespace llvm;
+DEFINE_SIMPLE_CONVERSION_FUNCTIONS(OperandBundleDef, LLVMOperandBundleRef)
+
#define DEBUG_TYPE "ir"
void llvm::initializeCore(PassRegistry &Registry) {
@@ -2567,6 +2569,40 @@ void LLVMRemoveGlobalIFunc(LLVMValueRef IFunc) {
unwrap<GlobalIFunc>(IFunc)->removeFromParent();
}
+/*--.. Operations on operand bundles........................................--*/
+
+LLVMOperandBundleRef LLVMCreateOperandBundle(const char *Tag, unsigned TagLen,
+ LLVMValueRef *Args,
+ unsigned NumArgs) {
+ return wrap(new OperandBundleDef(std::string(Tag, TagLen),
+ ArrayRef(unwrap(Args), NumArgs)));
+}
+
+void LLVMDisposeOperandBundle(LLVMOperandBundleRef Bundle) {
+ delete unwrap(Bundle);
+}
+
+const char *LLVMGetOperandBundleTag(LLVMOperandBundleRef Bundle, size_t *Len) {
+ StringRef Str = unwrap(Bundle)->getTag();
+ *Len = Str.size();
+ return Str.data();
+}
+
+unsigned LLVMGetNumOperandBundleArgs(LLVMOperandBundleRef Bundle) {
+ return unwrap(Bundle)->inputs().size();
+}
+
+void LLVMGetOperandBundleArgs(LLVMOperandBundleRef Bundle, LLVMValueRef *Dest) {
+ OperandBundleDef *OB = unwrap(Bundle);
+ for (Value *V : OB->inputs())
+ *Dest++ = wrap(V);
+}
+
+LLVMValueRef LLVMGetOperandBundleArgAtIndex(LLVMOperandBundleRef Bundle,
+ unsigned Index) {
+ return wrap(unwrap(Bundle)->inputs()[Index]);
+}
+
/*--.. Operations on basic blocks ..........................................--*/
LLVMValueRef LLVMBasicBlockAsValue(LLVMBasicBlockRef BB) {
@@ -2858,6 +2894,22 @@ LLVMTypeRef LLVMGetCalledFunctionType(LLVMValueRef Instr) {
return wrap(unwrap<CallBase>(Instr)->getFunctionType());
}
+unsigned LLVMGetNumOperandBundles(LLVMValueRef C) {
+ return unwrap<CallBase>(C)->getNumOperandBundles();
+}
+
+void LLVMGetOperandBundles(LLVMValueRef C, LLVMOperandBundleRef *Dest) {
+ auto *Call = unwrap<CallBase>(C);
+ for (unsigned i = 0, e = Call->getNumOperandBundles(); i != e; ++i)
+ *Dest++ = wrap(new OperandBundleDef(Call->getOperandBundleAt(i)));
+}
+
+LLVMOperandBundleRef LLVMGetOperandBundleAtIndex(LLVMValueRef C,
+ unsigned Index) {
+ return wrap(
+ new OperandBundleDef(unwrap<CallBase>(C)->getOperandBundleAt(Index)));
+}
+
/*--.. Operations on call instructions (only) ..............................--*/
LLVMBool LLVMIsTailCall(LLVMValueRef Call) {
@@ -3140,6 +3192,21 @@ LLVMValueRef LLVMBuildInvoke2(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Fn,
ArrayRef(unwrap(Args), NumArgs), Name));
}
+LLVMValueRef LLVMBuildInvoke3(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Fn,
+ LLVMValueRef *Args, unsigned NumArgs,
+ LLVMBasicBlockRef Then, LLVMBasicBlockRef Catch,
+ LLVMOperandBundleRef *Bundles,
+ unsigned NumBundles, const char *Name) {
+ SmallVector<OperandBundleDef, 8> OBs;
+ for (auto *Bundle : ArrayRef(Bundles, NumBundles)) {
+ OperandBundleDef *OB = unwrap(Bundle);
+ OBs.push_back(*OB);
+ }
+ return wrap(unwrap(B)->CreateInvoke(
+ unwrap<FunctionType>(Ty), unwrap(Fn), unwrap(Then), unwrap(Catch),
+ ArrayRef(unwrap(Args), NumArgs), OBs, Name));
+}
+
LLVMValueRef LLVMBuildLandingPad(LLVMBuilderRef B, LLVMTypeRef Ty,
LLVMValueRef PersFn, unsigned NumClauses,
const char *Name) {
@@ -3868,6 +3935,20 @@ LLVMValueRef LLVMBuildCall2(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Fn,
ArrayRef(unwrap(Args), NumArgs), Name));
}
+LLVMValueRef LLVMBuildCall3(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Fn,
+ LLVMValueRef *Args, unsigned NumArgs,
+ LLVMOperandBundleRef *Bundles, unsigned NumBundles,
+ const char *Name) {
+ FunctionType *FTy = unwrap<FunctionType>(Ty);
+ SmallVector<OperandBundleDef, 8> OBs;
+ for (auto *Bundle : ArrayRef(Bundles, NumBundles)) {
+ OperandBundleDef *OB = unwrap(Bundle);
+ OBs.push_back(*OB);
+ }
+ return wrap(unwrap(B)->CreateCall(
+ FTy, unwrap(Fn), ArrayRef(unwrap(Args), NumArgs), OBs, Name));
+}
+
LLVMValueRef LLVMBuildSelect(LLVMBuilderRef B, LLVMValueRef If,
LLVMValueRef Then, LLVMValueRef Else,
const char *Name) {
diff --git a/llvm/test/Bindings/llvm-c/echo.ll b/llvm/test/Bindings/llvm-c/echo.ll
index 72d5b455badcb..c3230109d5b3d 100644
--- a/llvm/test/Bindings/llvm-c/echo.ll
+++ b/llvm/test/Bindings/llvm-c/echo.ll
@@ -268,6 +268,17 @@ exit:
ret void
}
+define void @operandbundles() personality ptr @personalityFn {
+ call void @decl() [ "foo"(), "bar\00x"(i32 0, ptr null, token none) ]
+ invoke void @decl() [ "baz"(label %bar) ] to label %foo unwind label %bar
+foo:
+ ret void
+bar:
+ %1 = landingpad { ptr, i32 }
+ cleanup
+ ret void
+}
+
define void @with_debuginfo() !dbg !4 {
ret void, !dbg !7
}
diff --git a/llvm/tools/llvm-c-test/echo.cpp b/llvm/tools/llvm-c-test/echo.cpp
index 3b07ccb29f3e0..56d05ded83545 100644
--- a/llvm/tools/llvm-c-test/echo.cpp
+++ b/llvm/tools/llvm-c-test/echo.cpp
@@ -548,16 +548,25 @@ struct FunCloner {
break;
case LLVMInvoke: {
SmallVector<LLVMValueRef, 8> Args;
- int ArgCount = LLVMGetNumArgOperands(Src);
- for (int i = 0; i < ArgCount; i++)
+ SmallVector<LLVMOperandBundleRef, 8> Bundles;
+ unsigned ArgCount = LLVMGetNumArgOperands(Src);
+ for (unsigned i = 0; i < ArgCount; ++i)
Args.push_back(CloneValue(LLVMGetOperand(Src, i)));
+ unsigned BundleCount = LLVMGetNumOperandBundles(Src);
+ for (unsigned i = 0; i < BundleCount; ++i) {
+ auto Bundle = LLVMGetOperandBundleAtIndex(Src, i);
+ Bundles.push_back(CloneOB(Bundle));
+ LLVMDisposeOperandBundle(Bundle);
+ }
LLVMTypeRef FnTy = CloneType(LLVMGetCalledFunctionType(Src));
LLVMValueRef Fn = CloneValue(LLVMGetCalledValue(Src));
LLVMBasicBlockRef Then = DeclareBB(LLVMGetNormalDest(Src));
LLVMBasicBlockRef Unwind = DeclareBB(LLVMGetUnwindDest(Src));
- Dst = LLVMBuildInvoke2(Builder, FnTy, Fn, Args.data(), ArgCount,
- Then, Unwind, Name);
+ Dst = LLVMBuildInvoke3(Builder, FnTy, Fn, Args.data(), ArgCount, Then,
+ Unwind, Bundles.data(), Bundles.size(), Name);
CloneAttrs(Src, Dst);
+ for (auto Bundle : Bundles)
+ LLVMDisposeOperandBundle(Bundle);
break;
}
case LLVMUnreachable:
@@ -762,14 +771,24 @@ struct FunCloner {
}
case LLVMCall: {
SmallVector<LLVMValueRef, 8> Args;
- int ArgCount = LLVMGetNumArgOperands(Src);
- for (int i = 0; i < ArgCount; i++)
+ SmallVector<LLVMOperandBundleRef, 8> Bundles;
+ unsigned ArgCount = LLVMGetNumArgOperands(Src);
+ for (unsigned i = 0; i < ArgCount; ++i)
Args.push_back(CloneValue(LLVMGetOperand(Src, i)));
+ unsigned BundleCount = LLVMGetNumOperandBundles(Src);
+ for (unsigned i = 0; i < BundleCount; ++i) {
+ auto Bundle = LLVMGetOperandBundleAtIndex(Src, i);
+ Bundles.push_back(CloneOB(Bundle));
+ LLVMDisposeOperandBundle(Bundle);
+ }
LLVMTypeRef FnTy = CloneType(LLVMGetCalledFunctionType(Src));
LLVMValueRef Fn = CloneValue(LLVMGetCalledValue(Src));
- Dst = LLVMBuildCall2(Builder, FnTy, Fn, Args.data(), ArgCount, Name);
+ Dst = LLVMBuildCall3(Builder, FnTy, Fn, Args.data(), ArgCount,
+ Bundles.data(), Bundles.size(), Name);
LLVMSetTailCallKind(Dst, LLVMGetTailCallKind(Src));
CloneAttrs(Src, Dst);
+ for (auto Bundle : Bundles)
+ LLVMDisposeOperandBundle(Bundle);
break;
}
case LLVMResume: {
@@ -933,6 +952,17 @@ struct FunCloner {
return VMap[Src] = Dst;
}
+ LLVMOperandBundleRef CloneOB(LLVMOperandBundleRef Src) {
+ size_t TagLen;
+ const char *Tag = LLVMGetOperandBundleTag(Src, &TagLen);
+
+ SmallVector<LLVMValueRef, 8> Args;
+ for (unsigned i = 0, n = LLVMGetNumOperandBundleArgs(Src); i != n; ++i)
+ Args.push_back(CloneValue(LLVMGetOperandBundleArgAtIndex(Src, i)));
+
+ return LLVMCreateOperandBundle(Tag, TagLen, Args.data(), Args.size());
+ }
+
LLVMBasicBlockRef DeclareBB(LLVMBasicBlockRef Src) {
// Check if this is something we already computed.
{
>From 8e5546c95dd14d7b89a47809a6707fa21cfba4a0 Mon Sep 17 00:00:00 2001
From: Quinton Miller <nicetas.c at gmail.com>
Date: Fri, 8 Dec 2023 02:10:05 +0800
Subject: [PATCH 2/4] remove index-less accessors
---
llvm/include/llvm-c/Core.h | 22 ----------------------
llvm/lib/IR/Core.cpp | 12 ------------
2 files changed, 34 deletions(-)
diff --git a/llvm/include/llvm-c/Core.h b/llvm/include/llvm-c/Core.h
index 1e63a7d63af04..3ae3e3d8cd1b1 100644
--- a/llvm/include/llvm-c/Core.h
+++ b/llvm/include/llvm-c/Core.h
@@ -3057,15 +3057,6 @@ const char *LLVMGetOperandBundleTag(LLVMOperandBundleRef Bundle, size_t *Len);
*/
unsigned LLVMGetNumOperandBundleArgs(LLVMOperandBundleRef Bundle);
-/**
- * Obtain the operands for an operand bundle.
- *
- * @param Bundle Operand bundle to obtain operands of.
- * @param Dest Memory address of an array to be filled with operands.
- * @see OperandBundleDef::inputs()
- */
-void LLVMGetOperandBundleArgs(LLVMOperandBundleRef Bundle, LLVMValueRef *Dest);
-
/**
* Obtain the operand for an operand bundle at the given index.
*
@@ -3538,19 +3529,6 @@ LLVMValueRef LLVMGetCalledValue(LLVMValueRef Instr);
*/
unsigned LLVMGetNumOperandBundles(LLVMValueRef C);
-/**
- * Obtain the operand bundles attached to this instruction. Use
- * LLVMDisposeOperandBundle to free the operand bundles.
- *
- * The Dest parameter should point to a pre-allocated array of
- * LLVMOperandBundleRef at least LLVMGetNumOperandBundles() large. On return,
- * the first LLVMGetNumOperandBundles() entries in the array will be populated
- * with LLVMOperandBundleRef instances.
- *
- * This only works on llvm::CallInst and llvm::InvokeInst instructions.
- */
-void LLVMGetOperandBundles(LLVMValueRef C, LLVMOperandBundleRef *Dest);
-
/**
* Obtain the operand bundle attached to this instruction at the given index.
* Use LLVMDisposeOperandBundle to free the operand bundle.
diff --git a/llvm/lib/IR/Core.cpp b/llvm/lib/IR/Core.cpp
index 93de5c120949a..812edef4e5241 100644
--- a/llvm/lib/IR/Core.cpp
+++ b/llvm/lib/IR/Core.cpp
@@ -2592,12 +2592,6 @@ unsigned LLVMGetNumOperandBundleArgs(LLVMOperandBundleRef Bundle) {
return unwrap(Bundle)->inputs().size();
}
-void LLVMGetOperandBundleArgs(LLVMOperandBundleRef Bundle, LLVMValueRef *Dest) {
- OperandBundleDef *OB = unwrap(Bundle);
- for (Value *V : OB->inputs())
- *Dest++ = wrap(V);
-}
-
LLVMValueRef LLVMGetOperandBundleArgAtIndex(LLVMOperandBundleRef Bundle,
unsigned Index) {
return wrap(unwrap(Bundle)->inputs()[Index]);
@@ -2898,12 +2892,6 @@ unsigned LLVMGetNumOperandBundles(LLVMValueRef C) {
return unwrap<CallBase>(C)->getNumOperandBundles();
}
-void LLVMGetOperandBundles(LLVMValueRef C, LLVMOperandBundleRef *Dest) {
- auto *Call = unwrap<CallBase>(C);
- for (unsigned i = 0, e = Call->getNumOperandBundles(); i != e; ++i)
- *Dest++ = wrap(new OperandBundleDef(Call->getOperandBundleAt(i)));
-}
-
LLVMOperandBundleRef LLVMGetOperandBundleAtIndex(LLVMValueRef C,
unsigned Index) {
return wrap(
>From 399138b51a3e01fc4a544433e7a6d74a0b01873b Mon Sep 17 00:00:00 2001
From: Quinton Miller <nicetas.c at gmail.com>
Date: Fri, 8 Dec 2023 02:10:52 +0800
Subject: [PATCH 3/4] fix doc
---
llvm/include/llvm-c/Core.h | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/llvm/include/llvm-c/Core.h b/llvm/include/llvm-c/Core.h
index 3ae3e3d8cd1b1..799cb5fd51721 100644
--- a/llvm/include/llvm-c/Core.h
+++ b/llvm/include/llvm-c/Core.h
@@ -3524,8 +3524,7 @@ LLVMValueRef LLVMGetCalledValue(LLVMValueRef Instr);
*
* This only works on llvm::CallInst and llvm::InvokeInst instructions.
*
- * @see llvm::CallInst::getNumOperandBundles()
- * @see llvm::InvokeInst::getNumOperandBundles()
+ * @see llvm::CallBase::getNumOperandBundles()
*/
unsigned LLVMGetNumOperandBundles(LLVMValueRef C);
>From 9d9950f1a1e4dc8be198e0385b66c0957ea8ba10 Mon Sep 17 00:00:00 2001
From: Quinton Miller <nicetas.c at gmail.com>
Date: Fri, 8 Dec 2023 02:11:41 +0800
Subject: [PATCH 4/4] use `size_t` for `TagLen`
---
llvm/include/llvm-c/Core.h | 2 +-
llvm/lib/IR/Core.cpp | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/llvm/include/llvm-c/Core.h b/llvm/include/llvm-c/Core.h
index 799cb5fd51721..8547fad858a05 100644
--- a/llvm/include/llvm-c/Core.h
+++ b/llvm/include/llvm-c/Core.h
@@ -3026,7 +3026,7 @@ LLVMValueRef LLVMMDNode(LLVMValueRef *Vals, unsigned Count);
* @param Args Memory address of an array of bundle operands
* @param NumArgs Length of Args
*/
-LLVMOperandBundleRef LLVMCreateOperandBundle(const char *Tag, unsigned TagLen,
+LLVMOperandBundleRef LLVMCreateOperandBundle(const char *Tag, size_t TagLen,
LLVMValueRef *Args,
unsigned NumArgs);
diff --git a/llvm/lib/IR/Core.cpp b/llvm/lib/IR/Core.cpp
index 812edef4e5241..1a3427a5e6b75 100644
--- a/llvm/lib/IR/Core.cpp
+++ b/llvm/lib/IR/Core.cpp
@@ -2571,7 +2571,7 @@ void LLVMRemoveGlobalIFunc(LLVMValueRef IFunc) {
/*--.. Operations on operand bundles........................................--*/
-LLVMOperandBundleRef LLVMCreateOperandBundle(const char *Tag, unsigned TagLen,
+LLVMOperandBundleRef LLVMCreateOperandBundle(const char *Tag, size_t TagLen,
LLVMValueRef *Args,
unsigned NumArgs) {
return wrap(new OperandBundleDef(std::string(Tag, TagLen),
More information about the llvm-commits
mailing list