This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/58860] New: tail-merge doesn't merge asm statements with vdef
- 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: Thu, 24 Oct 2013 09:08:42 +0000
- Subject: [Bug tree-optimization/58860] New: tail-merge doesn't merge asm statements with vdef
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58860
Bug ID: 58860
Summary: tail-merge doesn't merge asm statements with vdef
Product: gcc
Version: 4.9.0
Status: UNCONFIRMED
Severity: enhancement
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: vries at gcc dot gnu.org
Consider the test-case tail-merge-asm.c:
...
/* { dg-do compile } */
/* { dg-options "-O2 -ftree-tail-merge -fdump-tree-pre" } */
/* Type that matches the 'p' constraint. */
#define TYPE void *
static inline
void bar (TYPE *r)
{
TYPE t;
__asm__ ("" : "=&p" (t), "=p" (*r));
}
void
foo (int n, TYPE *x)
{
if (n == 0)
bar (x);
else
bar (x);
}
/* { dg-final { scan-tree-dump-times "duplicate" 1 "pre"} } */
/* { dg-final { scan-tree-dump-times "__asm__" 1 "pre"} } */
/* { dg-final { cleanup-tree-dump "pre" } } */
...
The test fails:
...
PASS: gcc.dg/tail-merge-asm.c (test for excess errors)
FAIL: gcc.dg/tail-merge-asm.c scan-tree-dump-times pre "duplicate" 1
FAIL: gcc.dg/tail-merge-asm.c scan-tree-dump-times pre "__asm__" 1
...
It fails because:
- the asm statements are not stmt_local_def
- tail-merge doesn't handle asm statements in gimple_equal_p.
The 2 stmts are merged in try_optimize_cfg during jump2 rtl pass.