about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-04-23 00:05:31 +0000
committerbors <bors@rust-lang.org>2024-04-23 00:05:31 +0000
commit9cf10bcf5b368de79abc24fc4d50a9d85b377ffa (patch)
tree975fed41d85532188712e2944555a73106f0f538 /compiler/rustc_codegen_llvm/src
parent25087e02b34775520856b6cc15e50f5ed0c35f50 (diff)
parent000d0f9116c24c0e24a30e18bfd84f913b099520 (diff)
downloadrust-9cf10bcf5b368de79abc24fc4d50a9d85b377ffa.tar.gz
rust-9cf10bcf5b368de79abc24fc4d50a9d85b377ffa.zip
Auto merge of #124271 - GuillaumeGomez:rollup-7st9wd7, r=GuillaumeGomez
Rollup of 7 pull requests

Successful merges:

 - #115913 (checked_ilog: improve performance)
 - #124178 ([cleanup] [llvm backend] Prevent creating the same `Instance::mono` multiple times)
 - #124183 (Stop taking `ParamTy`/`ParamConst`/`EarlyParamRegion`/`AliasTy` by ref)
 - #124217 (coverage: Prepare for improved branch coverage)
 - #124230 (Stabilize generic `NonZero`.)
 - #124252 (Improve ICE message for forbidden dep-graph reads.)
 - #124268 (Update books)

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_codegen_llvm/src')
-rw-r--r--compiler/rustc_codegen_llvm/src/consts.rs7
1 files changed, 4 insertions, 3 deletions
diff --git a/compiler/rustc_codegen_llvm/src/consts.rs b/compiler/rustc_codegen_llvm/src/consts.rs
index a62dfe13204..9e85c2d88f9 100644
--- a/compiler/rustc_codegen_llvm/src/consts.rs
+++ b/compiler/rustc_codegen_llvm/src/consts.rs
@@ -260,7 +260,8 @@ impl<'ll> CodegenCx<'ll, '_> {
 
     #[instrument(level = "debug", skip(self, llty))]
     pub(crate) fn get_static_inner(&self, def_id: DefId, llty: &'ll Type) -> &'ll Value {
-        if let Some(&g) = self.instances.borrow().get(&Instance::mono(self.tcx, def_id)) {
+        let instance = Instance::mono(self.tcx, def_id);
+        if let Some(&g) = self.instances.borrow().get(&instance) {
             trace!("used cached value");
             return g;
         }
@@ -273,7 +274,7 @@ impl<'ll> CodegenCx<'ll, '_> {
                  statics defined in the same CGU, but did not for `{def_id:?}`"
         );
 
-        let sym = self.tcx.symbol_name(Instance::mono(self.tcx, def_id)).name;
+        let sym = self.tcx.symbol_name(instance).name;
         let fn_attrs = self.tcx.codegen_fn_attrs(def_id);
 
         debug!(?sym, ?fn_attrs);
@@ -363,7 +364,7 @@ impl<'ll> CodegenCx<'ll, '_> {
             }
         }
 
-        self.instances.borrow_mut().insert(Instance::mono(self.tcx, def_id), g);
+        self.instances.borrow_mut().insert(instance, g);
         g
     }