This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/58805] [4.8/4.9 Regression] Inline assembly wrongly optimized out when inside a conditional
- From: "vries at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 21 Oct 2013 10:14:28 +0000
- Subject: [Bug tree-optimization/58805] [4.8/4.9 Regression] Inline assembly wrongly optimized out when inside a conditional
- Auto-submitted: auto-generated
- References: <bug-58805-4 at http dot gcc dot gnu dot org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58805
vries at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |vries at gcc dot gnu.org
--- Comment #11 from vries at gcc dot gnu.org ---
Using this tentative patch, tree-tail-merge leaves the test-case alone:
...
diff --git a/gcc/gimple.c b/gcc/gimple.c
index 3ddceb9..7e00037 100644
--- a/gcc/gimple.c
+++ b/gcc/gimple.c
@@ -2394,6 +2394,13 @@ gimple_copy (gimple stmt)
return copy;
}
+static bool
+return_true_bool_gimple_tree_voidptr (gimple s ATTRIBUTE_UNUSED,
+ tree t ATTRIBUTE_UNUSED,
+ void *p ATTRIBUTE_UNUSED)
+{
+ return true;
+}
/* Return true if statement S has side-effects. We consider a
statement to have side effects if:
@@ -2413,9 +2420,16 @@ gimple_has_side_effects (const_gimple s)
if (gimple_has_volatile_ops (s))
return true;
- if (gimple_code (s) == GIMPLE_ASM
- && gimple_asm_volatile_p (s))
- return true;
+ if (gimple_code (s) == GIMPLE_ASM)
+ {
+ if (gimple_asm_volatile_p (s))
+ return true;
+
+ if (walk_stmt_load_store_addr_ops ((gimple)s, NULL, NULL,
+ return_true_bool_gimple_tree_voidptr,
+ NULL))
+ return true;
+ }
if (is_gimple_call (s))
{
...