diff options
author | Segher Boessenkool <segher@kernel.crashing.org> | 2017-01-15 18:03:55 +0100 |
---|---|---|
committer | Segher Boessenkool <segher@gcc.gnu.org> | 2017-01-15 18:03:55 +0100 |
commit | 32a8d3f66a4d02b77774a713e5c4ff8d586af4f4 (patch) | |
tree | 9d147960c82aa065ac13ca22a63ca37f25b4917e | |
parent | 0cb4b758f5372ed1b5be14f79723ad59afba25f2 (diff) | |
download | gcc-32a8d3f66a4d02b77774a713e5c4ff8d586af4f4.zip gcc-32a8d3f66a4d02b77774a713e5c4ff8d586af4f4.tar.gz gcc-32a8d3f66a4d02b77774a713e5c4ff8d586af4f4.tar.bz2 |
ifcvt: Don't make invalid insns for a cond trap (PR78751)
As shown in the PR, ifcvt will happily make invalid insns when given the
chance. This patch teaches it some manners.
PR rtl-optimization/78751
* ifcvt.c (find_cond_trap): If we generated a non-existing insn,
give up.
From-SVN: r244476
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/ifcvt.c | 5 |
2 files changed, 11 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 36982c6..c689c58 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2017-01-15 Segher Boessenkool <segher@kernel.crashing.org> + + PR rtl-optimization/78751 + * ifcvt.c (find_cond_trap): If we generated a non-existing insn, + give up. + 2017-01-14 Jeff Law <law@redhat.com> PR tree-optimization/79090 diff --git a/gcc/ifcvt.c b/gcc/ifcvt.c index 68c1a1d..6d30639 100644 --- a/gcc/ifcvt.c +++ b/gcc/ifcvt.c @@ -4686,6 +4686,11 @@ find_cond_trap (basic_block test_bb, edge then_edge, edge else_edge) if (seq == NULL) return FALSE; + /* If that results in an invalid insn, back out. */ + for (rtx_insn *x = seq; x; x = NEXT_INSN (x)) + if (recog_memoized (x) < 0) + return FALSE; + /* Emit the new insns before cond_earliest. */ emit_insn_before_setloc (seq, cond_earliest, INSN_LOCATION (trap)); |