diff options
author | Richard Guenther <rguenther@suse.de> | 2009-08-09 21:39:19 +0000 |
---|---|---|
committer | Richard Guenther <rguenther@suse.de> | 2009-08-09 21:39:19 +0000 |
commit | 537e72702cf2064d5de4d1482df58bcdf97b77eb (patch) | |
tree | 8ed62ff1673d216d7ab0f057643f7f39fe65a478 | |
parent | 09a15aa79c61d1f69a8cd303b19f134d0adc4fe8 (diff) |
2009-08-09 Richard Guenther <rguenther@suse.de>
PR tree-optimization/41016
* tree-ssa-ifcombine.c (get_name_for_bit_test): Fix tuplification
bug.
(operand_precision): Remove.
(integral_operand_p): Likewise.
(recognize_single_bit_test): Adjust.
* gcc.c-torture/compile/pr41016.c: New testcase.
git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_4-branch@150598 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ChangeLog | 9 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.c-torture/compile/pr41016.c | 17 | ||||
-rw-r--r-- | gcc/tree-ssa-ifcombine.c | 31 |
4 files changed, 37 insertions, 25 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 020f39367e7..25bb473205b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2009-08-09 Richard Guenther <rguenther@suse.de> + + PR tree-optimization/41016 + * tree-ssa-ifcombine.c (get_name_for_bit_test): Fix tuplification + bug. + (operand_precision): Remove. + (integral_operand_p): Likewise. + (recognize_single_bit_test): Adjust. + 2009-08-05 Uros Bizjak <ubizjak@gmail.com> Mikulas Patocka <mikulas@artax.karlin.mff.cuni.cz> diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 178a7bcc140..12c65f0e39e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2009-08-09 Richard Guenther <rguenther@suse.de> + + PR tree-optimization/41016 + * gcc.c-torture/compile/pr41016.c: New testcase. + 2009-08-08 Laurent GUERBY <laurent@guerby.net> * ada/acats/support/impdef.a: Tweak timing constants. Add diff --git a/gcc/testsuite/gcc.c-torture/compile/pr41016.c b/gcc/testsuite/gcc.c-torture/compile/pr41016.c new file mode 100644 index 00000000000..57bddb49dea --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr41016.c @@ -0,0 +1,17 @@ +typedef struct _IO_FILE FILE; +void +CompareRNAStructures (FILE * ofp, int start, int L, char *ss_true, char *ss) +{ + int i; + float agree = 0.; + float pairs = 0.; + float pairs_true = 0.; + for (i = 0; i < L; i++) + { + pairs_true += 1.; + agree += 1.; + } + if (((int) pairs % 2 != 0) || ((int) pairs_true % 2 != 0) + || ((int) agree % 2 != 0)) + Die ("Error in CompareRNAStrutures(); odd number of paired nucleotides\n"); +} diff --git a/gcc/tree-ssa-ifcombine.c b/gcc/tree-ssa-ifcombine.c index 335fd068540..55b042e5ccc 100644 --- a/gcc/tree-ssa-ifcombine.c +++ b/gcc/tree-ssa-ifcombine.c @@ -151,7 +151,7 @@ get_name_for_bit_test (tree candidate) { gimple def_stmt = SSA_NAME_DEF_STMT (candidate); if (is_gimple_assign (def_stmt) - && gimple_assign_cast_p (def_stmt)) + && CONVERT_EXPR_CODE_P (gimple_assign_rhs_code (def_stmt))) { if (TYPE_PRECISION (TREE_TYPE (candidate)) <= TYPE_PRECISION (TREE_TYPE (gimple_assign_rhs1 (def_stmt)))) @@ -162,21 +162,6 @@ get_name_for_bit_test (tree candidate) return candidate; } -/* Helpers for recognize_single_bit_test defined mainly for source code - formating. */ - -static int -operand_precision (tree t) -{ - return TYPE_PRECISION (TREE_TYPE (t)); -} - -static bool -integral_operand_p (tree t) -{ - return INTEGRAL_TYPE_P (TREE_TYPE (t)); -} - /* Recognize a single bit test pattern in GIMPLE_COND and its defining statements. Store the name being tested in *NAME and the bit in *BIT. The GIMPLE_COND computes *NAME & (1 << *BIT). @@ -212,15 +197,11 @@ recognize_single_bit_test (gimple cond, tree *name, tree *bit) stmt = SSA_NAME_DEF_STMT (orig_name); while (is_gimple_assign (stmt) - && (gimple_assign_ssa_name_copy_p (stmt) - || (gimple_assign_cast_p (stmt) - && integral_operand_p (gimple_assign_lhs (stmt)) - && integral_operand_p (gimple_assign_rhs1 (stmt)) - && (operand_precision (gimple_assign_lhs (stmt)) - <= operand_precision (gimple_assign_rhs1 (stmt)))))) - { - stmt = SSA_NAME_DEF_STMT (gimple_assign_rhs1 (stmt)); - } + && ((CONVERT_EXPR_CODE_P (gimple_assign_rhs_code (stmt)) + && (TYPE_PRECISION (TREE_TYPE (gimple_assign_lhs (stmt))) + <= TYPE_PRECISION (TREE_TYPE (gimple_assign_rhs1 (stmt))))) + || gimple_assign_ssa_name_copy_p (stmt))) + stmt = SSA_NAME_DEF_STMT (gimple_assign_rhs1 (stmt)); /* If we found such, decompose it. */ if (is_gimple_assign (stmt) |