Skip to content

Commit

Permalink
Auto merge of #122849 - clubby789:no-metadata, r=<try>
Browse files Browse the repository at this point in the history
Don't emit load metadata in debug mode

r? `@ghost`
  • Loading branch information
bors committed Mar 21, 2024
2 parents a0569fa + c182684 commit 53fb63d
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions compiler/rustc_codegen_llvm/src/builder.rs
Expand Up @@ -20,6 +20,7 @@ use rustc_middle::ty::layout::{
FnAbiError, FnAbiOfHelpers, FnAbiRequest, LayoutError, LayoutOfHelpers, TyAndLayout,
};
use rustc_middle::ty::{self, Ty, TyCtxt};
use rustc_session::config::OptLevel;
use rustc_span::Span;
use rustc_symbol_mangling::typeid::{kcfi_typeid_for_fnabi, typeid_for_fnabi, TypeIdOptions};
use rustc_target::abi::{self, call::FnAbi, Align, Size, WrappingRange};
Expand Down Expand Up @@ -547,6 +548,11 @@ impl<'a, 'll, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
layout: TyAndLayout<'tcx>,
offset: Size,
) {
if bx.cx.sess().opts.optimize == OptLevel::No {
// Don't emit metadata we're not going to use
return;
}

if !scalar.is_uninit_valid() {
bx.noundef_metadata(load);
}
Expand Down Expand Up @@ -663,6 +669,11 @@ impl<'a, 'll, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
return;
}

if self.cx.sess().opts.optimize == OptLevel::No {
// Don't emit metadata we're not going to use
return;
}

unsafe {
let llty = self.cx.val_ty(load);
let v = [
Expand Down

0 comments on commit 53fb63d

Please sign in to comment.