aboutsummaryrefslogtreecommitdiffstats
path: root/backend/Duplicateaux.ml
diff options
context:
space:
mode:
authorCyril SIX <cyril.six@kalray.eu>2020-10-01 16:51:01 +0200
committerCyril SIX <cyril.six@kalray.eu>2020-10-01 16:51:01 +0200
commit043a6caa766bf1f3508b389cd3c7ae69d596eded (patch)
treed338c06ef30a0ac17913665f1eb847331a487aad /backend/Duplicateaux.ml
parentc61c6f0260498a36821b798fa3686deeb4ef4b6b (diff)
downloadcompcert-kvx-043a6caa766bf1f3508b389cd3c7ae69d596eded.tar.gz
compcert-kvx-043a6caa766bf1f3508b389cd3c7ae69d596eded.zip
Duplicate no longer overwrites existing prediction information
Diffstat (limited to 'backend/Duplicateaux.ml')
-rw-r--r--backend/Duplicateaux.ml11
1 files changed, 9 insertions, 2 deletions
diff --git a/backend/Duplicateaux.ml b/backend/Duplicateaux.ml
index 00819834..1297ec90 100644
--- a/backend/Duplicateaux.ml
+++ b/backend/Duplicateaux.ml
@@ -314,7 +314,9 @@ let get_directions code entrypoint = begin
(* debug "\n"; *)
List.iter (fun n ->
match (get_some @@ PTree.get n code) with
- | Icond (cond, lr, ifso, ifnot, _) ->
+ | Icond (cond, lr, ifso, ifnot, pred) ->
+ (match pred with Some _ -> debug "RTL node %d already has prediction information\n" (P.to_int n)
+ | None ->
(* debug "Analyzing %d.." (P.to_int n); *)
let heuristics = [ do_opcode_heuristic;
do_return_heuristic; do_loop2_heuristic loop_info n; do_loop_heuristic; do_call_heuristic;
@@ -333,6 +335,7 @@ let get_directions code entrypoint = begin
| None -> debug "\tUNSURE\n");
debug "---------------------------------------\n"
end
+ )
| _ -> ()
) bfs_order;
!directions
@@ -340,7 +343,11 @@ let get_directions code entrypoint = begin
end
let update_direction direction = function
-| Icond (cond, lr, n, n', _) -> Icond (cond, lr, n, n', direction)
+| Icond (cond, lr, n, n', pred) ->
+ (* only update if there is no prior existing branch prediction *)
+ (match pred with
+ | None -> Icond (cond, lr, n, n', direction)
+ | Some _ -> Icond (cond, lr, n, n', pred) )
| i -> i
let rec update_direction_rec directions = function