summaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
diff options
context:
space:
mode:
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2014-08-15 11:42:01 +0000
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2014-08-15 11:42:01 +0000
commit6dc3d4caa89d76b10918fd3b59d50bc3aec189da (patch)
tree307576c9bd6a9927b6e723588a41415771423135 /gcc/fold-const.c
parentf0da22ea933276f2dc8030b864a96d01d60b42d1 (diff)
downloadgcc-6dc3d4caa89d76b10918fd3b59d50bc3aec189da.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@214013 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r--gcc/fold-const.c26
1 files changed, 4 insertions, 22 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index d4447697215..26c811764ef 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -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;