summaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-ccp.c
diff options
context:
space:
mode:
authorbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2011-02-01 10:19:18 +0000
committerbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2011-02-01 10:19:18 +0000
commita97c0e1e336366cd53fcd95e00e49fd72b154fa6 (patch)
treee82424aba4ceeda9dfa0e50d5a314603ca415e3d /gcc/tree-ssa-ccp.c
parent6bf1e21f89e43e23336eaa4ee4f40987cd01d495 (diff)
downloadgcc-a97c0e1e336366cd53fcd95e00e49fd72b154fa6.tar.gz
2011-02-01 Basile Starynkevitch <basile@starynkevitch.net>
MELT branch merged with trunk rev 169468 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@169469 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssa-ccp.c')
-rw-r--r--gcc/tree-ssa-ccp.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/gcc/tree-ssa-ccp.c b/gcc/tree-ssa-ccp.c
index 57fc56d8ba7..8b8d996f508 100644
--- a/gcc/tree-ssa-ccp.c
+++ b/gcc/tree-ssa-ccp.c
@@ -1768,8 +1768,8 @@ bit_value_binop_1 (enum tree_code code, tree type,
tree r1type, double_int r1val, double_int r1mask,
tree r2type, double_int r2val, double_int r2mask)
{
- bool uns = (TREE_CODE (r1type) == INTEGER_TYPE
- && TYPE_IS_SIZETYPE (r1type) ? 0 : TYPE_UNSIGNED (r1type));
+ bool uns = (TREE_CODE (type) == INTEGER_TYPE
+ && TYPE_IS_SIZETYPE (type) ? 0 : TYPE_UNSIGNED (type));
/* Assume we'll get a constant result. Use an initial varying value,
we fall back to varying in the end if necessary. */
*mask = double_int_minus_one;
@@ -1836,6 +1836,13 @@ bit_value_binop_1 (enum tree_code code, tree type,
}
else if (shift < 0)
{
+ /* ??? We can have sizetype related inconsistencies in
+ the IL. */
+ if ((TREE_CODE (r1type) == INTEGER_TYPE
+ && (TYPE_IS_SIZETYPE (r1type)
+ ? 0 : TYPE_UNSIGNED (r1type))) != uns)
+ break;
+
shift = -shift;
*mask = double_int_rshift (r1mask, shift,
TYPE_PRECISION (type), !uns);
@@ -1946,6 +1953,14 @@ bit_value_binop_1 (enum tree_code code, tree type,
if (double_int_negative_p (r1mask) || double_int_negative_p (r2mask))
break;
+ /* For comparisons the signedness is in the comparison operands. */
+ uns = (TREE_CODE (r1type) == INTEGER_TYPE
+ && TYPE_IS_SIZETYPE (r1type) ? 0 : TYPE_UNSIGNED (r1type));
+ /* ??? We can have sizetype related inconsistencies in the IL. */
+ if ((TREE_CODE (r2type) == INTEGER_TYPE
+ && TYPE_IS_SIZETYPE (r2type) ? 0 : TYPE_UNSIGNED (r2type)) != uns)
+ break;
+
/* If we know the most significant bits we know the values
value ranges by means of treating varying bits as zero
or one. Do a cross comparison of the max/min pairs. */