summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorspop <spop@138bc75d-0d04-0410-961f-82ee72b054a4>2010-09-30 21:21:56 +0000
committerspop <spop@138bc75d-0d04-0410-961f-82ee72b054a4>2010-09-30 21:21:56 +0000
commit9f6a9eedf595dc89a0a0477a7e9199e8fa096df4 (patch)
tree30622788bbcd93f8af7300ff9ff76c12c53c2c92
parentd42ff7d1da81007ac23e748be40fa445ab0a9b6b (diff)
downloadgcc-9f6a9eedf595dc89a0a0477a7e9199e8fa096df4.tar.gz
Fix miscompilation of 416.gamess.
2010-09-23 Sebastian Pop <sebastian.pop@amd.com> * sese.h (scev_analyzable_p): Return false for real or floating point. Only handle INTEGRAL_TYPE_P and POINTER_TYPE_P. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@164812 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/ChangeLog.graphite5
-rw-r--r--gcc/sese.h19
3 files changed, 26 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 835e87beff2..e0d95730f55 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,10 @@
2010-09-30 Sebastian Pop <sebastian.pop@amd.com>
+ * sese.h (scev_analyzable_p): Return false for real or floating
+ point. Only handle INTEGRAL_TYPE_P and POINTER_TYPE_P.
+
+2010-09-30 Sebastian Pop <sebastian.pop@amd.com>
+
* graphite-clast-to-gimple.c (compute_bounds_for_level): Free le
and ps.
* graphite-poly.c (pbb_number_of_iterations_at_time): Free le and
diff --git a/gcc/ChangeLog.graphite b/gcc/ChangeLog.graphite
index af6d053aaf0..0c632df22a8 100644
--- a/gcc/ChangeLog.graphite
+++ b/gcc/ChangeLog.graphite
@@ -1,5 +1,10 @@
2010-09-23 Sebastian Pop <sebastian.pop@amd.com>
+ * sese.h (scev_analyzable_p): Return false for real or floating
+ point. Only handle INTEGRAL_TYPE_P and POINTER_TYPE_P.
+
+2010-09-23 Sebastian Pop <sebastian.pop@amd.com>
+
PR middle-end/45758
* gfortran.dg/graphite/pr45758.f90: New.
diff --git a/gcc/sese.h b/gcc/sese.h
index 8277f68ae7e..61f3a17b9b7 100644
--- a/gcc/sese.h
+++ b/gcc/sese.h
@@ -386,9 +386,22 @@ nb_common_loops (sese region, gimple_bb_p gbb1, gimple_bb_p gbb2)
static inline bool
scev_analyzable_p (tree def, sese region)
{
- gimple stmt = SSA_NAME_DEF_STMT (def);
- loop_p loop = loop_containing_stmt (stmt);
- tree scev = scalar_evolution_in_region (region, loop, def);
+ loop_p loop;
+ tree scev;
+ tree type = TREE_TYPE (def);
+
+ /* When Graphite generates code for a scev, the code generator
+ expresses the scev in function of a single induction variable.
+ This is unsafe for floating point computations, as it may replace
+ a floating point sum reduction with a multiplication. The
+ following test returns false for non integer types to avoid such
+ problems. */
+ if (!INTEGRAL_TYPE_P (type)
+ && !POINTER_TYPE_P (type))
+ return false;
+
+ loop = loop_containing_stmt (SSA_NAME_DEF_STMT (def));
+ scev = scalar_evolution_in_region (region, loop, def);
return !chrec_contains_undetermined (scev)
&& TREE_CODE (scev) != SSA_NAME