Skip to content

Commit 5abe2dc

Browse files
committed
Do not use void pointer for ptr_mask intrinsic
I couldn't find where exactly it's documented, but apperantly pointers to void type are invalid in llvm - void is only allowed as a return type of functions.
1 parent ccc558a commit 5abe2dc

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

compiler/rustc_codegen_llvm/src/context.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -655,7 +655,6 @@ impl<'ll> CodegenCx<'ll, '_> {
655655

656656
let i8p = self.type_i8p();
657657
let void = self.type_void();
658-
let voidp = self.type_ptr_to(void);
659658
let i1 = self.type_i1();
660659
let t_i8 = self.type_i8();
661660
let t_i16 = self.type_i16();
@@ -899,7 +898,7 @@ impl<'ll> CodegenCx<'ll, '_> {
899898
ifn!("llvm.dbg.value", fn(t_metadata, t_i64, t_metadata) -> void);
900899
}
901900

902-
ifn!("llvm.ptrmask", fn(voidp, t_isize) -> voidp);
901+
ifn!("llvm.ptrmask", fn(i8p, t_isize) -> i8p);
903902

904903
None
905904
}

src/test/codegen/intrinsics/mask.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
// CHECK-LABEL: @mask_ptr
55
// CHECK-SAME: [[WORD:i[0-9]+]] %mask
66
#[no_mangle]
7-
pub fn mask_ptr(ptr: *const u8, mask: usize) -> *const u8 {
7+
pub fn mask_ptr(ptr: *const u16, mask: usize) -> *const u16 {
88
// CHECK: call
9-
// CHECK-SAME: @llvm.ptrmask.p0isVoid.[[WORD]](
9+
// CHECK-SAME: @llvm.ptrmask.p0i8.[[WORD]](
1010
core::intrinsics::ptr_mask(ptr, mask)
1111
}

0 commit comments

Comments
 (0)