[llvm] [llvm-c] Provide LLVMGetGEPResultElementType (PR #95693)
via llvm-commits
llvm-commits at lists.llvm.org
Sun Jun 16 01:48:41 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-ir
Author: Vaivaswatha N (vaivaswatha)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/95693.diff
2 Files Affected:
- (modified) llvm/include/llvm-c/Core.h (+5)
- (modified) llvm/lib/IR/Core.cpp (+4)
``````````diff
diff --git a/llvm/include/llvm-c/Core.h b/llvm/include/llvm-c/Core.h
index 7de99c3a6038d..c7668b4760575 100644
--- a/llvm/include/llvm-c/Core.h
+++ b/llvm/include/llvm-c/Core.h
@@ -3869,6 +3869,11 @@ void LLVMSetIsInBounds(LLVMValueRef GEP, LLVMBool InBounds);
*/
LLVMTypeRef LLVMGetGEPSourceElementType(LLVMValueRef GEP);
+/**
+ * Get the result element type of the given GEP operator.
+ */
+LLVMTypeRef LLVMGetGEPResultElementType(LLVMValueRef GEP);
+
/**
* @}
*/
diff --git a/llvm/lib/IR/Core.cpp b/llvm/lib/IR/Core.cpp
index 3a91a4eb6e0d1..5b0a3014e5543 100644
--- a/llvm/lib/IR/Core.cpp
+++ b/llvm/lib/IR/Core.cpp
@@ -3081,6 +3081,10 @@ LLVMTypeRef LLVMGetGEPSourceElementType(LLVMValueRef GEP) {
return wrap(unwrap<GEPOperator>(GEP)->getSourceElementType());
}
+LLVMTypeRef LLVMGetGEPResultElementType(LLVMValueRef GEP) {
+ return wrap(unwrap<GEPOperator>(GEP)->getResultElementType());
+}
+
/*--.. Operations on phi nodes .............................................--*/
void LLVMAddIncoming(LLVMValueRef PhiNode, LLVMValueRef *IncomingValues,
``````````
</details>
https://github.com/llvm/llvm-project/pull/95693
More information about the llvm-commits
mailing list