aboutsummaryrefslogtreecommitdiffstats
path: root/backend/Duplicateaux.ml
diff options
context:
space:
mode:
authorCyril SIX <cyril.six@kalray.eu>2020-12-08 15:47:00 +0100
committerCyril SIX <cyril.six@kalray.eu>2020-12-08 15:47:00 +0100
commit9a1d53cd56e21dfca27818d715d527e867f2d68d (patch)
treeeb4fd7e2d0a09d33a03801aa6439f87f259859a4 /backend/Duplicateaux.ml
parent6eeb88eb448485b0649d58628c5a890c927003ec (diff)
downloadcompcert-kvx-9a1d53cd56e21dfca27818d715d527e867f2d68d.tar.gz
compcert-kvx-9a1d53cd56e21dfca27818d715d527e867f2d68d.zip
The last fix for get_loop_info was giving false positives. Fixing that.
Diffstat (limited to 'backend/Duplicateaux.ml')
-rw-r--r--backend/Duplicateaux.ml14
1 files changed, 12 insertions, 2 deletions
diff --git a/backend/Duplicateaux.ml b/backend/Duplicateaux.ml
index 217ba1b2..498cc2c5 100644
--- a/backend/Duplicateaux.ml
+++ b/backend/Duplicateaux.ml
@@ -219,11 +219,21 @@ let get_loop_info is_loop_header bfs_order code =
match rtl_successors inst with
| [] -> false
| [s] -> explore s dest
- | [s1; s2] -> begin
+ | [s1; s2] -> let snapshot_visited = ref !visited in begin
(* Remembering that we tried the ifso node *)
cb_info := PTree.set src true !cb_info;
match explore s1 dest with
- | true -> true
+ | true -> (
+ visited := !snapshot_visited;
+ match explore s2 dest with
+ | true -> begin
+ (* Both paths lead to a loop: we cannot predict the CB
+ * (but the explore still succeeds) *)
+ cb_info := PTree.remove src !cb_info;
+ true
+ end
+ | false -> true (* nothing to do, the explore succeeded *)
+ )
| false -> begin
cb_info := PTree.set src false !cb_info;
match explore s2 dest with