diff options
author | rsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-04-23 10:48:24 +0000 |
---|---|---|
committer | rsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-04-23 10:48:24 +0000 |
commit | 3ac3d9055e4c68394d4c0e134a64449f170fd3cf (patch) | |
tree | c39724d0987b5bb67e20aa2365ebc654dfc19779 /gcc/tree-vrp.c | |
parent | c311b856b2cba0c426fdc646db8ae60a59f035c0 (diff) | |
download | gcc-3ac3d9055e4c68394d4c0e134a64449f170fd3cf.tar.gz |
Avoid redundant extensions
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/wide-int@209690 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-vrp.c')
-rw-r--r-- | gcc/tree-vrp.c | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c index d3df036696d..50cbdd47833 100644 --- a/gcc/tree-vrp.c +++ b/gcc/tree-vrp.c @@ -5125,16 +5125,13 @@ register_edge_assert_for_2 (tree name, edge e, gimple_stmt_iterator bsi, { wide_int minv, maxv, valv, cst2v; wide_int tem, sgnbit; - bool valid_p = false, valn = false, cst2n = false; + bool valid_p = false, valn, cst2n; enum tree_code ccode = comp_code; valv = wide_int::from (val, nprec, UNSIGNED); cst2v = wide_int::from (cst2, nprec, UNSIGNED); - if (TYPE_SIGN (TREE_TYPE (val)) == SIGNED) - { - valn = wi::neg_p (wi::sext (valv, nprec)); - cst2n = wi::neg_p (wi::sext (cst2v, nprec)); - } + valn = wi::neg_p (valv, TYPE_SIGN (TREE_TYPE (val))); + cst2n = wi::neg_p (cst2v, TYPE_SIGN (TREE_TYPE (val))); /* If CST2 doesn't have most significant bit set, but VAL is negative, we have comparison like if ((x & 0x123) > -4) (always true). Just give up. */ @@ -5153,13 +5150,11 @@ register_edge_assert_for_2 (tree name, edge e, gimple_stmt_iterator bsi, have folded the comparison into false) and maximum unsigned value is VAL | ~CST2. */ maxv = valv | ~cst2v; - maxv = wi::zext (maxv, nprec); valid_p = true; break; case NE_EXPR: tem = valv | ~cst2v; - tem = wi::zext (tem, nprec); /* If VAL is 0, handle (X & CST2) != 0 as (X & CST2) > 0U. */ if (valv == 0) { @@ -5176,7 +5171,7 @@ register_edge_assert_for_2 (tree name, edge e, gimple_stmt_iterator bsi, sgnbit = wi::zero (nprec); goto lt_expr; } - if (!cst2n && wi::neg_p (wi::sext (cst2v, nprec))) + if (!cst2n && wi::neg_p (cst2v)) sgnbit = wi::set_bit_in_zero (nprec - 1, nprec); if (sgnbit != 0) { @@ -5245,7 +5240,6 @@ register_edge_assert_for_2 (tree name, edge e, gimple_stmt_iterator bsi, maxv -= 1; } maxv |= ~cst2v; - maxv = wi::zext (maxv, nprec); minv = sgnbit; valid_p = true; break; @@ -5274,7 +5268,6 @@ register_edge_assert_for_2 (tree name, edge e, gimple_stmt_iterator bsi, } maxv -= 1; maxv |= ~cst2v; - maxv = wi::zext (maxv, nprec); minv = sgnbit; valid_p = true; break; @@ -5283,7 +5276,7 @@ register_edge_assert_for_2 (tree name, edge e, gimple_stmt_iterator bsi, break; } if (valid_p - && wi::zext (maxv - minv, nprec) != wi::minus_one (nprec)) + && (maxv - minv) != -1) { tree tmp, new_val, type; int i; |