aboutsummaryrefslogtreecommitdiff
path: root/gcc/cfgcleanup.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2019-01-22 10:12:31 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2019-01-22 10:12:31 +0100
commitbecba8a79fb0a29aea9a8e10a6c298a124336b92 (patch)
tree4767e19db3f0b7668a0da51ef681574441d82460 /gcc/cfgcleanup.c
parentc875d46fefac13675853f58ec7dea8f402779af0 (diff)
downloadgcc-becba8a79fb0a29aea9a8e10a6c298a124336b92.zip
gcc-becba8a79fb0a29aea9a8e10a6c298a124336b92.tar.gz
gcc-becba8a79fb0a29aea9a8e10a6c298a124336b92.tar.bz2
re PR rtl-optimization/88904 (Basic block incorrectly skipped in jump threading.)
PR rtl-optimization/88904 * cfgcleanup.c (thread_jump): Verify cond2 doesn't mention any nonequal registers before processing BB_END (b). * gcc.c-torture/execute/pr88904.c: New test. From-SVN: r268140
Diffstat (limited to 'gcc/cfgcleanup.c')
-rw-r--r--gcc/cfgcleanup.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/gcc/cfgcleanup.c b/gcc/cfgcleanup.c
index b5c828f..fd27fd6 100644
--- a/gcc/cfgcleanup.c
+++ b/gcc/cfgcleanup.c
@@ -338,6 +338,13 @@ thread_jump (edge e, basic_block b)
insn != NEXT_INSN (BB_END (b)) && !failed;
insn = NEXT_INSN (insn))
{
+ /* cond2 must not mention any register that is not equal to the
+ former block. Check this before processing that instruction,
+ as BB_END (b) could contain also clobbers. */
+ if (insn == BB_END (b)
+ && mentions_nonequal_regs (cond2, nonequal))
+ goto failed_exit;
+
if (INSN_P (insn))
{
rtx pat = PATTERN (insn);
@@ -362,11 +369,6 @@ thread_jump (edge e, basic_block b)
goto failed_exit;
}
- /* cond2 must not mention any register that is not equal to the
- former block. */
- if (mentions_nonequal_regs (cond2, nonequal))
- goto failed_exit;
-
EXECUTE_IF_SET_IN_REG_SET (nonequal, 0, i, rsi)
goto failed_exit;