aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2023-07-07 23:23:47 +0100
committergingerBill <bill@gingerbill.org>2023-07-07 23:23:47 +0100
commitaa38889704f3518878aeb82cb03d63c8b592ac0e (patch)
tree3821b56affc7aec30643207bb1df4299c5b83261 /src
parent17562e476f9b2ab4177fbe301df66b98f588413e (diff)
Fix issue with pointer casting internal llvm intrinsics
Diffstat (limited to 'src')
-rw-r--r--src/llvm_backend_const.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/llvm_backend_const.cpp b/src/llvm_backend_const.cpp
index efe1e4d45..2a121ff5d 100644
--- a/src/llvm_backend_const.cpp
+++ b/src/llvm_backend_const.cpp
@@ -483,7 +483,10 @@ gb_internal lbValue lb_const_value(lbModule *m, Type *type, ExactValue value, bo
GB_ASSERT(res.value != nullptr);
GB_ASSERT(LLVMGetValueKind(res.value) == LLVMFunctionValueKind);
- res.value = LLVMConstPointerCast(res.value, lb_type(m, res.type));
+ if (LLVMGetIntrinsicID(res.value) == 0) {
+ // NOTE(bill): do not cast intrinsics as they are not really procedures that can be casted
+ res.value = LLVMConstPointerCast(res.value, lb_type(m, res.type));
+ }
return res;
}