aboutsummaryrefslogtreecommitdiffstats
path: root/backend
diff options
context:
space:
mode:
authorCyril SIX <cyril.six@kalray.eu>2021-04-28 12:44:30 +0200
committerCyril SIX <cyril.six@kalray.eu>2021-04-28 12:44:30 +0200
commit8b649e6898afeb243a992ab81092c4fd431410d7 (patch)
tree9bee7e4c0e644a023ebfebc9a85fea5050b290fe /backend
parent9faa0b9eb03e37facaf77366d703bb20f4af9461 (diff)
downloadcompcert-kvx-8b649e6898afeb243a992ab81092c4fd431410d7.tar.gz
compcert-kvx-8b649e6898afeb243a992ab81092c4fd431410d7.zip
Do not rotate if the CB was already at the end.
Diffstat (limited to 'backend')
-rw-r--r--backend/Duplicateaux.ml6
1 files changed, 5 insertions, 1 deletions
diff --git a/backend/Duplicateaux.ml b/backend/Duplicateaux.ml
index 425947ce..324acd99 100644
--- a/backend/Duplicateaux.ml
+++ b/backend/Duplicateaux.ml
@@ -1044,9 +1044,13 @@ let extract_upto_icond f code head =
let rotate_inner_loop f code revmap iloop =
let header = extract_upto_icond f code iloop.head in
let limit = !Clflags.option_flooprotate in
- if count_ignore_nops code header > limit then begin
+ let nb_duplicated = count_ignore_nops code header in
+ if nb_duplicated > limit then begin
debug "Loop Rotate: too many nodes to duplicate (%d > %d)" (List.length header) limit;
(code, revmap)
+ end else if nb_duplicated == count_ignore_nops code iloop.body then begin
+ debug "The conditional branch is already at the end! No need to rotate.";
+ (code, revmap)
end else
let (code2, revmap2, dupheader, fwmap) = clone code revmap header in
let code' = ref code2 in