diff options
| author | Folkert de Vries <folkert@folkertdev.nl> | 2025-08-19 22:16:58 +0200 |
|---|---|---|
| committer | Folkert de Vries <folkert@folkertdev.nl> | 2025-08-20 00:35:42 +0200 |
| commit | d25910eaeb3eab25d3bbf9b9815e6d215c202d1f (patch) | |
| tree | c25781e3b114a692b28af15b566c5327e2cf5c9b /compiler/rustc_codegen_llvm/src/intrinsic.rs | |
| parent | 51df7aabbe3140ccca1f63617d7cfdb883509239 (diff) | |
| download | rust-d25910eaeb3eab25d3bbf9b9815e6d215c202d1f.tar.gz rust-d25910eaeb3eab25d3bbf9b9815e6d215c202d1f.zip | |
make `prefetch` intrinsics safe
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/intrinsic.rs')
| -rw-r--r-- | compiler/rustc_codegen_llvm/src/intrinsic.rs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/compiler/rustc_codegen_llvm/src/intrinsic.rs b/compiler/rustc_codegen_llvm/src/intrinsic.rs index 4935f8d7dff..06c3d8ed6bc 100644 --- a/compiler/rustc_codegen_llvm/src/intrinsic.rs +++ b/compiler/rustc_codegen_llvm/src/intrinsic.rs @@ -330,10 +330,16 @@ impl<'ll, 'tcx> IntrinsicCallBuilderMethods<'tcx> for Builder<'_, 'll, 'tcx> { _ => bug!(), }; let ptr = args[0].immediate(); + let locality = fn_args.const_at(1).to_value().valtree.unwrap_leaf().to_u32() as i32; self.call_intrinsic( "llvm.prefetch", &[self.val_ty(ptr)], - &[ptr, self.const_i32(rw), args[1].immediate(), self.const_i32(cache_type)], + &[ + ptr, + self.const_i32(rw), + self.const_i32(locality), + self.const_i32(cache_type), + ], ) } sym::carrying_mul_add => { |
