OSDN Git Service

PR tree-optimization/19899
authorreichelt <reichelt@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 3 Aug 2005 14:18:56 +0000 (14:18 +0000)
committerreichelt <reichelt@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 3 Aug 2005 14:18:56 +0000 (14:18 +0000)
* Makefile.in (tree-scalar-evolution.o): Add real.h.
* tree-scalar-evolution.c: Include real.h.
(add_to_evolution): Build constant -1 of correct type.

* gcc.dg/tree-ssa/scev-1.c: New test.
* gcc.dg/tree-ssa/scev-2.c: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@102695 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/Makefile.in
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/tree-ssa/scev-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/tree-ssa/scev-2.c [new file with mode: 0644]
gcc/tree-scalar-evolution.c

index 21d87f2..c5893c9 100644 (file)
@@ -1,3 +1,10 @@
+2005-08-03  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>
+
+       PR tree-optimization/19899
+       * Makefile.in (tree-scalar-evolution.o): Add real.h.
+       * tree-scalar-evolution.c: Include real.h.
+       (add_to_evolution): Build constant -1 of correct type.
+
 2005-08-03  Jan Hubicka  <jh@suse.cz>
 
        * cfgloop.h (DLTHE_FLAG_COMPLETTE_PEEL): New flag.
index ab3a164..e45a03c 100644 (file)
@@ -1945,7 +1945,7 @@ tree-chrec.o: tree-chrec.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
    $(GGC_H) $(TREE_H) tree-chrec.h tree-pass.h $(PARAMS_H) \
    $(DIAGNOSTIC_H) $(VARRAY_H) $(CFGLOOP_H) $(TREE_FLOW_H)
 tree-scalar-evolution.o: tree-scalar-evolution.c $(CONFIG_H) $(SYSTEM_H) \
-   coretypes.h $(TM_H) $(GGC_H) $(TREE_H) $(RTL_H) \
+   coretypes.h $(TM_H) $(GGC_H) $(TREE_H) real.h $(RTL_H) \
    $(BASIC_BLOCK_H) $(DIAGNOSTIC_H) $(TREE_FLOW_H) $(TREE_DUMP_H) \
    $(TIMEVAR_H) $(CFGLOOP_H) $(SCEV_H) tree-pass.h $(FLAGS_H) tree-chrec.h
 tree-data-ref.o: tree-data-ref.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
index fa68ac5..dbafe3a 100644 (file)
@@ -1,3 +1,9 @@
+2005-08-03  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>
+
+       PR tree-optimization/19899
+       * gcc.dg/tree-ssa/scev-1.c: New test.
+       * gcc.dg/tree-ssa/scev-2.c: New test.
+
 2005-08-03  Richard Sandiford  <richard@codesourcery.com>
 
        PR target/18582
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/scev-1.c b/gcc/testsuite/gcc.dg/tree-ssa/scev-1.c
new file mode 100644 (file)
index 0000000..b959fa1
--- /dev/null
@@ -0,0 +1,19 @@
+/* PR tree-optimization/19899 */
+/* Decrementing a floating-point variable in a loop caused an ICE.  */
+
+/* { dg-do run } */
+/* { dg-options "-O -ftree-vectorize" } */
+
+extern void abort (void);
+
+int main()
+{
+  float i=1;
+
+  while (i>=0)
+    --i;
+
+  if (i != -1)
+    abort();
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/scev-2.c b/gcc/testsuite/gcc.dg/tree-ssa/scev-2.c
new file mode 100644 (file)
index 0000000..0cac994
--- /dev/null
@@ -0,0 +1,20 @@
+/* PR tree-optimization/19899 */
+/* Decrementing a floating-point variable in a loop caused an ICE.  */
+
+/* { dg-do run } */
+/* { dg-options "-O -ftree-vectorize" } */
+
+extern void abort (void);
+
+int main()
+{
+  double a = 20;
+  int i;
+
+  for (i = 0; i < 10; ++i)
+    a -= 2;
+
+  if (a)
+    abort();
+  return 0;
+}
index 52a2d1a..507e3e9 100644 (file)
@@ -237,6 +237,7 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
 #include "tm.h"
 #include "ggc.h"
 #include "tree.h"
+#include "real.h"
 
 /* These RTL headers are needed for basic-block.h.  */
 #include "rtl.h"
@@ -866,8 +867,9 @@ add_to_evolution (unsigned loop_nb,
     }
 
   if (code == MINUS_EXPR)
-    to_add = chrec_fold_multiply (type, to_add, 
-                                 build_int_cst_type (type, -1));
+    to_add = chrec_fold_multiply (type, to_add, SCALAR_FLOAT_TYPE_P (type)
+                                 ? build_real (type, dconstm1)
+                                 : build_int_cst_type (type, -1));
 
   res = add_to_evolution_1 (loop_nb, chrec_before, to_add);