From 06db54a544459acef195afab16cffe7988ab3dc1 Mon Sep 17 00:00:00 2001 From: Elliott Slaughter Date: Fri, 2 Feb 2024 16:50:53 -0800 Subject: [PATCH] Fix for missing addrspace cast in LLVM 17. --- src/tcompiler.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/tcompiler.cpp b/src/tcompiler.cpp index 6e76c3ec..abd18bb2 100644 --- a/src/tcompiler.cpp +++ b/src/tcompiler.cpp @@ -2828,7 +2828,12 @@ 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());