diff options
author | Cyril SIX <cyril.six@kalray.eu> | 2020-12-17 17:14:16 +0100 |
---|---|---|
committer | Cyril SIX <cyril.six@kalray.eu> | 2020-12-17 17:14:16 +0100 |
commit | 5cde069e26618913905f4a8b64701b93bece5038 (patch) | |
tree | 8b1203f71bacd2819179192c60e40ba0389ccf21 | |
parent | eb27f1f3670b95f30c5bfbf08e05f7bb95cbdb22 (diff) | |
download | compcert-kvx-5cde069e26618913905f4a8b64701b93bece5038.tar.gz compcert-kvx-5cde069e26618913905f4a8b64701b93bece5038.zip |
Fixing too many loads being NOTRAP
-rw-r--r-- | scheduling/RTLpathScheduleraux.ml | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/scheduling/RTLpathScheduleraux.ml b/scheduling/RTLpathScheduleraux.ml index 22ac47c9..d5646a2b 100644 --- a/scheduling/RTLpathScheduleraux.ml +++ b/scheduling/RTLpathScheduleraux.ml @@ -237,6 +237,12 @@ let find_array arr n = !index end +let rec hashedset_from_list = function + | [] -> HashedSet.PSet.empty + | n::ln -> HashedSet.PSet.add n (hashedset_from_list ln) + +let hashedset_map f hs = hashedset_from_list @@ List.map f @@ HashedSet.PSet.elements hs + let apply_schedule code sb new_order = let tc = ref code in let old_order = sb.instructions in @@ -281,14 +287,14 @@ let apply_schedule code sb new_order = (* 1) We remember which CBs are "above" a given load *) let cbs_above = count_cbs old_order code in (* 2) We do the same for new_order *) - let cbs_above' = count_cbs new_order !tc in + let cbs_above' = count_cbs (Array.map fmap new_order) !tc in (* 3) We examine each load, turn it back into trapping if cbs_above is included in cbs_above' *) Array.iter (fun n -> let n' = fmap n in let inst' = get_some @@ PTree.get n' !tc in match inst' with - | Iload (t,a,b,c,d,s) -> dprintf "Examining load number %d\n" (P.to_int n'); - let pset = get_some @@ PTree.get n cbs_above in + | Iload (t,a,b,c,d,s) -> + let pset = hashedset_map fmap @@ get_some @@ PTree.get n cbs_above in let pset' = get_some @@ PTree.get n' cbs_above' in if HashedSet.PSet.is_subset pset pset' then tc := PTree.set n' (Iload (AST.TRAP,a,b,c,d,s)) !tc else assert !config.has_non_trapping_loads |