You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
let result_ty = unsafe{ llvm::LLVMPointerType(ty, address_space.0)};
124
+
125
+
// Specific workaround for LLVM 7 / NVPTX if LLVMPointerType(ptr, AS) -> ptr
126
+
// This condition checks if we asked for a pointer to a pointer type,
127
+
// but got back the same pointer type (not a pointer-to-pointer).
128
+
if result_ty == ty && unsafe{ llvm::LLVMGetTypeKind(ty) == llvm::TypeKind::Pointer}{
129
+
// Check if 'ty' is specifically the generic data pointer (like i8* in default AS for data).
130
+
// For NVPTX, AddressSpace::DATA is often 0 (Generic) or 1 (Global).
131
+
// Let's assume AddressSpace::DATA (0 for generic ptr) is the one involved.
132
+
let generic_data_ptr_type = self.type_ptr_ext(AddressSpace::DATA);// Gets i8* in AddressSpace::DATA
133
+
134
+
if ty == generic_data_ptr_type {
135
+
// We attempted to create a pointer to the generic data pointer type
136
+
// (e.g., `(i8 addrspace(N))*`) but `LLVMPointerType` returned the
137
+
// generic data pointer type itself (`i8 addrspace(N)*`).
138
+
let i8_llty = self.type_i8();
139
+
let i8_ptr_llty = unsafe{ llvm::LLVMPointerType(i8_llty, address_space.0)};// Should be `i8*` (or `ptr`)
140
+
let i8_ptr_ptr_llty =
141
+
unsafe{ llvm::LLVMPointerType(i8_ptr_llty, address_space.0)};// Should be `i8**` (or `ptr*`)
142
+
143
+
if ty == i8_ptr_llty && result_ty == i8_ptr_llty {
144
+
// If input was i8* (ptr) and output was i8* (ptr)
145
+
// This means LLVMPointerType(i8*, AS) -> i8*
146
+
// We need i8**.
147
+
debug!(
148
+
"Applying LLVMPointerType quirk workaround for ptr-to-ptr. Requested ptr to {:?}, got same. Forcing to pointer to (pointer to i8). Old result: {:?}, New result: {:?}",
0 commit comments