diff options
author | Richard Guenther <rguenther@suse.de> | 2007-07-20 18:10:57 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2007-07-20 18:10:57 +0000 |
commit | d40055abb19399588b3dbeeefc76daaf227045fd (patch) | |
tree | 556ceba04b72aa441d18c7f074ee5a57244e0fec /gcc/tree-ssa.c | |
parent | 4d40a94f24868bb8b78586826ede11be038539d3 (diff) | |
download | gcc-d40055abb19399588b3dbeeefc76daaf227045fd.zip gcc-d40055abb19399588b3dbeeefc76daaf227045fd.tar.gz gcc-d40055abb19399588b3dbeeefc76daaf227045fd.tar.bz2 |
tree-cfg.c (verify_expr): COND_EXPRs can have any integral typed condition.
2007-07-20 Richard Guenther <rguenther@suse.de>
* tree-cfg.c (verify_expr): COND_EXPRs can have any
integral typed condition.
* tree-ssa.c (useless_type_conversion_p): Do not preserve
booleanness. Only preserve conversions from a non-base
type to a base type, not in general between types with
different TYPE_MIN_VALUE or TYPE_MAX_VALUE.
* tree.def (COND_EXPR): Document that the condition
can be of any integral type.
From-SVN: r126804
Diffstat (limited to 'gcc/tree-ssa.c')
-rw-r--r-- | gcc/tree-ssa.c | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c index db16f23..858745e 100644 --- a/gcc/tree-ssa.c +++ b/gcc/tree-ssa.c @@ -940,23 +940,18 @@ useless_type_conversion_p (tree outer_type, tree inner_type) || TYPE_PRECISION (inner_type) != TYPE_PRECISION (outer_type)) return false; - /* Preserve booleanness. Some code assumes an invariant that boolean - types stay boolean and do not become 1-bit bit-field types. */ - if ((TREE_CODE (inner_type) == BOOLEAN_TYPE) - != (TREE_CODE (outer_type) == BOOLEAN_TYPE)) + /* Conversions from a non-base to a base type are not useless. + This way we preserve the invariant to do arithmetic in + base types only. */ + if (TREE_TYPE (inner_type) + && TREE_TYPE (inner_type) != inner_type + && (TREE_TYPE (outer_type) == outer_type + || TREE_TYPE (outer_type) == NULL_TREE)) return false; - /* Preserve changes in the types minimum or maximum value. - ??? Due to the way we handle sizetype as signed we need - to jump through hoops here to make sizetype and size_type_node - compatible. */ - if (!tree_int_cst_equal (fold_convert (outer_type, - TYPE_MIN_VALUE (inner_type)), - TYPE_MIN_VALUE (outer_type)) - || !tree_int_cst_equal (fold_convert (outer_type, - TYPE_MAX_VALUE (inner_type)), - TYPE_MAX_VALUE (outer_type))) - return false; + /* We don't need to preserve changes in the types minimum or + maximum value in general as these do not generate code + unless the types precisions are different. */ return true; } |