]> gcc.gnu.org Git - gcc.git/commit
ifcvt: Fix PR104153 and PR104198.
authorRobin Dapp <rdapp@linux.ibm.com>
Tue, 8 Feb 2022 15:11:20 +0000 (16:11 +0100)
committerRobin Dapp <rdapp@linux.ibm.com>
Tue, 8 Feb 2022 19:46:20 +0000 (20:46 +0100)
commitd0d4601ccde3c4849f6e7244035f1a899d608cb7
tree816d6878fa064b9e89703a8dbb0f6bac391f2fe3
parent71e6353e1b03021bc8bbcf4bd67a5f14d09b5fb1
ifcvt: Fix PR104153 and PR104198.

This is a bugfix for r12-6747-gaa8cfe785953a0 which caused an ICE
on or1k (PR104153) and broke SPARC bootstrap (PR104198).

cond_exec_get_condition () returns the jump condition directly and we
now pass it to the backend.  The or1k backend modified the condition
in-place (other backends do that as well) but this modification is not
reverted when the sequence in question is discarded.  Therefore we copy
the RTX instead of using it directly.

The SPARC problem is due to the SPARC backend recreating the initial
condition when being passed a CC comparison.  This causes the sequence
to read from an already overwritten condition operand.  Generally, this
could also happen on other targets.  The workaround is to always first
emit to a temporary.  In a second run of noce_convert_multiple_sets_1
we know which sequences actually require the comparison and will use no
temporaries if all sequences after the current one do not require it.

PR rtl-optimization/104198
PR rtl-optimization/104153

gcc/ChangeLog:

* ifcvt.cc (noce_convert_multiple_sets_1): Copy rtx instead of
using it directly.  Rework comparison handling and always
perform a second pass.

gcc/testsuite/ChangeLog:

* gcc.dg/pr104198.c: New test.
gcc/ifcvt.cc
gcc/testsuite/gcc.dg/pr104198.c [new file with mode: 0644]
This page took 0.062764 seconds and 6 git commands to generate.