about summary refs log tree commit diff
path: root/compiler/rustc_codegen_ssa/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-03-18 11:19:30 +0000
committerbors <bors@rust-lang.org>2023-03-18 11:19:30 +0000
commitf177b7cb91acd9debd1ed974e6521edb2ab6b097 (patch)
tree19401efe737d61d8b2ac9fac15cce45dd9ba3cfe /compiler/rustc_codegen_ssa/src
parentdf61fcaec1fdd3b949a7721abfaf37a8ca6e144c (diff)
parent49a152885d6050529f2d71645564c73e205f9da6 (diff)
downloadrust-f177b7cb91acd9debd1ed974e6521edb2ab6b097.tar.gz
rust-f177b7cb91acd9debd1ed974e6521edb2ab6b097.zip
Auto merge of #109303 - matthiaskrgr:rollup-usj4ef5, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #107416 (Error code E0794 for late-bound lifetime parameter error.)
 - #108772 (Speed up tidy quite a lot)
 - #109193 (Add revisions for -Zlower-impl-trait-in-trait-to-assoc-ty fixed tests)
 - #109234 (Tweak implementation of overflow checking assertions)
 - #109238 (Fix generics mismatch errors for RPITITs on -Zlower-impl-trait-in-trait-to-assoc-ty)
 - #109283 (rustdoc: reduce allocations in `visibility_to_src_with_space`)
 - #109287 (Use `size_of_val` instead of manual calculation)
 - #109288 (Stabilise `unix_socket_abstract`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_codegen_ssa/src')
-rw-r--r--compiler/rustc_codegen_ssa/src/glue.rs2
-rw-r--r--compiler/rustc_codegen_ssa/src/mir/block.rs11
2 files changed, 3 insertions, 10 deletions
diff --git a/compiler/rustc_codegen_ssa/src/glue.rs b/compiler/rustc_codegen_ssa/src/glue.rs
index 0f6e6032f9b..c34f1dbf856 100644
--- a/compiler/rustc_codegen_ssa/src/glue.rs
+++ b/compiler/rustc_codegen_ssa/src/glue.rs
@@ -46,7 +46,7 @@ pub fn size_and_align_of_dst<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
                 // NOTE: ideally, we want the effects of both `unchecked_smul` and `unchecked_umul`
                 // (resulting in `mul nsw nuw` in LLVM IR), since we know that the multiplication
                 // cannot signed wrap, and that both operands are non-negative. But at the time of writing,
-                // `BuilderMethods` can't do this, and it doesn't seem to enable any further optimizations.
+                // the `LLVM-C` binding can't do this, and it doesn't seem to enable any further optimizations.
                 bx.unchecked_smul(info.unwrap(), bx.const_usize(unit.size.bytes())),
                 bx.const_usize(unit.align.abi.bytes()),
             )
diff --git a/compiler/rustc_codegen_ssa/src/mir/block.rs b/compiler/rustc_codegen_ssa/src/mir/block.rs
index 71c71d59b7a..f9aa2aecf65 100644
--- a/compiler/rustc_codegen_ssa/src/mir/block.rs
+++ b/compiler/rustc_codegen_ssa/src/mir/block.rs
@@ -563,15 +563,8 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
         // with #[rustc_inherit_overflow_checks] and inlined from
         // another crate (mostly core::num generic/#[inline] fns),
         // while the current crate doesn't use overflow checks.
-        if !bx.cx().check_overflow() {
-            let overflow_not_to_check = match msg {
-                AssertKind::OverflowNeg(..) => true,
-                AssertKind::Overflow(op, ..) => op.is_checkable(),
-                _ => false,
-            };
-            if overflow_not_to_check {
-                const_cond = Some(expected);
-            }
+        if !bx.cx().check_overflow() && msg.is_optional_overflow_check() {
+            const_cond = Some(expected);
         }
 
         // Don't codegen the panic block if success if known.