aboutsummaryrefslogtreecommitdiff
path: root/gcc/gimple.c
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2011-11-10 12:22:46 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2011-11-10 12:22:46 +0000
commit723afc4436e1c3753b152e0a14e6de5c52b07202 (patch)
treeae04cc73c7c383580aa79ea02aaddaea175a9672 /gcc/gimple.c
parent08d603d6edd42cd148c78336ecb7457899763f46 (diff)
downloadgcc-723afc4436e1c3753b152e0a14e6de5c52b07202.zip
gcc-723afc4436e1c3753b152e0a14e6de5c52b07202.tar.gz
gcc-723afc4436e1c3753b152e0a14e6de5c52b07202.tar.bz2
re PR middle-end/51071 (ICE in gimple_has_side_effects, at gimple.c:2513)
2011-11-10 Richard Guenther <rguenther@suse.de> PR middle-end/51071 * gimple.c (gimple_has_side_effects): Remove checking code that doesn't belong here. * gcc.dg/torture/pr51071.c: New testcase. From-SVN: r181253
Diffstat (limited to 'gcc/gimple.c')
-rw-r--r--gcc/gimple.c42
1 files changed, 4 insertions, 38 deletions
diff --git a/gcc/gimple.c b/gcc/gimple.c
index 57f15af..6168d33 100644
--- a/gcc/gimple.c
+++ b/gcc/gimple.c
@@ -2457,8 +2457,6 @@ gimple_set_modified (gimple s, bool modifiedp)
bool
gimple_has_side_effects (const_gimple s)
{
- unsigned i;
-
if (is_gimple_debug (s))
return false;
@@ -2474,47 +2472,15 @@ gimple_has_side_effects (const_gimple s)
if (is_gimple_call (s))
{
- unsigned nargs = gimple_call_num_args (s);
- tree fn;
+ int flags = gimple_call_flags (s);
- if (!(gimple_call_flags (s) & (ECF_CONST | ECF_PURE)))
- return true;
- else if (gimple_call_flags (s) & ECF_LOOPING_CONST_OR_PURE)
- /* An infinite loop is considered a side effect. */
+ /* An infinite loop is considered a side effect. */
+ if (!(flags & (ECF_CONST | ECF_PURE))
+ || (flags & ECF_LOOPING_CONST_OR_PURE))
return true;
- if (gimple_call_lhs (s)
- && TREE_SIDE_EFFECTS (gimple_call_lhs (s)))
- {
- gcc_checking_assert (gimple_has_volatile_ops (s));
- return true;
- }
-
- fn = gimple_call_fn (s);
- if (fn && TREE_SIDE_EFFECTS (fn))
- return true;
-
- for (i = 0; i < nargs; i++)
- if (TREE_SIDE_EFFECTS (gimple_call_arg (s, i)))
- {
- gcc_checking_assert (gimple_has_volatile_ops (s));
- return true;
- }
-
return false;
}
- else
- {
- for (i = 0; i < gimple_num_ops (s); i++)
- {
- tree op = gimple_op (s, i);
- if (op && TREE_SIDE_EFFECTS (op))
- {
- gcc_checking_assert (gimple_has_volatile_ops (s));
- return true;
- }
- }
- }
return false;
}