+2009-03-18 Sebastian Pop <sebastian.pop@amd.com>
+
+ PR middle-end/39447
+ * graphite.c (exclude_component_ref): Renamed contains_component_ref_p.
+ (is_simple_operand): Call contains_component_ref_p before calling data
+ reference analysis that would fail on COMPONENT_REFs.
+
+ * tree-vrp.c (search_for_addr_array): Fix formatting.
+
2009-03-18 Richard Guenther <rguenther@suse.de>
* tree-vect-transform.c (vect_loop_versioning): Fold the
|| evolution_function_is_affine_multivariate_p (scev, n));
}
-/* Return false if the tree_code of the operand OP or any of its operands
- is component_ref. */
+/* Return true if REF or any of its subtrees contains a
+ component_ref. */
static bool
-exclude_component_ref (tree op)
+contains_component_ref_p (tree ref)
{
- int i;
- int len;
+ if (!ref)
+ return false;
- if (op)
+ while (handled_component_p (ref))
{
- if (TREE_CODE (op) == COMPONENT_REF)
- return false;
- else
- {
- len = TREE_OPERAND_LENGTH (op);
- for (i = 0; i < len; ++i)
- {
- if (!exclude_component_ref (TREE_OPERAND (op, i)))
- return false;
- }
- }
+ if (TREE_CODE (ref) == COMPONENT_REF)
+ return true;
+
+ ref = TREE_OPERAND (ref, 0);
}
- return true;
+ return false;
}
/* Return true if the operand OP is simple. */
if (DECL_P (op)
/* or a structure, */
|| AGGREGATE_TYPE_P (TREE_TYPE (op))
+ /* or a COMPONENT_REF, */
+ || contains_component_ref_p (op)
/* or a memory access that cannot be analyzed by the data
reference analysis. */
|| ((handled_component_p (op) || INDIRECT_REF_P (op))
&& !stmt_simple_memref_p (loop, stmt, op)))
return false;
- return exclude_component_ref (op);
+ return true;
}
/* Return true only when STMT is simple enough for being handled by
+2009-03-18 Sebastian Pop <sebastian.pop@amd.com>
+
+ PR middle-end/39447
+ * g++.dg/graphite: New.
+ * g++.dg/graphite/graphite.exp: New.
+ * g++.dg/graphite/pr39447.C: New.
+
2009-03-18 H.J. Lu <hongjiu.lu@intel.com>
PR c++/39425
--- /dev/null
+# Copyright (C) 2009 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GCC; see the file COPYING3. If not see
+# <http://www.gnu.org/licenses/>.
+
+# GCC testsuite that uses the `dg.exp' driver.
+
+# Load support procs.
+load_lib g++-dg.exp
+
+if ![check_effective_target_fgraphite] {
+ return
+}
+
+# The default action for a test is 'compile'. Save current default.
+global dg-do-what-default
+set save-dg-do-what-default ${dg-do-what-default}
+set dg-do-what-default compile
+
+# If a testcase doesn't have special options, use these.
+global DEFAULT_CFLAGS
+if ![info exists DEFAULT_CFLAGS] then {
+ set DEFAULT_CFLAGS " -ansi -pedantic-errors"
+}
+
+# Initialize `dg'.
+dg-init
+
+# Main loop.
+dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.C]] \
+ "" $DEFAULT_CFLAGS
+
+# Clean up.
+set dg-do-what-default ${save-dg-do-what-default}
+
+# All done.
+dg-finish
--- /dev/null
+/* { dg-options "-O2 -fgraphite-identity" } */
+
+struct Point
+{
+ int line, col;
+
+ Point( int l = -1, int c = 0 ) throw() : line( l ), col( c ) {}
+ bool operator==( const Point & p ) const throw()
+ { return ( line == p.line && col == p.col ); }
+ bool operator<( const Point & p ) const throw()
+ { return ( line < p.line || ( line == p.line && col < p.col ) ); }
+};
+
+class Buffer
+{
+public:
+ int characters( const int line ) const throw();
+ int pgetc( Point & p ) const throw();
+ Point eof() const throw() { return Point( 0, 0 ); }
+ bool pisvalid( const Point & p ) const throw()
+ { return ( ( p.col >= 0 && p.col < characters( p.line ) ) || p == eof() );
+ }
+ bool save( Point p1 = Point(), Point p2 = Point() ) const;
+};
+
+bool Buffer::save( Point p1, Point p2 ) const
+{
+ if( !this->pisvalid( p1 ) ) p1 = eof();
+ if( !this->pisvalid( p2 ) ) p2 = eof();
+ for( Point p = p1; p < p2; ) { pgetc( p ); }
+ return true;
+}
+
+
address of an ARRAY_REF, and call check_array_ref on it. */
static void
-search_for_addr_array(tree t, const location_t *location)
+search_for_addr_array (tree t, const location_t *location)
{
while (TREE_CODE (t) == SSA_NAME)
{
if (gimple_code (g) != GIMPLE_ASSIGN)
return;
- if (get_gimple_rhs_class (gimple_assign_rhs_code (g)) !=
- GIMPLE_SINGLE_RHS)
+ if (get_gimple_rhs_class (gimple_assign_rhs_code (g))
+ != GIMPLE_SINGLE_RHS)
return;
t = gimple_assign_rhs1 (g);
if (TREE_CODE (t) == ARRAY_REF)
check_array_ref (t, location, true /*ignore_off_by_one*/);
- t = TREE_OPERAND(t,0);
+ t = TREE_OPERAND (t, 0);
}
while (handled_component_p (t));
}