diff options
author | Segher Boessenkool <segher@kernel.crashing.org> | 2017-03-20 23:08:16 +0000 |
---|---|---|
committer | Segher Boessenkool <segher@kernel.crashing.org> | 2017-03-20 23:08:16 +0000 |
commit | e21777d76b86c342587eb23ff2515675067a1294 (patch) | |
tree | 210f18d4a1f6bc25ab025dbe7945ff510192ccfd | |
parent | ea7cd2bf1954b81963ae0f70a30dd728f291c226 (diff) |
combine: Fix 79910
If the dest of an I0 or I1 is used in an insn before I2, as can happen
in various uncommon cases, and we manage to do the combination, the set
is moved to I2, which is wrong. Don't allow combining the insns in this
case.
PR rtl-optimization/79910
* combine.c (can_combine_p): Do not allow combining an I0 or I1
if its dest is used by an insn before I2 (other than the combined
insns themselves, which are properly handled already).
git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@246297 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/combine.c | 4 |
2 files changed, 11 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 55e9bc81e58..afb4a523472 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,12 @@ 2017-03-20 Segher Boessenkool <segher@kernel.crashing.org> + PR rtl-optimization/79910 + * combine.c (can_combine_p): Do not allow combining an I0 or I1 + if its dest is used by an insn before I2 (other than the combined + insns themselves, which are properly handled already). + +2017-03-20 Segher Boessenkool <segher@kernel.crashing.org> + Revert: 2017-03-17 Bernd Schmidt <bschmidt@redhat.com> diff --git a/gcc/combine.c b/gcc/combine.c index 66215a607bd..17258f0e0c5 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -1953,6 +1953,10 @@ can_combine_p (rtx_insn *insn, rtx_insn *i3, rtx_insn *pred ATTRIBUTE_UNUSED, || (succ2 && FIND_REG_INC_NOTE (succ2, dest)) /* 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. */ || (!all_adjacent && ((succ2 |