aboutsummaryrefslogtreecommitdiff
path: root/gcc/combine.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2017-03-21 15:49:51 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2017-03-21 15:49:51 +0100
commit85106b8757d46f80a5993fc75948a82ce16c1f74 (patch)
tree1a81dd0d7abfba195d6e9f2a5236c6a0ae6f0f7c /gcc/combine.c
parent8c0f9dab864878286b6fd16e26d62be4742cd7d6 (diff)
downloadgcc-85106b8757d46f80a5993fc75948a82ce16c1f74.zip
gcc-85106b8757d46f80a5993fc75948a82ce16c1f74.tar.gz
gcc-85106b8757d46f80a5993fc75948a82ce16c1f74.tar.bz2
re PR target/80125 (r246297 causes segfault in reg_used_between_p())
PR target/80125 * combine.c (can_combine_p): Revert the 2017-03-20 change, only check reg_used_between_p between insn and one of succ or succ2 depending on if succ is artificial insn not inserted into insn stream. * gcc.target/powerpc/pr80125.c: New test. Co-Authored-By: Segher Boessenkool <segher@kernel.crashing.org> From-SVN: r246323
Diffstat (limited to 'gcc/combine.c')
-rw-r--r--gcc/combine.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/gcc/combine.c b/gcc/combine.c
index 17258f0..c118aa2 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -1954,15 +1954,20 @@ can_combine_p (rtx_insn *insn, rtx_insn *i3, rtx_insn *pred ATTRIBUTE_UNUSED,
/* Don't substitute into a non-local goto, this confuses CFG. */
|| (JUMP_P (i3) && find_reg_note (i3, REG_NON_LOCAL_GOTO, NULL_RTX))
/* Make sure that DEST is not used after INSN but before SUCC, or
- between SUCC and SUCC2. */
- || (succ && reg_used_between_p (dest, insn, succ))
- || (succ2 && reg_used_between_p (dest, succ, succ2))
- /* Make sure that DEST is not used after SUCC but before I3. */
+ after SUCC and before SUCC2, or after SUCC2 but before I3. */
|| (!all_adjacent
&& ((succ2
&& (reg_used_between_p (dest, succ2, i3)
|| reg_used_between_p (dest, succ, succ2)))
- || (!succ2 && succ && reg_used_between_p (dest, succ, i3))))
+ || (!succ2 && succ && reg_used_between_p (dest, succ, i3))
+ || (succ
+ /* SUCC and SUCC2 can be split halves from a PARALLEL; in
+ that case SUCC is not in the insn stream, so use SUCC2
+ instead for this test. */
+ && reg_used_between_p (dest, insn,
+ succ2
+ && INSN_UID (succ) == INSN_UID (succ2)
+ ? succ2 : succ))))
/* Make sure that the value that is to be substituted for the register
does not use any registers whose values alter in between. However,
If the insns are adjacent, a use can't cross a set even though we