rtlanal: dead_or_set_regno_p should handle CLOBBER (PR83424)

In PR83424 combine's move_deaths puts a REG_DEAD note in the wrong place
because dead_or_set_regno_p does not account for CLOBBER insns.  This
fixes it.


	PR rtl-optimization/83424
	* rtlanal.c (dead_or_set_regno_p): Handle CLOBBER just like SET.

gcc/testsuite/
	PR rtl-optimization/83424
	* gcc.dg/pr83424.c: New testsuite.

From-SVN: r256750
This commit is contained in:
Segher Boessenkool 2018-01-16 17:20:10 +01:00 committed by Segher Boessenkool
parent f1176d9edc
commit 3a76f570dc
4 changed files with 47 additions and 1 deletions

View File

@ -1,3 +1,11 @@
2018-01-16 Segher Boessenkool <segher@kernel.crashing.org>
Backport from mainline
2017-12-18 Segher Boessenkool <segher@kernel.crashing.org>
PR rtl-optimization/83424
* rtlanal.c (dead_or_set_regno_p): Handle CLOBBER just like SET.
2018-01-16 H.J. Lu <hongjiu.lu@intel.com>
* config/i386/i386.c (ix86_expand_prologue): Don't use reference

View File

@ -2050,7 +2050,7 @@ dead_or_set_regno_p (const rtx_insn *insn, unsigned int test_regno)
if (GET_CODE (pattern) == COND_EXEC)
return 0;
if (GET_CODE (pattern) == SET)
if (GET_CODE (pattern) == SET || GET_CODE (pattern) == CLOBBER)
return covers_regno_p (SET_DEST (pattern), test_regno);
else if (GET_CODE (pattern) == PARALLEL)
{

View File

@ -1,3 +1,11 @@
2018-01-16 Segher Boessenkool <segher@kernel.crashing.org>
Backport from mainline
2017-12-18 Segher Boessenkool <segher@kernel.crashing.org>
PR rtl-optimization/83424
* gcc.dg/pr83424.c: New testsuite.
2018-01-16 H.J. Lu <hongjiu.lu@intel.com>
Backport from mainline

View File

@ -0,0 +1,30 @@
/* PR rtl-optimization/83424 */
/* { dg-do run { target int128 } } */
/* { dg-options "-O -fno-tree-ccp -fno-tree-coalesce-vars" } */
typedef unsigned char u8;
typedef unsigned int u32;
typedef unsigned __int128 u128;
u32 a, c;
u8 b;
static u128 __attribute__ ((noinline, noclone))
foo (u128 p)
{
u8 x = ~b;
p &= c;
x *= -p;
x &= a == 0;
x >>= 1;
return p + x;
}
int
main (void)
{
u128 x = foo (0);
if (x != 0)
__builtin_abort ();
return 0;
}