diff options
| author | The rustc-dev-guide Cronjob Bot <github-actions@github.com> | 2025-04-28 04:02:54 +0000 |
|---|---|---|
| committer | The rustc-dev-guide Cronjob Bot <github-actions@github.com> | 2025-04-28 04:02:54 +0000 |
| commit | aa15830ee2defbac8e784db5510bb914e6e4c820 (patch) | |
| tree | 87e76fd223f1937ee26537e1028d44e7f6b65544 /compiler/rustc_codegen_llvm/src/builder.rs | |
| parent | de491f9b7827961c9a786a562cd996db68bd3b5d (diff) | |
| parent | deb947971c8748f5c6203548ce4af9022f21eaf0 (diff) | |
| download | rust-aa15830ee2defbac8e784db5510bb914e6e4c820.tar.gz rust-aa15830ee2defbac8e784db5510bb914e6e4c820.zip | |
Merge from rustc
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/builder.rs')
| -rw-r--r-- | compiler/rustc_codegen_llvm/src/builder.rs | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/compiler/rustc_codegen_llvm/src/builder.rs b/compiler/rustc_codegen_llvm/src/builder.rs index 27f7f95f100..04c8118b616 100644 --- a/compiler/rustc_codegen_llvm/src/builder.rs +++ b/compiler/rustc_codegen_llvm/src/builder.rs @@ -594,6 +594,7 @@ impl<'a, 'll, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> { fn load(&mut self, ty: &'ll Type, ptr: &'ll Value, align: Align) -> &'ll Value { unsafe { let load = llvm::LLVMBuildLoad2(self.llbuilder, ty, ptr, UNNAMED); + let align = align.min(self.cx().tcx.sess.target.max_reliable_alignment()); llvm::LLVMSetAlignment(load, align.bytes() as c_uint); load } @@ -807,6 +808,7 @@ impl<'a, 'll, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> { assert_eq!(self.cx.type_kind(self.cx.val_ty(ptr)), TypeKind::Pointer); unsafe { let store = llvm::LLVMBuildStore(self.llbuilder, val, ptr); + let align = align.min(self.cx().tcx.sess.target.max_reliable_alignment()); let align = if flags.contains(MemFlags::UNALIGNED) { 1 } else { align.bytes() as c_uint }; llvm::LLVMSetAlignment(store, align); |
