fold-const.c (tree_swap_operands_p): Put all constants last...
authorRichard Biener <rguenther@suse.de>
Fri, 15 Aug 2014 11:42:01 +0000 (11:42 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Fri, 15 Aug 2014 11:42:01 +0000 (11:42 +0000)
2014-08-15  Richard Biener  <rguenther@suse.de>

* fold-const.c (tree_swap_operands_p): Put all constants
last, also strip sign-changing NOPs when considering further
canonicalization.  Canonicalize also when optimizing for size.

From-SVN: r214013

gcc/ChangeLog
gcc/fold-const.c

index 6ec54a5..d768942 100644 (file)
@@ -1,3 +1,9 @@
+2014-08-15  Richard Biener  <rguenther@suse.de>
+
+       * fold-const.c (tree_swap_operands_p): Put all constants
+       last, also strip sign-changing NOPs when considering further
+       canonicalization.  Canonicalize also when optimizing for size.
+
 2014-08-15  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
 
        * config/aarch64/aarch64.c (aarch64_expand_mov_immediate): Move
index d444769..26c8117 100644 (file)
@@ -6642,37 +6642,19 @@ reorder_operands_p (const_tree arg0, const_tree arg1)
 bool
 tree_swap_operands_p (const_tree arg0, const_tree arg1, bool reorder)
 {
-  STRIP_SIGN_NOPS (arg0);
-  STRIP_SIGN_NOPS (arg1);
-
-  if (TREE_CODE (arg1) == INTEGER_CST)
-    return 0;
-  if (TREE_CODE (arg0) == INTEGER_CST)
-    return 1;
-
-  if (TREE_CODE (arg1) == REAL_CST)
+  if (CONSTANT_CLASS_P (arg1))
     return 0;
-  if (TREE_CODE (arg0) == REAL_CST)
+  if (CONSTANT_CLASS_P (arg0))
     return 1;
 
-  if (TREE_CODE (arg1) == FIXED_CST)
-    return 0;
-  if (TREE_CODE (arg0) == FIXED_CST)
-    return 1;
-
-  if (TREE_CODE (arg1) == COMPLEX_CST)
-    return 0;
-  if (TREE_CODE (arg0) == COMPLEX_CST)
-    return 1;
+  STRIP_NOPS (arg0);
+  STRIP_NOPS (arg1);
 
   if (TREE_CONSTANT (arg1))
     return 0;
   if (TREE_CONSTANT (arg0))
     return 1;
 
-  if (optimize_function_for_size_p (cfun))
-    return 0;
-
   if (reorder && flag_evaluation_order
       && (TREE_SIDE_EFFECTS (arg0) || TREE_SIDE_EFFECTS (arg1)))
     return 0;