aboutsummaryrefslogtreecommitdiffstats
path: root/backend/Duplicateaux.ml
diff options
context:
space:
mode:
authorCyril SIX <cyril.six@kalray.eu>2020-03-18 15:29:09 +0100
committerCyril SIX <cyril.six@kalray.eu>2020-03-18 15:29:09 +0100
commitd4002956b3fbe9085e685e0c596f776ecfcdafd7 (patch)
treed64f8e63ccc7a19155e6b807edaaaa5af4c09daa /backend/Duplicateaux.ml
parent75be7f9206e495966fdc8c409007a2bcadedddbe (diff)
downloadcompcert-kvx-d4002956b3fbe9085e685e0c596f776ecfcdafd7.tar.gz
compcert-kvx-d4002956b3fbe9085e685e0c596f776ecfcdafd7.zip
Correcting inefficiency in Duplicateaux::bfs
Diffstat (limited to 'backend/Duplicateaux.ml')
-rw-r--r--backend/Duplicateaux.ml4
1 files changed, 2 insertions, 2 deletions
diff --git a/backend/Duplicateaux.ml b/backend/Duplicateaux.ml
index 99a2d9e3..3ffe9aed 100644
--- a/backend/Duplicateaux.ml
+++ b/backend/Duplicateaux.ml
@@ -21,7 +21,7 @@ let bfs code entrypoint = begin
match PTree.get !node code with
| None -> failwith "No such node"
| Some i ->
- bfs_list := !bfs_list @ [!node];
+ bfs_list := !node :: !bfs_list;
match i with
| Icall(_, _, _, _, n) -> Queue.add n to_visit
| Ibuiltin(_, _, _, n) -> Queue.add n to_visit
@@ -31,7 +31,7 @@ let bfs code entrypoint = begin
| Inop n | Iop (_, _, _, n) | Iload (_, _, _, _, _, n) | Istore (_, _, _, _, n) -> Queue.add n to_visit
end
done;
- !bfs_list
+ List.rev !bfs_list
end
end