public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/67681] New: Missed vectorization: induction variable used after loop
@ 2015-09-22 16:41 alalaw01 at gcc dot gnu.org
2015-09-23 7:56 ` [Bug tree-optimization/67681] " rguenth at gcc dot gnu.org
2015-09-23 10:17 ` alalaw01 at gcc dot gnu.org
0 siblings, 2 replies; 3+ messages in thread
From: alalaw01 at gcc dot gnu.org @ 2015-09-22 16:41 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67681
Bug ID: 67681
Summary: Missed vectorization: induction variable used after
loop
Product: gcc
Version: 6.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: alalaw01 at gcc dot gnu.org
Target Milestone: ---
The inner loop here:
void addlog2 (int *data)
{
int i = 1;
for (int j=0; j<=30; j++) {
int max = 1 << j;
if (FOO && i>max) break;
for (; i <= max; i++)
data[i] += j;
}
}
does not vectorize if the if(FOO...) is present:
$ /work/alalaw01/build-aarch64-none-elf/install/bin/aarch64-none-elf-gcc -S -O2
-ftree-vectorize -fdump-tree-vect-details=stdout loop9b.c -DFOO=1 | grep
vectorized
loop9b.c:1:6: note: not vectorized: inner-loop count not invariant.
loop9b.c:8:5: note: === vect_mark_stmts_to_be_vectorized ===
loop9b.c:8:5: note: not vectorized: value used after loop.
loop9b.c:8:5: note: === vect_mark_stmts_to_be_vectorized ===
loop9b.c:8:5: note: not vectorized: value used after loop.
loop9b.c:1:6: note: vectorized 0 loops in function.
$ aarch64-none-elf-gcc -S -O2 -ftree-vectorize -fdump-tree-vect-details=stdout
loop9b.c -DFOO=0 | grep vectorized
loop9b.c:4:3: note: not vectorized: inner-loop count not invariant.
loop9b.c:8:5: note: === vect_mark_stmts_to_be_vectorized ===
loop9b.c:8:5: note: loop vectorized
loop9b.c:1:6: note: vectorized 1 loops in function.
Same with -O3. Of course clever analysis could figure out that i>max is never
true, but even without that, we should be able to get 'i' back afterwards.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug tree-optimization/67681] Missed vectorization: induction variable used after loop
2015-09-22 16:41 [Bug tree-optimization/67681] New: Missed vectorization: induction variable used after loop alalaw01 at gcc dot gnu.org
@ 2015-09-23 7:56 ` rguenth at gcc dot gnu.org
2015-09-23 10:17 ` alalaw01 at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: rguenth at gcc dot gnu.org @ 2015-09-23 7:56 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67681
--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
The outer loop also has multiple exits. The testcase is incomplete (FOO is
undefined).
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug tree-optimization/67681] Missed vectorization: induction variable used after loop
2015-09-22 16:41 [Bug tree-optimization/67681] New: Missed vectorization: induction variable used after loop alalaw01 at gcc dot gnu.org
2015-09-23 7:56 ` [Bug tree-optimization/67681] " rguenth at gcc dot gnu.org
@ 2015-09-23 10:17 ` alalaw01 at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: alalaw01 at gcc dot gnu.org @ 2015-09-23 10:17 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67681
--- Comment #2 from alalaw01 at gcc dot gnu.org ---
Being stupid here, but why does the outer loop having multiple exits matter -
it's the inner loop that should be vectorized?
FOO was a macro used to selectively make the test i>max disappear (enabling
vectorization) - the two commandlines had -DFOO=0 (vectorizes) and -DFOO=1
(doesn't).
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-09-23 10:17 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-22 16:41 [Bug tree-optimization/67681] New: Missed vectorization: induction variable used after loop alalaw01 at gcc dot gnu.org
2015-09-23 7:56 ` [Bug tree-optimization/67681] " rguenth at gcc dot gnu.org
2015-09-23 10:17 ` alalaw01 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).