aboutsummaryrefslogtreecommitdiffstats
path: root/backend
diff options
context:
space:
mode:
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