From 9908a112522d03fb5f0cd2ee9ebfb65bb1313d73 Mon Sep 17 00:00:00 2001 From: irar Date: Tue, 30 Jun 2009 11:33:27 +0000 Subject: [PATCH] PR tree-optimization/40542 * tree-vect-stmts.c (vect_analyze_stmt): Don't vectorize volatile types. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@149090 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 6 ++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/vect/pr40542.c | 14 ++++++++++++++ gcc/tree-vect-stmts.c | 8 ++++++++ 4 files changed, 33 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/vect/pr40542.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 79637f0..644ef85 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2009-06-30 Ira Rosen + + PR tree-optimization/40542 + * tree-vect-stmts.c (vect_analyze_stmt): Don't vectorize volatile + types. + 2009-06-30 Martin Jambor PR tree-optimization/40582 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 49ca9c1..7ab502e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2009-06-30 Ira Rosen + + PR tree-optimization/40542 + * gcc.dg/vect/pr40542.c: New test. + 2009-06-30 Martin Jambor PR tree-optimization/40582 diff --git a/gcc/testsuite/gcc.dg/vect/pr40542.c b/gcc/testsuite/gcc.dg/vect/pr40542.c new file mode 100644 index 0000000..0a82772 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/pr40542.c @@ -0,0 +1,14 @@ +/* { dg-do compile } */ + +void +volarr_cpy(char *d, volatile char *s) +{ + int i; + + for (i = 0; i < 16; i++) + d[i] = s[i]; +} + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail *-*-* } } } */ +/* { dg-final { cleanup-tree-dump "vect" } } */ + diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c index 586e906..1c9415b 100644 --- a/gcc/tree-vect-stmts.c +++ b/gcc/tree-vect-stmts.c @@ -3910,6 +3910,14 @@ vect_analyze_stmt (gimple stmt, bool *need_to_vectorize, slp_tree node) print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM); } + if (gimple_has_volatile_ops (stmt)) + { + if (vect_print_dump_info (REPORT_UNVECTORIZED_LOCATIONS)) + fprintf (vect_dump, "not vectorized: stmt has volatile operands"); + + return false; + } + /* Skip stmts that do not need to be vectorized. In loops this is expected to include: - the COND_EXPR which is the loop exit condition -- 2.7.4