about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src/builder.rs
diff options
context:
space:
mode:
authorsayantn <sayantn05@gmail.com>2025-06-15 22:13:09 +0530
committersayantn <sayantn05@gmail.com>2025-06-15 22:45:26 +0530
commita9500d6b0b1a97513f79ed8e04b07c5a4f4fc258 (patch)
tree16a4d05a2827f0420e286c17e0f22778c974d3d5 /compiler/rustc_codegen_llvm/src/builder.rs
parent9415f3d8a6ee7314fd5aefeb1f80738850c17355 (diff)
downloadrust-a9500d6b0b1a97513f79ed8e04b07c5a4f4fc258.tar.gz
rust-a9500d6b0b1a97513f79ed8e04b07c5a4f4fc258.zip
Correctly account for different address spaces in LLVM intrinsic invocations
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/builder.rs')
-rw-r--r--compiler/rustc_codegen_llvm/src/builder.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/rustc_codegen_llvm/src/builder.rs b/compiler/rustc_codegen_llvm/src/builder.rs
index 5f099d32aa2..5e9594dd06b 100644
--- a/compiler/rustc_codegen_llvm/src/builder.rs
+++ b/compiler/rustc_codegen_llvm/src/builder.rs
@@ -1394,7 +1394,7 @@ impl<'ll> StaticBuilderMethods for Builder<'_, 'll, '_> {
         let global = self.cx().get_static(def_id);
         if self.cx().tcx.is_thread_local_static(def_id) {
             let pointer =
-                self.call_intrinsic("llvm.threadlocal.address", &[self.type_ptr()], &[global]);
+                self.call_intrinsic("llvm.threadlocal.address", &[self.val_ty(global)], &[global]);
             // Cast to default address space if globals are in a different addrspace
             self.pointercast(pointer, self.type_ptr())
         } else {
@@ -1609,7 +1609,7 @@ impl<'a, 'll, 'tcx> Builder<'a, 'll, 'tcx> {
             return;
         }
 
-        self.call_intrinsic(intrinsic, &[self.type_ptr()], &[self.cx.const_u64(size), ptr]);
+        self.call_intrinsic(intrinsic, &[self.val_ty(ptr)], &[self.cx.const_u64(size), ptr]);
     }
 }
 impl<'a, 'll, CX: Borrow<SCx<'ll>>> GenericBuilder<'a, 'll, CX> {