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
// Now, check if our input `ty` IS this canonical generic data pointer
140
+
// AND if we were trying to create a pointer to it in the *same* AddressSpace::DATA.
141
+
// (If address_space was different, LLVM should naturally create a new pointer type).
142
+
if ty == canonical_generic_ptr_llty_in_data_as && address_space == AddressSpace::DATA{
143
+
// We tried to make `(i8* AS_DATA)* AS_DATA` but got `i8* AS_DATA` back.
144
+
// This is the problematic case. We need to force what should be `(i8*
145
+
// AS_DATA)* AS_DATA`.
146
+
let ptr_to_canonical_generic_ptr_llty = unsafe{
147
+
llvm::LLVMPointerType(
148
+
canonical_generic_ptr_llty_in_data_as,
149
+
AddressSpace::DATA.0,
150
+
)
151
+
};
152
+
153
+
// If ptr_to_canonical_generic_ptr_llty is *still* the same as canonical_generic_ptr_llty,
154
+
// then LLVM 7 truly cannot make a distinct `ptr*` from `ptr` using LLVMPointerType
155
+
if ptr_to_canonical_generic_ptr_llty != canonical_generic_ptr_llty {
146
156
tracing::debug!(
147
-
"Applying LLVMPointerType quirk workaround for ptr-to-ptr. Requested ptr to {:?}, got same. Forcing to pointer to (pointer to i8). Old result: {:?}, New result: {:?}",
157
+
"type_ptr_to_ext: Quirk detected for generic ptr. Input ty: {:?}, Requested AS: {:?}. Initial result: {:?}. Forced to: {:?}",
148
158
ty,
159
+
address_space.0,
149
160
result_ty,
150
-
i8_ptr_ptr_llty
161
+
ptr_to_canonical_generic_ptr_llty
162
+
);
163
+
return ptr_to_canonical_generic_ptr_llty;
164
+
}else{
165
+
// This case means LLVMPointerType(i8*_AS_DATA, AS_DATA) -> i8*_AS_DATA
166
+
// AND LLVMPointerType( (i8*_AS_DATA), AS_DATA) -> i8*_AS_DATA (still!)
167
+
tracing::warn!(
168
+
"type_ptr_to_ext: LLVM 7 / NVPTX ptr quirk: LLVMPointerType cannot create distinct ptr-to-ptr for generic ptr type {:?}. This will likely lead to errors.",
169
+
ty
151
170
);
152
-
return i8_ptr_ptr_llty;
171
+
// Return original result_ty, as we can't improve it.
0 commit comments