public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/36010] New: Loop interchange not performed
@ 2008-04-22 14:56 rguenth at gcc dot gnu dot org
2008-04-22 15:20 ` [Bug tree-optimization/36010] " rguenth at gcc dot gnu dot org
` (3 more replies)
0 siblings, 4 replies; 8+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-04-22 14:56 UTC (permalink / raw)
To: gcc-bugs
For the testcase
double a[16][64], y[64], x[16];
void foo(void)
{
int i, j;
for (j = 0; j < 64; ++j)
for (i = 0; i < 16; ++i)
y[j] = y[j] + a[i][j] * x[i];
}
with -O2 -fno-tree-pre -fno-tree-loop-im -ftree-loop-linear loop interchange
is performed but with PRE or lim moving the load (and the store) from/to
y[j] out of the innermost loop the interchange is no longer performed because
before = gcc_loopnest_to_lambda_loopnest (loop_nest, &oldivs,
&invariants, &lambda_obstack);
returns NULL.
--
Summary: Loop interchange not performed
Product: gcc
Version: 4.4.0
Status: UNCONFIRMED
Keywords: missed-optimization
Severity: normal
Priority: P3
Component: tree-optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: rguenth at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36010
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug tree-optimization/36010] Loop interchange not performed
2008-04-22 14:56 [Bug tree-optimization/36010] New: Loop interchange not performed rguenth at gcc dot gnu dot org
@ 2008-04-22 15:20 ` rguenth at gcc dot gnu dot org
2008-04-22 15:23 ` rguenth at gcc dot gnu dot org
` (2 subsequent siblings)
3 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-04-22 15:20 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from rguenth at gcc dot gnu dot org 2008-04-22 15:19 -------
perfect_nestify needs to be enhanced to handle this I guess. In fact we cannot
distribute these loops but need to undo what PRE/lim do.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36010
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug tree-optimization/36010] Loop interchange not performed
2008-04-22 14:56 [Bug tree-optimization/36010] New: Loop interchange not performed rguenth at gcc dot gnu dot org
2008-04-22 15:20 ` [Bug tree-optimization/36010] " rguenth at gcc dot gnu dot org
@ 2008-04-22 15:23 ` rguenth at gcc dot gnu dot org
2008-05-05 5:21 ` pinskia at gcc dot gnu dot org
2008-12-28 6:36 ` pinskia at gcc dot gnu dot org
3 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-04-22 15:23 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from rguenth at gcc dot gnu dot org 2008-04-22 15:22 -------
Bwaves from SPEC2006 has
...
do l=1,nb
y(l,i,j,k)=0.0d0
do m=1,nb
y(l,i,j,k)=y(l,i,j,k)+
1 a(l,m,i,j,k)*x(m,i,j,k)+
2 axp(l,m,i,j,k)*x(m,ip1,j,k)+
3 ayp(l,m,i,j,k)*x(m,i,jp1,k)+
4 azp(l,m,i,j,k)*x(m,i,j,kp1)+
5 axm(l,m,i,j,k)*x(m,im1,j,k)+
6 aym(l,m,i,j,k)*x(m,i,jm1,k)+
7 azm(l,m,i,j,k)*x(m,i,j,km1)
enddo
enddo
which we don't distribute either (even with PRE/lim turned off).
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36010
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug tree-optimization/36010] Loop interchange not performed
2008-04-22 14:56 [Bug tree-optimization/36010] New: Loop interchange not performed rguenth at gcc dot gnu dot org
2008-04-22 15:20 ` [Bug tree-optimization/36010] " rguenth at gcc dot gnu dot org
2008-04-22 15:23 ` rguenth at gcc dot gnu dot org
@ 2008-05-05 5:21 ` pinskia at gcc dot gnu dot org
2008-12-28 6:36 ` pinskia at gcc dot gnu dot org
3 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-05-05 5:21 UTC (permalink / raw)
To: gcc-bugs
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |pinskia at gcc dot gnu dot
| |org
Severity|normal |enhancement
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36010
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug tree-optimization/36010] Loop interchange not performed
2008-04-22 14:56 [Bug tree-optimization/36010] New: Loop interchange not performed rguenth at gcc dot gnu dot org
` (2 preceding siblings ...)
2008-05-05 5:21 ` pinskia at gcc dot gnu dot org
@ 2008-12-28 6:36 ` pinskia at gcc dot gnu dot org
3 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-12-28 6:36 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from pinskia at gcc dot gnu dot org 2008-12-28 06:33 -------
Confirmed.
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Last reconfirmed|0000-00-00 00:00:00 |2008-12-28 06:33:38
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36010
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug tree-optimization/36010] Loop interchange not performed
[not found] <bug-36010-4@http.gcc.gnu.org/bugzilla/>
2021-12-25 11:15 ` pinskia at gcc dot gnu.org
2023-10-16 12:40 ` aagarwa at gcc dot gnu.org
@ 2023-10-17 7:06 ` rguenth at gcc dot gnu.org
2 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-10-17 7:06 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=36010
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |rguenth at gcc dot gnu.org
--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> ---
Hmm, the condition seems to be superfluous - we don't (in this case?) associate
when moving the load/store back into the loop or when we perform the
interchange?
In fact the comment before the block suggests that.
But yes, with -O2 -floop-interchange -ffast-math we now interchange the
original testcase (and the case from bwaves). This was fixed with
r8-5164-gfbdec14e80e939 which also introduced this check for associativity.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug tree-optimization/36010] Loop interchange not performed
[not found] <bug-36010-4@http.gcc.gnu.org/bugzilla/>
2021-12-25 11:15 ` pinskia at gcc dot gnu.org
@ 2023-10-16 12:40 ` aagarwa at gcc dot gnu.org
2023-10-17 7:06 ` rguenth at gcc dot gnu.org
2 siblings, 0 replies; 8+ messages in thread
From: aagarwa at gcc dot gnu.org @ 2023-10-16 12:40 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=36010
Ajit Kumar Agarwal <aagarwa at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |aagarwa at gcc dot gnu.org
--- Comment #5 from Ajit Kumar Agarwal <aagarwa at gcc dot gnu.org> ---
Use the following flags-fassociative-math -fno-signed-zeros -fno-trapping-math
to make loop-interchange work.
Following code in gcc/gimple-loop-interchange.cc
@@ -514,8 +514,8 @@ loop_cand::analyze_iloop_reduction_var (tree var)
if (! (associative_tree_code (code)
|| (code == MINUS_EXPR
&& use_p->use == gimple_assign_rhs1_ptr (ass)))
|| (FLOAT_TYPE_P (TREE_TYPE (var))
&& ! flag_associative_math))
return false;
}
else
Because of the flag_associative_math conditions at line no: 514 it returns
false and loop interchange doesn't work. Using the above flags make
flag_associative_math as true and loop interchange works.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug tree-optimization/36010] Loop interchange not performed
[not found] <bug-36010-4@http.gcc.gnu.org/bugzilla/>
@ 2021-12-25 11:15 ` pinskia at gcc dot gnu.org
2023-10-16 12:40 ` aagarwa at gcc dot gnu.org
2023-10-17 7:06 ` rguenth at gcc dot gnu.org
2 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-12-25 11:15 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=36010
--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
This is still true, you need still need -fno-tree-pre -fno-tree-loop-im to get
the loop to interchanged.
-O2 -fno-tree-pre -fno-tree-loop-im -floop-interchange works while just -O2
-floop-interchange does not.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2023-10-17 7:06 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-04-22 14:56 [Bug tree-optimization/36010] New: Loop interchange not performed rguenth at gcc dot gnu dot org
2008-04-22 15:20 ` [Bug tree-optimization/36010] " rguenth at gcc dot gnu dot org
2008-04-22 15:23 ` rguenth at gcc dot gnu dot org
2008-05-05 5:21 ` pinskia at gcc dot gnu dot org
2008-12-28 6:36 ` pinskia at gcc dot gnu dot org
[not found] <bug-36010-4@http.gcc.gnu.org/bugzilla/>
2021-12-25 11:15 ` pinskia at gcc dot gnu.org
2023-10-16 12:40 ` aagarwa at gcc dot gnu.org
2023-10-17 7:06 ` rguenth at gcc dot gnu.org
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).