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: "rguenth 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:16:33 +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
--- Comment #12 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to vries from comment #10)
> I've tried out the example from comment 9.
>
> Tree-tail-merge considers the statements without effect because:
> ...
> (gdb) call debug_gimple_stmt (stmt)
> # .MEM_10 = VDEF <.MEM_3(D)>
> __asm__("movq $42, %0
> movq %0, %1
> " : "t" "=&r" t_8, "r" "=r" *x_4(D));
> (gdb) call gimple_has_side_effects (stmt)
> $2 = false
> ...
> and tree-ssa-tail-merge.c:stmt_local_def will return true.
>
> The side effect of the asm is in the expression for the output operand, so
> gimple_has_side_effects should return true.
No it shouldn't. It should return true if the stmt has side-effects that
are _not_ explicit in the statement. This side-effect is explicitely there.