diff options
author | Richard Biener <rguenther@suse.de> | 2014-11-11 13:23:26 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2014-11-11 13:23:26 +0000 |
commit | cc7b5acf3761c358bf9705f58b4fcf9625c49b0e (patch) | |
tree | 97ff581f26d92d0c274ac9fe16ef63b259ee439a /gcc/tree.c | |
parent | 9310366b70c4953aff526ec62d0405dc729d5edf (diff) | |
download | gcc-cc7b5acf3761c358bf9705f58b4fcf9625c49b0e.zip gcc-cc7b5acf3761c358bf9705f58b4fcf9625c49b0e.tar.gz gcc-cc7b5acf3761c358bf9705f58b4fcf9625c49b0e.tar.bz2 |
match.pd: Implement patterns from associate_plusminus and factor in differences from the...
2014-11-11 Richard Biener <rguenther@suse.de>
* match.pd: Implement patterns from associate_plusminus
and factor in differences from the fold-const.c implementation.
* fold-const.c (fold_binary_loc): Remove patterns here.
* tree-ssa-forwprop.c (associate_plusminus): Remove.
(pass_forwprop::execute): Don't call it.
* tree.c (tree_nop_conversion_p): New function, factored
from tree_nop_conversion.
* tree.h (tree_nop_conversion_p): Declare.
From-SVN: r217349
Diffstat (limited to 'gcc/tree.c')
-rw-r--r-- | gcc/tree.c | 35 |
1 files changed, 22 insertions, 13 deletions
@@ -11659,6 +11659,27 @@ block_ultimate_origin (const_tree block) } } +/* Return true iff conversion from INNER_TYPE to OUTER_TYPE generates + no instruction. */ + +bool +tree_nop_conversion_p (const_tree outer_type, const_tree inner_type) +{ + /* Use precision rather then machine mode when we can, which gives + the correct answer even for submode (bit-field) types. */ + if ((INTEGRAL_TYPE_P (outer_type) + || POINTER_TYPE_P (outer_type) + || TREE_CODE (outer_type) == OFFSET_TYPE) + && (INTEGRAL_TYPE_P (inner_type) + || POINTER_TYPE_P (inner_type) + || TREE_CODE (inner_type) == OFFSET_TYPE)) + return TYPE_PRECISION (outer_type) == TYPE_PRECISION (inner_type); + + /* Otherwise fall back on comparing machine modes (e.g. for + aggregate types, floats). */ + return TYPE_MODE (outer_type) == TYPE_MODE (inner_type); +} + /* Return true iff conversion in EXP generates no instruction. Mark it inline so that we fully inline into the stripping functions even though we have two uses of this function. */ @@ -11680,19 +11701,7 @@ tree_nop_conversion (const_tree exp) if (!inner_type) return false; - /* Use precision rather then machine mode when we can, which gives - the correct answer even for submode (bit-field) types. */ - if ((INTEGRAL_TYPE_P (outer_type) - || POINTER_TYPE_P (outer_type) - || TREE_CODE (outer_type) == OFFSET_TYPE) - && (INTEGRAL_TYPE_P (inner_type) - || POINTER_TYPE_P (inner_type) - || TREE_CODE (inner_type) == OFFSET_TYPE)) - return TYPE_PRECISION (outer_type) == TYPE_PRECISION (inner_type); - - /* Otherwise fall back on comparing machine modes (e.g. for - aggregate types, floats). */ - return TYPE_MODE (outer_type) == TYPE_MODE (inner_type); + return tree_nop_conversion_p (outer_type, inner_type); } /* Return true iff conversion in EXP generates no instruction. Don't |