aboutsummaryrefslogtreecommitdiff
path: root/gcc/config/arm
diff options
context:
space:
mode:
authorAndre Vieira <andre.simoesdiasvieira@arm.com>2024-06-26 11:07:01 +0100
committerAndre Vieira <andre.simoesdiasvieira@arm.com>2024-06-26 11:07:01 +0100
commitad20ad7dddcb052429346ae5f94b4a603925084a (patch)
tree9632c3b39e94099fbc9581eb9d4d4dbc718da86e /gcc/config/arm
parent7fada36c77829a197f63dde0d48ca33139105202 (diff)
arm: make arm_predict_doloop_p reject loops with calls
With the introduction of low overhead loops we defined arm_predict_doloop_p, this is meant to be a low-weight check to rule out loops we are not considering for doloop optimization and it is used by other passes to prevent optimizations that may hurt the doloop optimization later on. The reason these are meant to be lightweight is because it's used by pre-RTL optimizations, meaning we can't do the same checks that doloop does. After the definition of arm_predict_doloop_p, when testing for armv8.1-m.main, tree-ssa/ivopts-3.c failed the scan-dump check as the dump now matched an extra '!= 0' introduced by: Doloop cmp iv use: if (ivtmp_1 != 0) Predict loop 1 can perform doloop optimization later. where previously we had: Predict doloop failure due to target specific checks. and after this patch: Predict doloop failure due to call in loop. Predict doloop failure due to target specific checks. Added a copy of the original tree-ssa/ivopts-3.c as a target specifc test to check for the new dump message. gcc/ChangeLog: * config/arm/arm.cc (arm_predict_doloop_p): Reject loops with function calls that are not builtins. gcc/testsuite/ChangeLog: * gcc.target/arm/mve/ivopts-3.c: New test.
Diffstat (limited to 'gcc/config/arm')
-rw-r--r--gcc/config/arm/arm.cc16
1 files changed, 16 insertions, 0 deletions
diff --git a/gcc/config/arm/arm.cc b/gcc/config/arm/arm.cc
index 7d67d2cfee9..6dab65f493b 100644
--- a/gcc/config/arm/arm.cc
+++ b/gcc/config/arm/arm.cc
@@ -35587,6 +35587,22 @@ arm_predict_doloop_p (struct loop *loop)
" loop bb complexity.\n");
return false;
}
+ else
+ {
+ gimple_stmt_iterator gsi = gsi_after_labels (loop->header);
+ while (!gsi_end_p (gsi))
+ {
+ if (is_gimple_call (gsi_stmt (gsi))
+ && !gimple_call_builtin_p (gsi_stmt (gsi)))
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "Predict doloop failure due to"
+ " call in loop.\n");
+ return false;
+ }
+ gsi_next (&gsi);
+ }
+ }
return true;
}