aboutsummaryrefslogtreecommitdiff
path: root/gcc/cfgrtl.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2013-10-10 18:29:50 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2013-10-10 18:29:50 +0200
commita1d5038607b04afa011d77552c0193d2cd8e1251 (patch)
tree8c578f08248bdbe39d7433a888f50d829017121e /gcc/cfgrtl.c
parente2c2fde2105b83ec8c4fcc664969df2437467c36 (diff)
downloadgcc-a1d5038607b04afa011d77552c0193d2cd8e1251.zip
gcc-a1d5038607b04afa011d77552c0193d2cd8e1251.tar.gz
gcc-a1d5038607b04afa011d77552c0193d2cd8e1251.tar.bz2
re PR middle-end/58670 (asm goto miscompilation)
PR middle-end/58670 * stmt.c (expand_asm_operands): Add FALLTHRU_BB argument, if any labels are in FALLTHRU_BB, use a special label emitted immediately after the asm goto insn rather than label_rtx of the LABEL_DECL. (expand_asm_stmt): Adjust caller. * cfgrtl.c (commit_one_edge_insertion): Force splitting of edge if the last insn in predecessor is a jump with single successor, but it isn't simplejump_p. * gcc.dg/torture/pr58670.c: New test. From-SVN: r203383
Diffstat (limited to 'gcc/cfgrtl.c')
-rw-r--r--gcc/cfgrtl.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c
index 85738a4..d6733a2 100644
--- a/gcc/cfgrtl.c
+++ b/gcc/cfgrtl.c
@@ -1959,10 +1959,18 @@ commit_one_edge_insertion (edge e)
}
/* If the source has one successor and the edge is not abnormal,
- insert there. Except for the entry block. */
+ insert there. Except for the entry block.
+ Don't do this if the predecessor ends in a jump other than
+ unconditional simple jump. E.g. for asm goto that points all
+ its labels at the fallthru basic block, we can't insert instructions
+ before the asm goto, as the asm goto can have various of side effects,
+ and can't emit instructions after the asm goto, as it must end
+ the basic block. */
else if ((e->flags & EDGE_ABNORMAL) == 0
&& single_succ_p (e->src)
- && e->src != ENTRY_BLOCK_PTR)
+ && e->src != ENTRY_BLOCK_PTR
+ && (!JUMP_P (BB_END (e->src))
+ || simplejump_p (BB_END (e->src))))
{
bb = e->src;