aboutsummaryrefslogtreecommitdiff
path: root/gcc/ifcvt.c
diff options
context:
space:
mode:
authorSegher Boessenkool <segher@kernel.crashing.org>2017-01-15 18:03:55 +0100
committerSegher Boessenkool <segher@gcc.gnu.org>2017-01-15 18:03:55 +0100
commit32a8d3f66a4d02b77774a713e5c4ff8d586af4f4 (patch)
tree9d147960c82aa065ac13ca22a63ca37f25b4917e /gcc/ifcvt.c
parent0cb4b758f5372ed1b5be14f79723ad59afba25f2 (diff)
downloadgcc-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
Diffstat (limited to 'gcc/ifcvt.c')
-rw-r--r--gcc/ifcvt.c5
1 files changed, 5 insertions, 0 deletions
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));