Skip to content

Commit 629f7ab

Browse files
committed
Don't perform neg overflow checks when they are disabled
1 parent bfb49e7 commit 629f7ab

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/base.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,13 @@ fn codegen_fn_content(fx: &mut FunctionCx<'_, '_, impl Backend>) {
162162
target,
163163
cleanup: _,
164164
} => {
165+
if !fx.tcx.sess.overflow_checks() {
166+
if let mir::interpret::PanicInfo::OverflowNeg = *msg {
167+
let target = fx.get_ebb(*target);
168+
fx.bcx.ins().jump(target, &[]);
169+
continue;
170+
}
171+
}
165172
let cond = trans_operand(fx, cond).load_scalar(fx);
166173
// TODO HACK brz/brnz for i8/i16 is not yet implemented
167174
let cond = fx.bcx.ins().uextend(types::I32, cond);

0 commit comments

Comments
 (0)