public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [patch] Do not use doloop pattern with pragma Unroll
@ 2020-09-28 18:36 Eric Botcazou
  0 siblings, 0 replies; only message in thread
From: Eric Botcazou @ 2020-09-28 18:36 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 618 bytes --]

Hi,

this fixes the following Ada failure on 64-bit PowerPC:

-FAIL: gnat.dg/unroll4.adb scan-rtl-dump-times loop2_unroll "optimized: loop 
unrolled 7 times" 2

The IVOPTS pass detects a doloop pattern and consequently discombobulates the 
loop sufficiently as to make it hard for the RTL unrolling pass to compute the 
best number of iterations.

Tested on PowerPC64/Linux and x86-64/Linux, OK for the mainline?


2020-09-28  Eric Botcazou  <ebotcazou@adacore.com>

	* tree-ssa-loop-ivopts.c (analyze_and_mark_doloop_use): Bail out if
	the loop is subject to a pragma Unroll with no specific count.

-- 
Eric Botcazou

[-- Attachment #2: p.diff --]
[-- Type: text/x-patch, Size: 418 bytes --]

diff --git a/gcc/tree-ssa-loop-ivopts.c b/gcc/tree-ssa-loop-ivopts.c
index 5acf044161c..da04dd5ba0a 100644
--- a/gcc/tree-ssa-loop-ivopts.c
+++ b/gcc/tree-ssa-loop-ivopts.c
@@ -7947,6 +7947,9 @@ analyze_and_mark_doloop_use (struct ivopts_data *data)
   if (!flag_branch_on_count_reg)
     return;
 
+  if (data->current_loop->unroll == USHRT_MAX)
+    return;
+
   if (!generic_predict_doloop_p (data))
     return;
 

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-09-28 18:36 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-28 18:36 [patch] Do not use doloop pattern with pragma Unroll Eric Botcazou

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).