[testsuite, pretty-ipa?] Changes to gcc.dg/ipa tests so that they pass on pretty-ipa
Martin Jambor
mjambor@suse.cz
Tue Mar 23 18:22:00 GMT 2010
Hi,
the patch below makes all tests in gcc.dg/ipa pass in the pretty-ipa
branch - currently they fail because call sites are considered cold
and cloning is therefore avoided. This is mostly done by making the
relevant functions static so that ipa-cp does not care whether to
clone them or not. Only in gcc.dg/ipa/ipacost-2.c one of the
functions was not static on purpose and so I made a hot calls for
it by putting it into a loop.
There are other tests that fail because of differences in predict.c.
I will try to deal with those tomorrow.
The patch also removes trailing spaces (because my editor shows them
to me and its ugly).
I have checked that the changed tests pass also on trunk and would
(slightly) prefer to commit it to trunk and then merge them to
pretty-ipa rather than keep it as a yet another separate patch for the
branch and 4.6. So, OK for trunk?
Thanks,
Martin
2010-03-23 Martin Jambor <mjambor@suse.cz>
* gcc.dg/ipa/ipa-1.c: Delete trailing spaces, make all local functions
static.
* gcc.dg/ipa/ipa-2.c: Likewise.
* gcc.dg/ipa/ipa-3.c: Likewise.
* gcc.dg/ipa/ipa-4.c: Likewise.
* gcc.dg/ipa/ipa-5.c: Likewise.
* gcc.dg/ipa/ipa-6.c: Likewise.
* gcc.dg/ipa/ipa-7.c: Likewise.
* gcc.dg/ipa/ipacost-2.c: Put call to i_can_not_be_propagated_fully2
into a loop.
Index: pipa/gcc/testsuite/gcc.dg/ipa/ipa-1.c
===================================================================
--- pipa.orig/gcc/testsuite/gcc.dg/ipa/ipa-1.c
+++ pipa/gcc/testsuite/gcc.dg/ipa/ipa-1.c
@@ -3,22 +3,22 @@
/* { dg-add-options bind_pic_locally } */
#include <stdio.h>
-int g (int b, int c)
+static int g (int b, int c)
{
printf ("%d %d\n", b, c);
}
-int f (int a)
+static int f (int a)
{
/* Second parameter of g gets different values. */
if (a > 0)
g (a, 3);
else
- g (a, 5);
+ g (a, 5);
}
int main ()
{
f (7);
- return 0;
+ return 0;
}
Index: pipa/gcc/testsuite/gcc.dg/ipa/ipa-2.c
===================================================================
--- pipa.orig/gcc/testsuite/gcc.dg/ipa/ipa-2.c
+++ pipa/gcc/testsuite/gcc.dg/ipa/ipa-2.c
@@ -3,11 +3,11 @@
/* { dg-add-options bind_pic_locally } */
#include <stdio.h>
-int g (int b, int c)
+static int g (int b, int c)
{
printf ("%d %d\n", b, c);
}
-int f (int a)
+static int f (int a)
{
/* a is modified. */
if (a++ > 0)
@@ -16,7 +16,7 @@ int f (int a)
int main ()
{
f (7);
- return 0;
+ return 0;
}
Index: pipa/gcc/testsuite/gcc.dg/ipa/ipa-3.c
===================================================================
--- pipa.orig/gcc/testsuite/gcc.dg/ipa/ipa-3.c
+++ pipa/gcc/testsuite/gcc.dg/ipa/ipa-3.c
@@ -7,22 +7,22 @@
#include <stdio.h>
void t(void);
-int g (double b, double c)
+static int g (double b, double c)
{
t();
- return (int)(b+c);
+ return (int)(b+c);
}
-int f (double a)
+static int f (double a)
{
if (a > 0)
g (a, 3.1);
else
- g (a, 3.1);
+ g (a, 3.1);
}
int main ()
{
f (7.44);
- return 0;
+ return 0;
}
Index: pipa/gcc/testsuite/gcc.dg/ipa/ipa-4.c
===================================================================
--- pipa.orig/gcc/testsuite/gcc.dg/ipa/ipa-4.c
+++ pipa/gcc/testsuite/gcc.dg/ipa/ipa-4.c
@@ -3,23 +3,23 @@
/* { dg-add-options bind_pic_locally } */
#include <stdio.h>
-int g (int b, int c)
+static int g (int b, int c)
{
printf ("%d %d\n", b, c);
}
-int f (int a)
+static int f (int a)
{
- /* First and second parameter of g gets different values. */
-
+ /* First and second parameter of g gets different values. */
+
if (a > 0)
g (a, 3);
else
- g (a+1, 5);
+ g (a+1, 5);
}
int main ()
{
f (7);
- return 0;
+ return 0;
}
Index: pipa/gcc/testsuite/gcc.dg/ipa/ipa-5.c
===================================================================
--- pipa.orig/gcc/testsuite/gcc.dg/ipa/ipa-5.c
+++ pipa/gcc/testsuite/gcc.dg/ipa/ipa-5.c
@@ -6,12 +6,12 @@
#include <stdio.h>
void t(void);
-int g (float b, short c)
+static int g (float b, short c)
{
t();
return c + (int)b;
}
-int f (float a)
+static int f (float a)
{
t();
/* a is modified. */
@@ -21,7 +21,7 @@ int f (float a)
int main ()
{
f (7.6);
- return 0;
+ return 0;
}
Index: pipa/gcc/testsuite/gcc.dg/ipa/ipa-6.c
===================================================================
--- pipa.orig/gcc/testsuite/gcc.dg/ipa/ipa-6.c
+++ pipa/gcc/testsuite/gcc.dg/ipa/ipa-6.c
@@ -5,13 +5,13 @@
int
dont_inline (int);
-int
+static int
bar (int b, int c)
{
return dont_inline (c);
}
-int
+static int
foo (int a)
{
if (a++ > 0)
Index: pipa/gcc/testsuite/gcc.dg/ipa/ipa-7.c
===================================================================
--- pipa.orig/gcc/testsuite/gcc.dg/ipa/ipa-7.c
+++ pipa/gcc/testsuite/gcc.dg/ipa/ipa-7.c
@@ -4,23 +4,23 @@
#include <stdio.h>
void send_addr (int *);
-int g (int b, int c)
+static int g (int b, int c)
{
printf ("%d %d\n", b, c);
}
-int f (int a)
+static int f (int a)
{
if (a > 0)
g (a, 3);
else
- g (a, 5);
-
+ g (a, 5);
+
send_addr (&a);
}
int main ()
{
f (7);
- return 0;
+ return 0;
}
Index: pipa/gcc/testsuite/gcc.dg/ipa/ipacost-2.c
===================================================================
--- pipa.orig/gcc/testsuite/gcc.dg/ipa/ipacost-2.c
+++ pipa/gcc/testsuite/gcc.dg/ipa/ipacost-2.c
@@ -6,7 +6,7 @@ int array[100];
int t(int);
-static int
+static int
i_can_be_propagated_fully (int *a)
{
int i;
@@ -18,14 +18,14 @@ i_can_be_propagated_fully (int *a)
t(a[i+3]);
}
}
-static int
+static int
i_can_be_propagated_fully2 (int *a)
{
i_can_be_propagated_fully (a);
i_can_be_propagated_fully (a);
i_can_be_propagated_fully (a);
}
-static int
+static int
i_can_not_be_propagated_fully (int *a)
{
int i;
@@ -37,7 +37,7 @@ i_can_not_be_propagated_fully (int *a)
t(a[i+3]);
}
}
-int
+int
i_can_not_be_propagated_fully2 (int *a)
{
i_can_not_be_propagated_fully (a);
@@ -46,9 +46,12 @@ i_can_not_be_propagated_fully2 (int *a)
}
main()
{
+ int i;
i_can_be_propagated_fully2 (array);
i_can_be_propagated_fully2 (array);
- i_can_not_be_propagated_fully2 (array);
+
+ for (i = 0; i < 100; i++)
+ i_can_not_be_propagated_fully2 (array);
i_can_not_be_propagated_fully2 (array);
}
More information about the Gcc-patches
mailing list