let wp_loop ((_, cfg, strategy, _, wenv)) res nloop e get_loop_head =
let loop_with_cut_pass1 () =
debug "[wp_loop] propagate";
let obj = get_loop_head nloop in
let obj =
if Cil2cfg.is_back_edge e then obj
else W.tag "BeforeLoop" obj
in obj
in
let loop_with_quantif () =
if Cil2cfg.is_back_edge e then
(debug "[wp_loop] cut at back edge";
W.empty)
else
begin
debug "[wp_loop] quantify";
let obj = get_loop_head nloop in
let head = match Cil2cfg.succ_e cfg nloop with
| [h] -> h
| _ -> assert false
in use_loop_assigns strategy wenv head obj
end
in
if WpStrategy.new_loop_computation strategy
&& R.is_pass1 res
&& loop_with_cut cfg strategy nloop
then
loop_with_cut_pass1 ()
else
match Cil2cfg.node_type nloop with
| Cil2cfg.Vloop (Some true, _) ->
loop_with_quantif ()
| _ ->
Wp_error.unsupported
"non-natural loop without invariant property."