diff --git a/compiler/gen_llvm/src/llvm/build.rs b/compiler/gen_llvm/src/llvm/build.rs index d1ac16f525..3585dcde7c 100644 --- a/compiler/gen_llvm/src/llvm/build.rs +++ b/compiler/gen_llvm/src/llvm/build.rs @@ -204,12 +204,17 @@ impl<'a, 'ctx, 'env> Env<'a, 'ctx, 'env> { } } - /// The integer type representing a RocList or RocStr when following the C ABI + /// The integer type representing twice the width of a pointer /// /// on 64-bit systems, this is i128 /// on 32-bit systems, this is i64 - pub fn str_list_c_abi(&self) -> IntType<'ctx> { - crate::llvm::convert::str_list_int(self.context, self.target_info) + pub fn twice_ptr_int(&self) -> IntType<'ctx> { + let ctx = self.context; + + match self.target_info.ptr_width() { + roc_target::PtrWidth::Bytes4 => ctx.i64_type(), + roc_target::PtrWidth::Bytes8 => ctx.i128_type(), + } } pub fn small_str_bytes(&self) -> u32 { diff --git a/compiler/gen_llvm/src/llvm/build_str.rs b/compiler/gen_llvm/src/llvm/build_str.rs index 2bd5014986..fb4a2c8c8d 100644 --- a/compiler/gen_llvm/src/llvm/build_str.rs +++ b/compiler/gen_llvm/src/llvm/build_str.rs @@ -359,7 +359,7 @@ pub fn str_from_utf8_range<'a, 'ctx, 'env>( complex_bitcast( env.builder, count_and_start.into(), - env.str_list_c_abi().into(), + env.twice_ptr_int().into(), "to_i128", ), result_ptr.into(),