Commit 179184e3 by Richard Guenther Committed by Richard Biener

re PR tree-optimization/49018 (Inline assembly block executed outside…

re PR tree-optimization/49018 (Inline assembly block executed outside conditional check with "-O1 -ftree-vrp")

2011-05-18  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/49018
	* gimple.c (gimple_has_side_effects): Volatile asms have side-effects.
	* tree-ssa-ifcombine.c (bb_no_side_effects_p): Use
	gimple_has_side_effects.

From-SVN: r173861
parent 93b2a207
2011-05-18 Richard Guenther <rguenther@suse.de> 2011-05-18 Richard Guenther <rguenther@suse.de>
PR tree-optimization/49018
* gimple.c (gimple_has_side_effects): Volatile asms have side-effects.
* tree-ssa-ifcombine.c (bb_no_side_effects_p): Use
gimple_has_side_effects.
2011-05-18 Richard Guenther <rguenther@suse.de>
* gimple.c (gimple_register_type_1): New function, split out from ... * gimple.c (gimple_register_type_1): New function, split out from ...
(gimple_register_type): ... here. Avoid infinite recursion. (gimple_register_type): ... here. Avoid infinite recursion.
......
...@@ -2354,6 +2354,10 @@ gimple_has_side_effects (const_gimple s) ...@@ -2354,6 +2354,10 @@ gimple_has_side_effects (const_gimple s)
if (gimple_has_volatile_ops (s)) if (gimple_has_volatile_ops (s))
return true; return true;
if (gimple_code (s) == GIMPLE_ASM
&& gimple_asm_volatile_p (s))
return true;
if (is_gimple_call (s)) if (is_gimple_call (s))
{ {
unsigned nargs = gimple_call_num_args (s); unsigned nargs = gimple_call_num_args (s);
...@@ -2368,7 +2372,7 @@ gimple_has_side_effects (const_gimple s) ...@@ -2368,7 +2372,7 @@ gimple_has_side_effects (const_gimple s)
if (gimple_call_lhs (s) if (gimple_call_lhs (s)
&& TREE_SIDE_EFFECTS (gimple_call_lhs (s))) && TREE_SIDE_EFFECTS (gimple_call_lhs (s)))
{ {
gcc_assert (gimple_has_volatile_ops (s)); gcc_checking_assert (gimple_has_volatile_ops (s));
return true; return true;
} }
...@@ -2379,7 +2383,7 @@ gimple_has_side_effects (const_gimple s) ...@@ -2379,7 +2383,7 @@ gimple_has_side_effects (const_gimple s)
for (i = 0; i < nargs; i++) for (i = 0; i < nargs; i++)
if (TREE_SIDE_EFFECTS (gimple_call_arg (s, i))) if (TREE_SIDE_EFFECTS (gimple_call_arg (s, i)))
{ {
gcc_assert (gimple_has_volatile_ops (s)); gcc_checking_assert (gimple_has_volatile_ops (s));
return true; return true;
} }
...@@ -2388,12 +2392,15 @@ gimple_has_side_effects (const_gimple s) ...@@ -2388,12 +2392,15 @@ gimple_has_side_effects (const_gimple s)
else else
{ {
for (i = 0; i < gimple_num_ops (s); i++) for (i = 0; i < gimple_num_ops (s); i++)
if (TREE_SIDE_EFFECTS (gimple_op (s, i)))
{ {
gcc_assert (gimple_has_volatile_ops (s)); tree op = gimple_op (s, i);
if (op && TREE_SIDE_EFFECTS (op))
{
gcc_checking_assert (gimple_has_volatile_ops (s));
return true; return true;
} }
} }
}
return false; return false;
} }
......
...@@ -107,7 +107,7 @@ bb_no_side_effects_p (basic_block bb) ...@@ -107,7 +107,7 @@ bb_no_side_effects_p (basic_block bb)
{ {
gimple stmt = gsi_stmt (gsi); gimple stmt = gsi_stmt (gsi);
if (gimple_has_volatile_ops (stmt) if (gimple_has_side_effects (stmt)
|| gimple_vuse (stmt)) || gimple_vuse (stmt))
return false; return false;
} }
......
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