diff options
author | Richard Guenther <rguenther@suse.de> | 2009-08-09 20:10:41 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2009-08-09 20:10:41 +0000 |
commit | a64509053cfe1cab05710a393c1a26c63f15ef7f (patch) | |
tree | 2fe8d4cb210a328d18a4d6fa7c8cee2cc22a88ad /gcc/tree-ssa-ifcombine.c | |
parent | f517845606b6b8290b52f2068775a9325eceff6b (diff) | |
download | gcc-a64509053cfe1cab05710a393c1a26c63f15ef7f.zip gcc-a64509053cfe1cab05710a393c1a26c63f15ef7f.tar.gz gcc-a64509053cfe1cab05710a393c1a26c63f15ef7f.tar.bz2 |
re PR tree-optimization/41016 (ICE in build_int_cst_wide with -O1)
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.
From-SVN: r150595
Diffstat (limited to 'gcc/tree-ssa-ifcombine.c')
-rw-r--r-- | gcc/tree-ssa-ifcombine.c | 31 |
1 files changed, 6 insertions, 25 deletions
diff --git a/gcc/tree-ssa-ifcombine.c b/gcc/tree-ssa-ifcombine.c index 8cb9c1e..1d2d85b 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) |