From 923ea8ada9f68d9e9910ccf9649b14c9b06df67e Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Thu, 17 May 2018 14:19:42 -0700 Subject: [PATCH] Add assertions to check that postopt encoding succeeds. --- lib/codegen/src/postopt.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/codegen/src/postopt.rs b/lib/codegen/src/postopt.rs index 6de918d08d..50661f4cc1 100644 --- a/lib/codegen/src/postopt.rs +++ b/lib/codegen/src/postopt.rs @@ -169,8 +169,10 @@ fn optimize_cpu_flags( ); } } - pos.func.update_encoding(info.cmp_inst, isa).is_ok(); - pos.func.update_encoding(info.br_inst, isa).is_ok(); + let ok = pos.func.update_encoding(info.cmp_inst, isa).is_ok(); + debug_assert!(ok); + let ok = pos.func.update_encoding(info.br_inst, isa).is_ok(); + debug_assert!(ok); } @@ -320,7 +322,8 @@ fn optimize_complex_addresses(pos: &mut EncCursor, inst: Inst, isa: &TargetIsa) } _ => return, } - pos.func.update_encoding(info.inst, isa).is_ok(); + let ok = pos.func.update_encoding(info.inst, isa).is_ok(); + debug_assert!(ok); }