aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCyril SIX <cyril.six@kalray.eu>2021-04-02 13:16:12 +0200
committerCyril SIX <cyril.six@kalray.eu>2021-04-02 13:16:12 +0200
commitb6b7b6a525e4b0b9fd727ef9d52c1901c3308cf0 (patch)
treed3382384873f1e7253b528a9c8ce391981e82d89
parent6d4dc7ae91e4452332e6f513733135fefd6f7f26 (diff)
downloadcompcert-kvx-b6b7b6a525e4b0b9fd727ef9d52c1901c3308cf0.tar.gz
compcert-kvx-b6b7b6a525e4b0b9fd727ef9d52c1901c3308cf0.zip
More efficient
-rw-r--r--backend/Duplicateaux.ml20
1 files changed, 12 insertions, 8 deletions
diff --git a/backend/Duplicateaux.ml b/backend/Duplicateaux.ml
index e864a370..4d6e7f3a 100644
--- a/backend/Duplicateaux.ml
+++ b/backend/Duplicateaux.ml
@@ -309,14 +309,18 @@ let get_loop_info f is_loop_header bfs_order code =
let mark_body body =
List.iter (fun n ->
match get_some @@ PTree.get n code with
- | Icond (_, _, ifso, ifnot, _) ->
- let b1 = List.mem ifso body in
- let b2 = List.mem ifnot body in
- if (b1 && b2) then ()
- else if (b1 || b2) then begin
- if b1 then loop_info := PTree.set n (Some true) !loop_info
- else if b2 then loop_info := PTree.set n (Some false) !loop_info
- end
+ | Icond (_, _, ifso, ifnot, _) -> begin
+ match PTree.get n !loop_info with
+ | None -> ()
+ | Some _ ->
+ let b1 = List.mem ifso body in
+ let b2 = List.mem ifnot body in
+ if (b1 && b2) then ()
+ else if (b1 || b2) then begin
+ if b1 then loop_info := PTree.set n (Some true) !loop_info
+ else if b2 then loop_info := PTree.set n (Some false) !loop_info
+ end
+ end
| _ -> ()
) body
in let bodymap = get_loop_bodies code f.fn_entrypoint in