From 5b37d0d711f7b21b374e0f76559d4663bb398742 Mon Sep 17 00:00:00 2001 From: Elliott Slaughter Date: Fri, 2 Feb 2024 16:49:23 -0800 Subject: [PATCH] Fix for missing addrspace cast in LLVM 17. --- src/tcompiler.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/tcompiler.cpp b/src/tcompiler.cpp index 6e76c3ec..fce3b449 100644 --- a/src/tcompiler.cpp +++ b/src/tcompiler.cpp @@ -2828,7 +2828,11 @@ struct FunctionEmitter { #if LLVM_VERSION < 170 return B->CreateBitCast(v, toT->type); #else - return v; + if (fromT->type->getPointerAddressSpace() != toT->type->getPointerAddressSpace()) { + return B->CreateAddrSpaceCast(v, toT->type); + } else { + return v; + } #endif } else { assert(toT->type->isIntegerTy());