diff options
author | Segher Boessenkool <segher@kernel.crashing.org> | 2017-12-18 21:16:19 +0100 |
---|---|---|
committer | Segher Boessenkool <segher@gcc.gnu.org> | 2017-12-18 21:16:19 +0100 |
commit | aa8ec7fb260489a0af7578c727c4b41ebc1ae593 (patch) | |
tree | bc3a5180cbac1a4b320897ff68c2487a50a04b1c /gcc | |
parent | ab6e54a684f6fcbf9eed989d170905fd889e19cc (diff) | |
download | gcc-aa8ec7fb260489a0af7578c727c4b41ebc1ae593.zip gcc-aa8ec7fb260489a0af7578c727c4b41ebc1ae593.tar.gz gcc-aa8ec7fb260489a0af7578c727c4b41ebc1ae593.tar.bz2 |
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: r255787
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/rtlanal.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/pr83424.c | 30 |
4 files changed, 41 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a4a2afe..948271e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +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. + 2017-12-18 Marek Polacek <polacek@redhat.com> PR middle-end/83463 diff --git a/gcc/rtlanal.c b/gcc/rtlanal.c index c91f3f1..9f6988b 100644 --- a/gcc/rtlanal.c +++ b/gcc/rtlanal.c @@ -2082,7 +2082,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) { diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ae1fd01..da078f1 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-12-18 Segher Boessenkool <segher@kernel.crashing.org> + + PR rtl-optimization/83424 + * gcc.dg/pr83424.c: New testcase. + 2017-12-18 David Malcolm <dmalcolm@redhat.com> PR tree-optimization/83336 diff --git a/gcc/testsuite/gcc.dg/pr83424.c b/gcc/testsuite/gcc.dg/pr83424.c new file mode 100644 index 0000000..5a304f5 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr83424.c @@ -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; +} |