diff mbox

[5/6] combine: handle REG_UNUSED in reg_dead_at_p (PR59278)

Message ID 1417476652.3387.121.camel@yam-132-YW-E178-FTW
State New
Headers show

Commit Message

Oleg Endo Dec. 1, 2014, 11:30 p.m. UTC
On Mon, 2014-12-01 at 10:38 -0700, Jeff Law wrote:
> On 11/27/14 18:44, Segher Boessenkool wrote:
> > Currently reg_dead_at_p returns 0 for registers that are set but never
> > used.  This patch repairs that oversight.  This fixes PR59278.
> >
> >
> > 2014-11-27  Segher Boessenkool  <segher@kernel.crashing.org>
> >
> > gcc/
> > 	PR rtl-optimization/59278
> > 	combine (reg_dead_at_p): Consider REG_UNUSED notes.
> OK with a testcase.  ISTM you can just create an SH specific testcase 
> from the code in the BZ.  Pre-approved with suitable testcase.
> 
> jeff
> 

Attached is the SH test case for the PR, which passes with the combine
patch applied for make -k check-gcc RUNTESTFLAGS="sh.exp=pr59278.c
--target_board=sh-sim\{-m4/-ml,-m4/-mb,-m2a/-mb,-m2/-mb}"

Cheers,
Oleg

testsuite/ChangeLog:
	* gcc.target/sh/pr59278.c: New.

Comments

Jeff Law Dec. 2, 2014, 8:15 p.m. UTC | #1
On 12/01/14 16:30, Oleg Endo wrote:
> On Mon, 2014-12-01 at 10:38 -0700, Jeff Law wrote:
>> On 11/27/14 18:44, Segher Boessenkool wrote:
>>> Currently reg_dead_at_p returns 0 for registers that are set but never
>>> used.  This patch repairs that oversight.  This fixes PR59278.
>>>
>>>
>>> 2014-11-27  Segher Boessenkool  <segher@kernel.crashing.org>
>>>
>>> gcc/
>>> 	PR rtl-optimization/59278
>>> 	combine (reg_dead_at_p): Consider REG_UNUSED notes.
>> OK with a testcase.  ISTM you can just create an SH specific testcase
>> from the code in the BZ.  Pre-approved with suitable testcase.
>>
>> jeff
>>
>
> Attached is the SH test case for the PR, which passes with the combine
> patch applied for make -k check-gcc RUNTESTFLAGS="sh.exp=pr59278.c
> --target_board=sh-sim\{-m4/-ml,-m4/-mb,-m2a/-mb,-m2/-mb}"
>
> Cheers,
> Oleg
>
> testsuite/ChangeLog:
> 	* gcc.target/sh/pr59278.c: New.
OK, please commit after Segher or together as a unified patch+testcase.

jeff
diff mbox

Patch

Index: gcc/testsuite/gcc.target/sh/pr59278.c
===================================================================
--- gcc/testsuite/gcc.target/sh/pr59278.c	(revision 0)
+++ gcc/testsuite/gcc.target/sh/pr59278.c	(revision 0)
@@ -0,0 +1,19 @@ 
+/* Check that combine considers unused regs dead.  */
+/* { dg-do compile }  */
+/* { dg-options "-O1" }  */
+/* { dg-skip-if "" { "sh*-*-*" } { "-m5*"} { "" } }  */
+/* { dg-final { scan-assembler "addc" } }  */
+
+struct result
+{
+  int a, b;
+};
+
+struct result
+test_00 (int a, int b, int d)
+{
+  struct result r;
+  r.a = a != b;
+  r.b = d + b + 1;
+  return r;
+}