From: jakub Date: Wed, 25 Aug 2010 09:36:35 +0000 (+0000) Subject: PR tree-optimization/45059 X-Git-Tag: upstream/4.9.2~27095 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b2d33090f5c98fd727c577903a82869b8658d8b9;p=platform%2Fupstream%2Flinaro-gcc.git PR tree-optimization/45059 * tree-ssa-reassoc.c (eliminate_redundant_comparison): Strip useless type conversions from newop{1,2}. Assert t is a comparison and newop{1,2} after the stripping are gimple vals. * gcc.c-torture/compile/pr45059.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@163539 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 29c5aec..28a831a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2010-08-25 Jakub Jelinek + + PR tree-optimization/45059 + * tree-ssa-reassoc.c (eliminate_redundant_comparison): Strip useless + type conversions from newop{1,2}. Assert t is a comparison and + newop{1,2} after the stripping are gimple vals. + 2010-08-25 Tejas Belagod * config/arm/iterators.md (VU, SE, V_widen_l): New. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 7a92568..db3ae97 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2010-08-25 Jakub Jelinek + + PR tree-optimization/45059 + * gcc.c-torture/compile/pr45059.c: New test. + 2010-08-25 Tejas Belagod * lib/target-supports.exp (check_effective_target_vect_unpack): diff --git a/gcc/testsuite/gcc.c-torture/compile/pr45059.c b/gcc/testsuite/gcc.c-torture/compile/pr45059.c new file mode 100644 index 0000000..3f13cdb --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr45059.c @@ -0,0 +1,23 @@ +/* PR tree-optimization/45059 */ + +typedef unsigned int T; +extern void foo (signed char *, int); + +static signed char a; +static T b[1] = { -1 }; +static unsigned char c; + +static inline short int +bar (short v) +{ + c |= a < b[0]; + return 0; +} + +int +main () +{ + signed char *e = &a; + foo (e, bar (bar (c))); + return 0; +} diff --git a/gcc/tree-ssa-reassoc.c b/gcc/tree-ssa-reassoc.c index fd0a6d8..f2264b6 100644 --- a/gcc/tree-ssa-reassoc.c +++ b/gcc/tree-ssa-reassoc.c @@ -1314,9 +1314,14 @@ eliminate_redundant_comparison (enum tree_code opcode, enum tree_code subcode; tree newop1; tree newop2; + gcc_assert (COMPARISON_CLASS_P (t)); tmpvar = create_tmp_var (TREE_TYPE (t), NULL); add_referenced_var (tmpvar); extract_ops_from_tree (t, &subcode, &newop1, &newop2); + STRIP_USELESS_TYPE_CONVERSION (newop1); + STRIP_USELESS_TYPE_CONVERSION (newop2); + gcc_checking_assert (is_gimple_val (newop1) + && is_gimple_val (newop2)); sum = build_and_add_sum (tmpvar, newop1, newop2, subcode); curr->op = gimple_get_lhs (sum); }