about summary refs log tree commit diff
path: root/compiler/rustc_codegen_ssa/src
diff options
context:
space:
mode:
authorCamille GILLOT <gillot.camille@gmail.com>2023-02-11 16:41:37 +0000
committerCamille GILLOT <gillot.camille@gmail.com>2023-02-18 21:35:02 +0000
commit7567f1f31d5e968380b1e1c5088b00a0606ea1a0 (patch)
treec70fcadf98e8e96e03abebf26254cb93a36c05fa /compiler/rustc_codegen_ssa/src
parent1480b1c524cad3a7ee0253496b7b026484e53371 (diff)
downloadrust-7567f1f31d5e968380b1e1c5088b00a0606ea1a0.tar.gz
rust-7567f1f31d5e968380b1e1c5088b00a0606ea1a0.zip
Adapt interpreter.
Diffstat (limited to 'compiler/rustc_codegen_ssa/src')
-rw-r--r--compiler/rustc_codegen_ssa/src/mir/block.rs16
1 files changed, 6 insertions, 10 deletions
diff --git a/compiler/rustc_codegen_ssa/src/mir/block.rs b/compiler/rustc_codegen_ssa/src/mir/block.rs
index a7e74279a13..35f12ac9dbd 100644
--- a/compiler/rustc_codegen_ssa/src/mir/block.rs
+++ b/compiler/rustc_codegen_ssa/src/mir/block.rs
@@ -569,16 +569,12 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
         // checked operation, just a comparison with the minimum
         // value, so we have to check for the assert message.
         if !bx.cx().check_overflow() {
-            if let AssertKind::OverflowNeg(_)
-            | AssertKind::Overflow(
-                mir::BinOp::Add
-                | mir::BinOp::Sub
-                | mir::BinOp::Mul
-                | mir::BinOp::Shl
-                | mir::BinOp::Shr,
-                ..,
-            ) = *msg
-            {
+            let unchecked_overflow = match msg {
+                AssertKind::OverflowNeg(..) => true,
+                AssertKind::Overflow(op, ..) => op.is_checkable(),
+                _ => false,
+            };
+            if unchecked_overflow {
                 const_cond = Some(expected);
             }
         }