fold-const.c (fold_inf_compare): Avoid creating non-gimple code when we are in gimple...
authorJeff Law <law@redhat.com>
Fri, 11 Jun 2004 03:22:30 +0000 (21:22 -0600)
committerJeff Law <law@gcc.gnu.org>
Fri, 11 Jun 2004 03:22:30 +0000 (21:22 -0600)
        * fold-const.c (fold_inf_compare): Avoid creating non-gimple
        code when we are in gimple form.

        * gcc.c-torture/compile/20040610-1.c: New test.

From-SVN: r82958

gcc/ChangeLog
gcc/fold-const.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/compile/20040610-1.c [new file with mode: 0644]

index 5c44fc3a50df0aec2208f3974984a8ba273a611e..ca94a49eb60e04c77e95a8602de7b40198e11ab6 100644 (file)
@@ -1,3 +1,8 @@
+2004-06-10  Jeff Law  <law@redhat.com>
+
+       * fold-const.c (fold_inf_compare): Avoid creating non-gimple
+       code when we are in gimple form.
+
 2004-06-10  Diego Novillo  <dnovillo@redhat.com>
 
        * Makefile.in (tree-ssanames.o): Depend on TREE_FLOW_H.
index f5bd659fa3423ba47af394654c8f185acd25a529..3a7053e802ec01848d6b09073bfcf9ccf02b72bc 100644 (file)
@@ -5214,6 +5214,12 @@ fold_inf_compare (enum tree_code code, tree type, tree arg0, tree arg1)
       if (! HONOR_NANS (mode))
        return fold (build2 (neg ? GE_EXPR : LE_EXPR, type,
                             arg0, build_real (TREE_TYPE (arg0), max)));
+
+      /* The transformation below creates non-gimple code and thus is
+        not appropriate if we are in gimple form.  */
+      if (in_gimple_form)
+       return NULL_TREE;
+       
       temp = fold (build2 (neg ? LT_EXPR : GT_EXPR, type,
                           arg0, build_real (TREE_TYPE (arg0), max)));
       return fold (build1 (TRUTH_NOT_EXPR, type, temp));
index d54502a9aad34408c843783f4755965874d47ea8..fc42f8b144d349cbef4b14722b18d71e263b13af 100644 (file)
@@ -1,3 +1,7 @@
+2004-06-10  Jeff Law  <law@redhat.com>
+
+       * gcc.c-torture/compile/20040610-1.c: New test.
+
 2004-06-11  Giovanni Bajo  <giovannibajo@gcc.gnu.org>
 
        * g++.old-deja/g++.robertl/eb4.C: Adjust error markers.
diff --git a/gcc/testsuite/gcc.c-torture/compile/20040610-1.c b/gcc/testsuite/gcc.c-torture/compile/20040610-1.c
new file mode 100644 (file)
index 0000000..37fb65c
--- /dev/null
@@ -0,0 +1,5 @@
+int foo (float x)
+{
+        float i = __builtin_inff ();
+        return x != i;
+}