summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsegher <segher@138bc75d-0d04-0410-961f-82ee72b054a4>2018-01-16 16:20:10 +0000
committersegher <segher@138bc75d-0d04-0410-961f-82ee72b054a4>2018-01-16 16:20:10 +0000
commitbd6ebad533300848c7663032ee48af420ad7f6c6 (patch)
tree7e25df516343df3a9fb583bf729a37929d11b7b2
parentc25b81ba01fa9ac0c1baa3aabd64190c47928f03 (diff)
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-7-branch@256750 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/rtlanal.c2
-rw-r--r--gcc/testsuite/ChangeLog8
-rw-r--r--gcc/testsuite/gcc.dg/pr83424.c30
4 files changed, 47 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 8de7e8cf1889..d170efe04c1d 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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
diff --git a/gcc/rtlanal.c b/gcc/rtlanal.c
index b93d19537bb7..8e85f14525dc 100644
--- a/gcc/rtlanal.c
+++ b/gcc/rtlanal.c
@@ -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)
{
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 6752d761d844..44e046eec5eb 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -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
diff --git a/gcc/testsuite/gcc.dg/pr83424.c b/gcc/testsuite/gcc.dg/pr83424.c
new file mode 100644
index 000000000000..5a304f502923
--- /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;
+}