Commit a4710e09 by Jakub Jelinek Committed by Jakub Jelinek

re PR tree-optimization/83521 (ICE: verify_gimple failed (error: invalid operand…

re PR tree-optimization/83521 (ICE: verify_gimple failed (error: invalid operand in unary operation))

	PR tree-optimization/83521
	* tree-ssa-phiopt.c (factor_out_conditional_conversion): Use
	gimple_build_assign without code on result of
	fold_build1 (VIEW_CONVERT_EXPR, ...), as it might not create
	a VIEW_CONVERT_EXPR.

	* gcc.dg/pr83521.c: New test.

From-SVN: r255952
parent da98f742
2017-12-21 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/83521
* tree-ssa-phiopt.c (factor_out_conditional_conversion): Use
gimple_build_assign without code on result of
fold_build1 (VIEW_CONVERT_EXPR, ...), as it might not create
a VIEW_CONVERT_EXPR.
2017-12-21 Andrew Pinski <apinski@cavium.com> 2017-12-21 Andrew Pinski <apinski@cavium.com>
Steve Ellcey <sellcey@cavium.com> Steve Ellcey <sellcey@cavium.com>
2017-12-21 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/83521
* gcc.dg/pr83521.c: New test.
2017-12-21 Nathan Sidwell <nathan@acm.org> 2017-12-21 Nathan Sidwell <nathan@acm.org>
PR c++/83406 PR c++/83406
......
/* PR tree-optimization/83521 */
/* { dg-do compile } */
/* { dg-options "-O1 -fno-tree-forwprop" } */
int
foo (unsigned int x, int y)
{
int *z = (int *)&x;
return (y == 0) ? y : *z;
}
...@@ -548,8 +548,12 @@ factor_out_conditional_conversion (edge e0, edge e1, gphi *phi, ...@@ -548,8 +548,12 @@ factor_out_conditional_conversion (edge e0, edge e1, gphi *phi,
/* Create the conversion stmt and insert it. */ /* Create the conversion stmt and insert it. */
if (convert_code == VIEW_CONVERT_EXPR) if (convert_code == VIEW_CONVERT_EXPR)
temp = fold_build1 (VIEW_CONVERT_EXPR, TREE_TYPE (result), temp); {
new_stmt = gimple_build_assign (result, convert_code, temp); temp = fold_build1 (VIEW_CONVERT_EXPR, TREE_TYPE (result), temp);
new_stmt = gimple_build_assign (result, temp);
}
else
new_stmt = gimple_build_assign (result, convert_code, temp);
gsi = gsi_after_labels (gimple_bb (phi)); gsi = gsi_after_labels (gimple_bb (phi));
gsi_insert_before (&gsi, new_stmt, GSI_SAME_STMT); gsi_insert_before (&gsi, new_stmt, GSI_SAME_STMT);
......
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