diff options
author | Richard Guenther <rguenther@suse.de> | 2007-02-16 13:41:03 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2007-02-16 13:41:03 +0000 |
commit | 421076b552721090c5901ff4797d155e5a5a69c8 (patch) | |
tree | aca0763151e885e1cc02f3593e3df8c155834feb /gcc/fold-const.c | |
parent | 6eedbf0dced75e0a1a66a13b3c769e7659295def (diff) | |
download | gcc-421076b552721090c5901ff4797d155e5a5a69c8.zip gcc-421076b552721090c5901ff4797d155e5a5a69c8.tar.gz gcc-421076b552721090c5901ff4797d155e5a5a69c8.tar.bz2 |
fold-const.c (tree_swap_operands_p): Treat SSA_NAMEs like DECLs but prefer SSA_NAMEs over DECLs.
2007-02-16 Richard Guenther <rguenther@suse.de>
Christian Bruel <christian.bruel@st.com>
* fold-const.c (tree_swap_operands_p): Treat SSA_NAMEs like
DECLs but prefer SSA_NAMEs over DECLs.
* gcc.dg/strict-overflow-5.c: New testcase.
Co-Authored-By: Christian Bruel <christian.bruel@st.com>
From-SVN: r122040
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r-- | gcc/fold-const.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 3c8636e..946146c 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -6673,11 +6673,6 @@ tree_swap_operands_p (tree arg0, tree arg1, bool reorder) && (TREE_SIDE_EFFECTS (arg0) || TREE_SIDE_EFFECTS (arg1))) return 0; - if (DECL_P (arg1)) - return 0; - if (DECL_P (arg0)) - return 1; - /* It is preferable to swap two SSA_NAME to ensure a canonical form for commutative and comparison operators. Ensuring a canonical form allows the optimizers to find additional redundancies without @@ -6687,6 +6682,18 @@ tree_swap_operands_p (tree arg0, tree arg1, bool reorder) && SSA_NAME_VERSION (arg0) > SSA_NAME_VERSION (arg1)) return 1; + /* Put SSA_NAMEs last. */ + if (TREE_CODE (arg1) == SSA_NAME) + return 0; + if (TREE_CODE (arg0) == SSA_NAME) + return 1; + + /* Put variables last. */ + if (DECL_P (arg1)) + return 0; + if (DECL_P (arg0)) + return 1; + return 0; } |