Commit 70596642 by Daniel Berlin Committed by Daniel Berlin

re PR tree-optimization/20490 (ICE: verify_stmts failed. (with -O -ftree-pre))

2005-03-16  Daniel Berlin  <dberlin@dberlin.org>

	Fix PR tree-optimization/20940

	* tree-ssa-pre.c (create_expression_by_pieces): Use
	force_gimple_operand on result of fold.

From-SVN: r96560
parent ef6e9bc0
2005-03-16 Daniel Berlin <dberlin@dberlin.org>
Fix PR tree-optimization/20940
* tree-ssa-pre.c (create_expression_by_pieces): Use
force_gimple_operand on result of fold.
2005-03-16 Andrew Pinski <pinskia@physics.uc.edu>
* config/i386/emmintrin.h (_mm_extract_epi16): Correct the number
......
/* { dg-do compile } */
/* { dg-options "-O -ftree-pre" } */
static int a;
static int b;
typedef int gint;
int blah ()
{
gint x = a;
gint y = b;
x *= (x < 0) ? -1 : 0;
y *= (y < 0) ? -1 : 0;
return (y * x);
}
......@@ -1317,16 +1317,25 @@ create_expression_by_pieces (basic_block block, tree expr, tree stmts)
case tcc_binary:
{
tree_stmt_iterator tsi;
tree forced_stmts;
tree genop1, genop2;
tree temp;
tree folded;
tree op1 = TREE_OPERAND (expr, 0);
tree op2 = TREE_OPERAND (expr, 1);
genop1 = find_or_generate_expression (block, op1, stmts);
genop2 = find_or_generate_expression (block, op2, stmts);
temp = create_tmp_var (TREE_TYPE (expr), "pretmp");
add_referenced_tmp_var (temp);
newexpr = fold (build (TREE_CODE (expr), TREE_TYPE (expr),
genop1, genop2));
folded = fold (build (TREE_CODE (expr), TREE_TYPE (expr),
genop1, genop2));
newexpr = force_gimple_operand (folded, &forced_stmts, false, NULL);
if (forced_stmts)
{
tsi = tsi_last (stmts);
tsi_link_after (&tsi, forced_stmts, TSI_CONTINUE_LINKING);
}
newexpr = build (MODIFY_EXPR, TREE_TYPE (expr),
temp, newexpr);
NECESSARY (newexpr) = 0;
......@@ -1341,14 +1350,22 @@ create_expression_by_pieces (basic_block block, tree expr, tree stmts)
case tcc_unary:
{
tree_stmt_iterator tsi;
tree forced_stmts;
tree genop1;
tree temp;
tree folded;
tree op1 = TREE_OPERAND (expr, 0);
genop1 = find_or_generate_expression (block, op1, stmts);
temp = create_tmp_var (TREE_TYPE (expr), "pretmp");
add_referenced_tmp_var (temp);
newexpr = fold (build (TREE_CODE (expr), TREE_TYPE (expr),
genop1));
folded = fold (build (TREE_CODE (expr), TREE_TYPE (expr),
genop1));
newexpr = force_gimple_operand (folded, &forced_stmts, false, NULL);
if (forced_stmts)
{
tsi = tsi_last (stmts);
tsi_link_after (&tsi, forced_stmts, TSI_CONTINUE_LINKING);
}
newexpr = build (MODIFY_EXPR, TREE_TYPE (expr),
temp, newexpr);
name = make_ssa_name (temp, newexpr);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment