Patchwork PATCH: test case for PR39839

login
register
mail settings
Submitter Sandra Loosemore
Date July 13, 2010, 4:09 p.m.
Message ID <4C3C8FC0.3040205@codesourcery.com>
Download mbox | patch
Permalink /patch/58801/
State New
Headers show

Comments

Sandra Loosemore - July 13, 2010, 4:09 p.m.
The code size regression reported in PR39839 appears to have been fixed by a 
combination of r158189 (Carrot's patch for PR42601) and r162043 (the second part 
of my patch for PR42505).  It seems worthwhile to add the test case so we can 
check that it doesn't regress and start generating unnecessary spills again.  OK 
to check in?

-Sandra

2010-07-13  Sandra Loosemore  <sandra@codesourcery.com>

	PR tree-optimization/39839

	gcc/testsuite/
	* gcc.target/arm/pr39839.c: New test case.
Mark Mitchell - July 22, 2010, 11:16 p.m.
Sandra Loosemore wrote:

> 2010-07-13  Sandra Loosemore  <sandra@codesourcery.com>
> 
>     PR tree-optimization/39839
> 
>     gcc/testsuite/
>     * gcc.target/arm/pr39839.c: New test case.

OK.

Patch

Index: gcc/testsuite/gcc.target/arm/pr39839.c
===================================================================
--- gcc/testsuite/gcc.target/arm/pr39839.c	(revision 0)
+++ gcc/testsuite/gcc.target/arm/pr39839.c	(revision 0)
@@ -0,0 +1,24 @@ 
+/* { dg-options "-mthumb -Os -march=armv5te -mthumb-interwork -fpic" }  */
+/* { dg-require-effective-target arm_thumb1_ok } */
+/* { dg-final { scan-assembler-not "str\[\\t \]*r.,\[\\t \]*.sp," } } */
+
+struct S
+{
+  int count;
+  char *addr;
+};
+
+void func(const char*, const char*, int, const char*);
+
+/* This function should not need to spill to the stack. */
+void test(struct S *p)
+{
+  int off = p->count;
+  while (p->count >= 0)
+    {
+      const char *s = "xyz";
+      if (*p->addr) s = "pqr";
+      func("abcde", p->addr + off, off, s);
+      p->count--;
+    }
+}