From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9478 invoked by alias); 21 Oct 2013 10:14:32 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 9425 invoked by uid 48); 21 Oct 2013 10:14:29 -0000 From: "vries at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/58805] [4.8/4.9 Regression] Inline assembly wrongly optimized out when inside a conditional Date: Mon, 21 Oct 2013 10:14:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 4.8.1 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: vries at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 4.8.3 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2013-10/txt/msg01483.txt.bz2 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)) { ...