From 8b649e6898afeb243a992ab81092c4fd431410d7 Mon Sep 17 00:00:00 2001 From: Cyril SIX Date: Wed, 28 Apr 2021 12:44:30 +0200 Subject: Do not rotate if the CB was already at the end. --- backend/Duplicateaux.ml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'backend/Duplicateaux.ml') 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 -- cgit