aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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