@@ -682,14 +682,23 @@ void code_contractst::apply_loop_contract(
682
682
const irep_idt &function_name,
683
683
goto_functionst::goto_functiont &goto_function)
684
684
{
685
- local_may_aliast local_may_alias (goto_function);
686
- natural_loops_mutablet natural_loops (goto_function.body );
685
+ const bool may_have_loops = std::any_of (
686
+ goto_function.body .instructions .begin (),
687
+ goto_function.body .instructions .end (),
688
+ [](const goto_programt::instructiont &instruction)
689
+ {
690
+ return instruction.is_backwards_goto ();
691
+ });
687
692
688
- if (!natural_loops. loop_map . size () )
693
+ if (!may_have_loops )
689
694
return ;
690
695
691
696
goto_function_inline (
692
697
goto_functions, function_name, ns, log .get_message_handler ());
698
+ goto_functions.update ();
699
+
700
+ local_may_aliast local_may_alias (goto_function);
701
+ natural_loops_mutablet natural_loops (goto_function.body );
693
702
694
703
// A graph node type that stores information about a loop.
695
704
// We create a DAG representing nesting of various loops in goto_function,
@@ -1008,6 +1017,7 @@ bool code_contractst::check_frame_conditions_function(const irep_idt &function)
1008
1017
// Inline all function calls.
1009
1018
goto_function_inline (
1010
1019
goto_functions, function_obj->first , ns, log .get_message_handler ());
1020
+ goto_functions.update ();
1011
1021
1012
1022
// Insert write set inclusion checks.
1013
1023
check_frame_conditions (
0 commit comments