diff options
author | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-04-26 15:28:14 +0000 |
---|---|---|
committer | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-04-26 15:28:14 +0000 |
commit | 27dc0bdf27f4f2b18bf95f2b54bfdd718da7a7f5 (patch) | |
tree | ba24980895b374e7263f14892f3b83578d5793d0 /gcc/tree-ssa-loop-im.c | |
parent | dcd5d12ed7cacfa71534c1eb3bc628a74fd6e36a (diff) | |
download | gcc-27dc0bdf27f4f2b18bf95f2b54bfdd718da7a7f5.tar.gz |
2007-04-26 Richard Guenther <rguenther@suse.de>
PR tree-optimization/31703
* tree-ssa-loop-im.c (rewrite_bittest): Make sure to use
the right type for the target of the bittest.
* gcc.c-torture/compile/pr31703.c: New testcase.
* gcc.dg/tree-ssa/ssa-lim-1.c: Adjust pattern.
* gcc.dg/tree-ssa/ssa-lim-2.c: Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@124190 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssa-loop-im.c')
-rw-r--r-- | gcc/tree-ssa-loop-im.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/gcc/tree-ssa-loop-im.c b/gcc/tree-ssa-loop-im.c index 340e6a1aef4..1e36fae96bd 100644 --- a/gcc/tree-ssa-loop-im.c +++ b/gcc/tree-ssa-loop-im.c @@ -618,7 +618,7 @@ rewrite_reciprocal (block_stmt_iterator *bsi) static tree rewrite_bittest (block_stmt_iterator *bsi) { - tree stmt, lhs, rhs, var, name, stmt1, stmt2, t; + tree stmt, lhs, rhs, var, name, use_stmt, stmt1, stmt2, t; use_operand_p use; stmt = bsi_stmt (*bsi); @@ -627,10 +627,10 @@ rewrite_bittest (block_stmt_iterator *bsi) /* Verify that the single use of lhs is a comparison against zero. */ if (TREE_CODE (lhs) != SSA_NAME - || !single_imm_use (lhs, &use, &stmt1) - || TREE_CODE (stmt1) != COND_EXPR) + || !single_imm_use (lhs, &use, &use_stmt) + || TREE_CODE (use_stmt) != COND_EXPR) return stmt; - t = COND_EXPR_COND (stmt1); + t = COND_EXPR_COND (use_stmt); if (TREE_OPERAND (t, 0) != lhs || (TREE_CODE (t) != NE_EXPR && TREE_CODE (t) != EQ_EXPR) @@ -680,11 +680,13 @@ rewrite_bittest (block_stmt_iterator *bsi) /* A & (1 << B) */ t = fold_build2 (BIT_AND_EXPR, TREE_TYPE (a), a, name); - stmt2 = build_gimple_modify_stmt (lhs, t); + stmt2 = build_gimple_modify_stmt (var, t); + name = make_ssa_name (var, stmt2); + GIMPLE_STMT_OPERAND (stmt2, 0) = name; + SET_USE (use, name); bsi_insert_before (bsi, stmt1, BSI_SAME_STMT); bsi_replace (bsi, stmt2, true); - SSA_NAME_DEF_STMT (lhs) = stmt2; return stmt1; } |