OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /openrisc/trunk/gnu-old/gcc-4.2.2/gcc/testsuite/gcc.dg/tree-ssa
    from Rev 154 to Rev 816
    Reverse comparison

Rev 154 → Rev 816

/alias-8.c
0,0 → 1,15
/* { dg-do run } */
/* { dg-options "-O2" } */
 
void abort(void);
int main()
{
int a[2];
int i = 1;
a[0] = 1;
a[1] = 2;
if (*(a + i) != 2)
abort();
return 0;
}
 
alias-8.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20040911-1.c =================================================================== --- 20040911-1.c (nonexistent) +++ 20040911-1.c (revision 816) @@ -0,0 +1,22 @@ +/* Verify that points-to information is handled properly for PTR + OFFSET + pointer arithmetics. */ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-alias1-vops" } */ + +char buf[4], *q; +int foo (int i) +{ + char c, *p; + q = &c; + p = buf; + if (i) + p = p + 3; + else + p = p + 2; + *p = 6; + c = 8; + return *p; +} + +/* { dg-final { scan-tree-dump-not "VUSE
20040911-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20040517-1.c =================================================================== --- 20040517-1.c (nonexistent) +++ 20040517-1.c (revision 816) @@ -0,0 +1,21 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-alias1-vops" } */ +extern void abort (void); +int a; + +extern void __attribute__ ((malloc)) *foo (); + +void bar (void) +{ + a = 1; + foo (); + if (a) + abort (); +} + +/* We used to treat malloc functions like pure and const functions, but + malloc functions may clobber global memory. Only the function result + does not alias any other pointer. + Hence, we must have a VDEF for a before and after the call to foo(). */ +/* { dg-final { scan-tree-dump-times "V_MAY_DEF" 2 "alias1"} } */ +/* { dg-final { cleanup-tree-dump "alias1" } } */
20040517-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20030814-2.c =================================================================== --- 20030814-2.c (nonexistent) +++ 20030814-2.c (revision 816) @@ -0,0 +1,22 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-dom3" } */ + +extern void abort (void); + +void +foo (int value) +{ + switch (value) + { + case 42: + if (value != 42) + abort (); + case 50: + blah (); + } +} + +/* There should be no IF conditionals. */ +/* { dg-final { scan-tree-dump-times "if " 0 "dom3"} } */ + +/* { dg-final { cleanup-tree-dump "dom3" } } */
20030814-2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20030917-1.c =================================================================== --- 20030917-1.c (nonexistent) +++ 20030917-1.c (revision 816) @@ -0,0 +1,19 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-store_ccp" } */ + + +extern int board[]; + +void +findbestextension (int blah, int blah2) +{ + int defval; + defval = def_val (board[blah2]); + if (blah) + defval = 0; + foo (defval); +} + +/* The argument to "foo" should be a variable, not a constant. */ +/* { dg-final { scan-tree-dump-times "foo .defval" 1 "store_ccp"} } */ +/* { dg-final { cleanup-tree-dump "store_ccp" } } */
20030917-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: builtin-printf-chk-1.c =================================================================== --- builtin-printf-chk-1.c (nonexistent) +++ builtin-printf-chk-1.c (revision 816) @@ -0,0 +1,42 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-fab" } */ + +extern int __printf_chk (int, const char *, ...); +volatile int vi0, vi1, vi2, vi3, vi4, vi5, vi6, vi7, vi8, vi9, via; + +void test (void) +{ + vi0 = 0; + __printf_chk (1, "hello"); + vi1 = 0; + __printf_chk (1, "hello\n"); + vi2 = 0; + __printf_chk (1, "a"); + vi3 = 0; + __printf_chk (1, ""); + vi4 = 0; + __printf_chk (1, "%s", "hello"); + vi5 = 0; + __printf_chk (1, "%s", "hello\n"); + vi6 = 0; + __printf_chk (1, "%s", "a"); + vi7 = 0; + __printf_chk (1, "%s", ""); + vi8 = 0; + __printf_chk (1, "%c", 'x'); + vi9 = 0; + __printf_chk (1, "%s\n", "hello\n"); + via = 0; +} + +/* { dg-final { scan-tree-dump "vi0.*__printf_chk.*1.*\"hello\".*vi1" "fab"} } */ +/* { dg-final { scan-tree-dump "vi1.*puts.*\"hello\".*vi2" "fab"} } */ +/* { dg-final { scan-tree-dump "vi2.*putchar.*vi3" "fab"} } */ +/* { dg-final { scan-tree-dump "vi3 = 0\[^\(\)\]*vi4 = 0" "fab"} } */ +/* { dg-final { scan-tree-dump "vi4.*__printf_chk.*1.*\"hello\".*vi5" "fab"} } */ +/* { dg-final { scan-tree-dump "vi5.*puts.*\"hello\".*vi6" "fab"} } */ +/* { dg-final { scan-tree-dump "vi6.*putchar.*vi7" "fab"} } */ +/* { dg-final { scan-tree-dump "vi7 = 0\[^\(\)\]*vi8 = 0" "fab"} } */ +/* { dg-final { scan-tree-dump "vi8.*putchar.*vi9" "fab"} } */ +/* { dg-final { scan-tree-dump "vi9.*puts.*\"hello\\\\n\".*via" "fab"} } */ +/* { dg-final { cleanup-tree-dump "fab" } } */
builtin-printf-chk-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: vrp01.c =================================================================== --- vrp01.c (nonexistent) +++ vrp01.c (revision 816) @@ -0,0 +1,28 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-vrp1" } */ + +foo (int *p, int i) +{ + int x; + + if (i > 10) + { + if (p) + { + x = *p; + p = 0; + } + } + else + p = 0; + + /* This should be folded to if (1), but only if we insert an + assertion on the ELSE edge from the inner 'if (p)'. */ + if (p == 0) + return x + 1; + + return i; +} + +/* { dg-final { scan-tree-dump-times "Folding predicate p_.*to 1" 1 "vrp1" } } */ +/* { dg-final { cleanup-tree-dump "vrp1" } } */
vrp01.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ssa-pre-2.c =================================================================== --- ssa-pre-2.c (nonexistent) +++ ssa-pre-2.c (revision 816) @@ -0,0 +1,22 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-pre-stats" } */ +int motion_test1(int data, int data_0, int data_3, int v) +{ + int i; + int t, u; + + if (data) + i = data_0 + data_3; + else { + v = 2; + i = 5; + } + t = data_0 + data_3; + u = i; + return v * t * u; +} +/* We should eliminate one computation of data_0 + data_3 along the + main path, and one computation of v * i along the main path, causing + two eliminations. */ +/* { dg-final { scan-tree-dump-times "Eliminated: 2" 1 "pre"} } */ +/* { dg-final { cleanup-tree-dump "pre" } } */
ssa-pre-2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ssa-ccp-13.c =================================================================== --- ssa-ccp-13.c (nonexistent) +++ ssa-ccp-13.c (revision 816) @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-optimized" } */ + +static const char f[3] = "?"; + +int foo() +{ + int i = 0; + return f[i] != '?'; +} + +/* { dg-final { scan-tree-dump "return 0;" "optimized" } } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */ +
ssa-ccp-13.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: salias-1.c =================================================================== --- salias-1.c (nonexistent) +++ salias-1.c (revision 816) @@ -0,0 +1,19 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-salias" } */ + +struct { + struct { + struct { + int i, j; + } c; + } b; +} a; + +int foo(void) +{ + a.b.c.i = 0; + return a.b.c.j; +} + +/* { dg-final { scan-tree-dump-times "SFT" 2 "salias" } } */ +/* { dg-final { cleanup-tree-dump "salias" } } */
salias-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pr22171.c =================================================================== --- pr22171.c (nonexistent) +++ pr22171.c (revision 816) @@ -0,0 +1,28 @@ +/* { dg-options "-O2" } */ + +static unsigned int old_serial_port_irq[10]; + +static struct uart_8250_port { + volatile unsigned int slock; + unsigned int irq; +} serial8250_ports[10]; + +static __inline__ __attribute__((always_inline)) int irq_canonicalize(int irq) +{ + return ((irq == 2) ? 9 : irq); +} + +void serial8250_isa_init_ports(void) +{ + struct uart_8250_port *up; + int i; + + for (i = 0, up = serial8250_ports; i < 10; i++, up++) + up->irq = irq_canonicalize(old_serial_port_irq[i]); +} + +int main(void) +{ + serial8250_isa_init_ports(); + return 0; +}
pr22171.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pr20470.c =================================================================== --- pr20470.c (nonexistent) +++ pr20470.c (revision 816) @@ -0,0 +1,15 @@ +/* { dg-do compile } */ +/* { dg-options "-fdump-tree-gimple" } */ + +/* PR tree-optimization/20470: + Missing fold to abs(x) when x == MINUS_EXPR. */ +#define abs(x) ((x) >= 0 ? (x) : -(x)) + +int i,j,k; +void f1() +{ + i = abs(j-k); +} + +/* { dg-final { scan-tree-dump-times "ABS_EXPR" 1 "gimple" } } */ +/* { dg-final { cleanup-tree-dump "gimple" } } */
pr20470.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: vrp26.c =================================================================== --- vrp26.c (nonexistent) +++ vrp26.c (revision 816) @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-vrp1" } */ + +int +foo(int a) +{ + int z = a | 1; + return z != 0; +} + +/* VRP should optimize this to a trivial "return 1". */ +/* { dg-final { scan-tree-dump-times "return 1" 1 "vrp1" } } * / +/* { dg-final { cleanup-tree-dump "vrp1" } } */ + + + +
vrp26.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: reassoc-12.c =================================================================== --- reassoc-12.c (nonexistent) +++ reassoc-12.c (revision 816) @@ -0,0 +1,11 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-reassoc1-details" } */ +int f(int a, int b) +{ + /* MAX_EXPR should cause it to be equivalent to a. */ + int c = a>=b?a:b; + int d = c>=a?c:a; + return d; +} +/* { dg-final { scan-tree-dump-times "Equivalence:" 1 "reassoc1"} } */ +/* { dg-final { cleanup-tree-dump "reassoc1" } } */
reassoc-12.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pr18133-1.c =================================================================== --- pr18133-1.c (nonexistent) +++ pr18133-1.c (revision 816) @@ -0,0 +1,28 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-optimized-blocks" } */ + +void foo (void) +{ +void *p; +p = &&L0; +goto *p; +L0: +return; +} + +/* The goto &L0 should have been optimized away during CFG + cleanups. */ +/* { dg-final { scan-tree-dump-times "goto &L0" 0 "optimized" } } */ + +/* There should not be any abnormal edges as DOM removed the + computed goto. */ + +/* { dg-final { scan-tree-dump-times "ab" 0 "optimized" } } */ + +/* And verify that we have fixed the fallthru flag as well. + After DOM we will have two fallthru edges (e->0, 0->1), + but in the dump files we mention the 0->1 two times. So + scan for 3 instances of "fallthru". */ + +/* { dg-final { scan-tree-dump-times "fallthru" 3 "optimized" } } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */
pr18133-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pr23109.c =================================================================== --- pr23109.c (nonexistent) +++ pr23109.c (revision 816) @@ -0,0 +1,35 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -funsafe-math-optimizations -fdump-tree-recip -fdump-tree-lim" } */ + +double F[2] = { 0., 0. }, e = 0.; + +int main() +{ + int i; + double E, W, P, d; + + /* make sure the program crashes on FP exception */ + unsigned short int Mask; + + W = 1.; + d = 2.*e; + E = 1. - d; + + for( i=0; i < 2; i++ ) + if( d > 0.01 ) + { + P = ( W < E ) ? (W - E)/d : (E - W)/d; + F[i] += P; + } + + return 0; +} + +/* LIM only performs the transformation in the no-trapping-math case. In + the future we will do it for trapping-math as well in recip, check that + this is not wrongly optimized. */ +/* { dg-final { scan-tree-dump-not "reciptmp" "lim" } } */ +/* { dg-final { scan-tree-dump-not "reciptmp" "recip" } } */ +/* { dg-final { cleanup-tree-dump "recip" } } */ +/* { dg-final { cleanup-tree-dump "lim" } } */ +
pr23109.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: vrp09.c =================================================================== --- vrp09.c (nonexistent) +++ vrp09.c (revision 816) @@ -0,0 +1,31 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-vrp1" } */ + +foo (int *p) +{ + int x = baz (); + + if (p == 0) + goto L78; + else + { + x = *p; + /* This should be folded to if (1). */ + if (p) + x = x + 1; +L78: + /* This should not be folded to if (1). */ + if (p) + { + x = baz (*p); + /* This should be folded to if (1). */ + if (p) + return x + 3; + } + + return x - 3; + } +} + +/* { dg-final { scan-tree-dump-times "Folding predicate p_.. != 0B to 1" 2 "vrp1" } } */ +/* { dg-final { cleanup-tree-dump "vrp1" } } */
vrp09.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pr21582.c =================================================================== --- pr21582.c (nonexistent) +++ pr21582.c (revision 816) @@ -0,0 +1,28 @@ +/* { dg-do link } */ +/* { dg-options "-O2 -fdump-tree-vrp1" } */ + +static inline void do_thing(char *s, int *p, char *q) +{ + /* This should be folded away. */ + if (s == 0 || q == 0) + link_error (); + + /* This should not be folded as 'p' is not marked nonnull. */ + if (p) + *p = 3; +} + +void __attribute__((nonnull (1, 3))) do_other_thing(char *s, int *p, char *q) +{ + do_thing(s, p, q); +} + +int i; + +main() +{ + do_other_thing ("xxx", &i, "yyy"); +} + +/* { dg-final { scan-tree-dump-times "Folding predicate p_.*" 0 "vrp1" } } */ +/* { dg-final { cleanup-tree-dump "vrp1" } } */
pr21582.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pr20657.c =================================================================== --- pr20657.c (nonexistent) +++ pr20657.c (revision 816) @@ -0,0 +1,18 @@ +/* PR tree-optimization/20657 + VRP did not pick up a conditional equivalence from the first "if" + statement, which was needed to eliminate the second "if" statement. */ + +/* { dg-do compile } */ +/* { dg-options "-O2 -fno-tree-dominator-opts -fdump-tree-vrp1-details" } */ + +int +foo (int a) +{ + if (a == 0) + if (a == 0) + return 1; + return 0; +} + +/* { dg-final { scan-tree-dump-times "Folding predicate" 1 "vrp1"} } */ +/* { dg-final { cleanup-tree-dump "vrp1" } } */
pr20657.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: loadpre10.c =================================================================== --- loadpre10.c (nonexistent) +++ loadpre10.c (revision 816) @@ -0,0 +1,49 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-pre-stats" } */ +struct tree_common +{ + int code; +}; +union tree_node +{ + struct tree_common common; +}; +typedef union tree_node *tree; + +extern tree test (tree, int, int); +extern tree foo (void); +extern void abort (void) __attribute__ ((__noreturn__)); + +/* Redundant loads of expr->common.code */ +tree +test (tree expr, int t, int D17630) +{ + int __i; + +L0: + if (expr->common.code != 142) goto L23; else goto L2; + +L2: + __i = 0; + goto L10; + +L10: + __i = __i + 1; + if (D17630 != __i) goto L8; else goto L19; + +L8: + if (t) goto L15; else goto L10; + +L15: + expr = foo (); + if (expr->common.code != 142) goto L23; else goto L0; + +L19: + abort (); + +L23: + return expr; +} +/* { dg-final { scan-tree-dump-times "Eliminated: 1" 1 "pre"} } */ +/* { dg-final { cleanup-tree-dump "pre" } } */ +
loadpre10.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ssa-ccp-1.c =================================================================== --- ssa-ccp-1.c (nonexistent) +++ ssa-ccp-1.c (revision 816) @@ -0,0 +1,75 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-store_ccp" } */ + +extern void link_error (void); + +/* check folding */ + +void test1 (void) +{ + unsigned int l = 3 * 4 - 5 / 2; + if (l != 10) + link_error (); +} + +void test11 (void) +{ + unsigned int l = (((((((3 / 2 + 2) * 4) & 7) ^ 3) % 8) << 2) + 1) >> 2; + if (l != 7) + link_error (); +} + +/* cprop in a basic block */ +void test111 (void) +{ + unsigned int l0 = 3 / 2 + 2; + unsigned int l1 = l0 * 4; + unsigned int l2 = 7; + unsigned int l3 = l1 & l2; + unsigned int l4 = 3; + unsigned int l5 = l3 ^ l4; + unsigned int l6 = 8; + unsigned int l7 = l5 % l6; + unsigned int l8 = 2; + unsigned int l9 = l7 << l8; + unsigned int l10 = l9 + 1; + unsigned int l11 = l10 >> 2; + if (l11 != 7) + link_error (); +} + + +/* cprop after an if statement */ +void test1111 (int p) +{ + int l = 53; + if (p) + { + if ((67 + l - 25) != 95) + link_error (); + } + else + { + if ((93 - l + 25) != 65) + link_error (); + } +} + +/* cprop after a loop */ +void test11111 (int p, int q, int r) +{ + int l = 53; + while (p < r) + { + if ((67 + l - 25) != 95) + link_error (); + p -= q; + } +} + + + +/* There should be not link_error calls, if there is any the + optimization has failed */ +/* { dg-final { scan-tree-dump-times "link_error" 0 "store_ccp"} } */ +/* { dg-final { cleanup-tree-dump "store_ccp" } } */
ssa-ccp-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: loop-11.c =================================================================== --- loop-11.c (nonexistent) +++ loop-11.c (revision 816) @@ -0,0 +1,28 @@ +/* A test for final value replacement and higher-order ivs, + see PR 22442. */ + +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-optimized" } */ + +void bar (unsigned); + +void foo (void) +{ + unsigned i, a; + + for (i = 0; i < 5; i++) + a = i * i; + + bar (a); +} + +/* Final value of a gets replaced. */ + +/* { dg-final { scan-tree-dump-times "\\(16\\)" 1 "optimized" } } */ + +/* And the empty loop is removed. */ + +/* { dg-final { scan-tree-dump-times "if " 0 "optimized" } } */ + +/* { dg-final { cleanup-tree-dump "optimized" } } */ +
loop-11.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: bool-2.c =================================================================== --- bool-2.c (nonexistent) +++ bool-2.c (revision 816) @@ -0,0 +1,22 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-optimized" } */ + +int f(_Bool x) +{ + int y; + if (x) + y = 1; + else + y = 0; + return y; +} + +/* There should be no != 0 which is produced by the front-end as + bool_var != 0 is the same as bool_var. */ +/* { dg-final { scan-tree-dump-times "!= 0" 0 "optimized"} } */ + +/* There should be no adde for powerpc. Check if we actually optimized + away the comparison. */ +/* { dg-final { scan-assembler-times "adde" 0 { target powerpc*-*-* } } } */ + +/* { dg-final { cleanup-tree-dump "optimized" } } */
bool-2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ssa-pre-14.c =================================================================== --- ssa-pre-14.c (nonexistent) +++ ssa-pre-14.c (revision 816) @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-optimized" } */ +extern __SIZE_TYPE__ strlen (const char *) __attribute__ ((__pure__)); + +void +foo (const char *str) +{ + __SIZE_TYPE__ a = strlen (str); + __SIZE_TYPE__ b = strlen (str); + if (a != b) + link_error (); +} +/* { dg-final { scan-tree-dump-times "link_error" 0 "optimized"} } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */
ssa-pre-14.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20030703-2.c =================================================================== --- 20030703-2.c (nonexistent) +++ 20030703-2.c (revision 816) @@ -0,0 +1,44 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-dom3" } */ + +extern void abort (void); + +union tree_node; +typedef union tree_node *tree; +extern const char tree_code_type[]; + +union tree_node +{ + int code; + long pointer_alias_set; +}; + +long +get_alias_set (t) + tree t; +{ + if (tree_code_type[t->code]) + abort (); + if (t->pointer_alias_set) + { + tree __t = t; + if (tree_code_type[__t->code]) + abort (); + } +} + +/* There should be precisely one load of {t,__t}->code. If there is + more than one, then the dominator optimizations failed. */ +/* { dg-final { scan-tree-dump-times "->code" 1 "dom3"} } */ + +/* There should be precisely one load of tree_code_type. If there is + more than one, then the dominator optimizations failed. */ +/* { dg-final { scan-tree-dump-times "tree_code_type" 1 "dom3"} } */ + +/* There should be one IF conditional. If 'tree_code_type[t->code]' is + zero, then the third if() conditional is unnecessary. That should cause + the call to abort() to be removed, which in turn causes the whole second + if() to disappear. */ +/* { dg-final { scan-tree-dump-times "if " 1 "dom3"} } */ + +/* { dg-final { cleanup-tree-dump "dom3" } } */
20030703-2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20040209-1.c =================================================================== --- 20040209-1.c (nonexistent) +++ 20040209-1.c (revision 816) @@ -0,0 +1,52 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -Wuninitialized" } */ + +typedef union tree_node *tree; + +struct tree_common +{ + tree chain; +}; + +struct tree_decl +{ + struct tree_common common; + tree name; +}; + + +union tree_node +{ + struct tree_common common; + struct tree_decl decl; +}; + +int pedantic; + +void +finish_struct (tree t, tree fieldlist, tree attributes) +{ + union tree_node * x; + + if (pedantic) + { + x = fieldlist; + if (x->decl.name == 0) + { + while (x) + x = x->common.chain; + foo (fieldlist); + } + } + + x = fieldlist; + if (x) + { + do + { + x = x->common.chain; + } while (x != 0); + } + + bar1 (&fieldlist); +}
20040209-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: loadpre18.c =================================================================== --- loadpre18.c (nonexistent) +++ loadpre18.c (revision 816) @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-pre-stats" } */ +typedef int type[2]; +int main(type *a, int argc) +{ + int d, e; + + /* Should be able to eliminate the second load of *a along the main path. */ + d = (*a)[argc]; + if (argc) + argc++; + e = (*a)[argc]; + return d + e; +} +/* { dg-final { scan-tree-dump-times "Eliminated: 1" 1 "pre" { xfail *-*-* } } } */ +/* { dg-final { cleanup-tree-dump "pre" } } */
loadpre18.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20030922-1.c =================================================================== --- 20030922-1.c (nonexistent) +++ 20030922-1.c (revision 816) @@ -0,0 +1,34 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-dom3" } */ + +extern void abort (void); + +union tree_node; +typedef union tree_node *tree; +enum tree_code +{ + BIND_EXPR, +}; +struct tree_common +{ + enum tree_code code:8; +}; +union tree_node +{ + struct tree_common common; +}; +tree +voidify_wrapper_expr (tree wrapper) +{ + switch (wrapper->common.code) + { + case BIND_EXPR: + if (wrapper->common.code != BIND_EXPR) + abort (); + } +} + + +/* There should be no IF conditionals. */ +/* { dg-final { scan-tree-dump-times "if " 0 "dom3"} } */ +/* { dg-final { cleanup-tree-dump "dom3" } } */
20030922-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: reassoc-3.c =================================================================== --- reassoc-3.c (nonexistent) +++ reassoc-3.c (revision 816) @@ -0,0 +1,6 @@ +int main(int a, int b, int c, int d) +{ + int e = (a & ~b) & (~c & d); + int f = (~c & a) & (b & ~d); + return (e & f); +}
reassoc-3.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ssa-ccp-9.c =================================================================== --- ssa-ccp-9.c (nonexistent) +++ ssa-ccp-9.c (revision 816) @@ -0,0 +1,55 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-optimized" } */ + +/* Check that cprop works for assignments to array elements and structs. */ + +struct foo { + int a; +}; + +extern void link_error (void); + +void +test9 (struct foo f) +{ + f.a = 0; + if (f.a != 0) + link_error (); +} + +void +test99 (struct foo *f) +{ + f->a = 0; + if (f->a != 0) + link_error (); +} + +void +test999 (int *arr) +{ + *arr = 0; + if (*arr != 0) + link_error (); +} + +void +test9999 (int *arr) +{ + arr[13] = 0; + if (arr[13] != 0) + link_error (); +} + +void +test99999 (int *arr, int j) +{ + arr[j] = 0; + if (arr[j] != 0) + link_error (); +} + +/* There should be no link_error calls, if there is any, the + optimization has failed */ +/* { dg-final { scan-tree-dump-times "link_error" 0 "optimized"} } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */
ssa-ccp-9.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ssa-dse-4.c =================================================================== --- ssa-dse-4.c (nonexistent) +++ ssa-dse-4.c (revision 816) @@ -0,0 +1,19 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-dse1" } */ + +foo( int *a) +{ + *a = 5; + *a = 3; +} + + + + +/* We should eliminate the first assignment to *p, but not the second. */ +/* { dg-final { scan-tree-dump-times "= 5" 0 "dse1"} } */ +/* { dg-final { scan-tree-dump-times "= 3" 1 "dse1"} } */ + +/* { dg-final { cleanup-tree-dump "dse1" } } */ + +
ssa-dse-4.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: loop-19.c =================================================================== --- loop-19.c (nonexistent) +++ loop-19.c (revision 816) @@ -0,0 +1,27 @@ +/* This tests strength reduction and choice of induction variables. The targets + for this testcase are quite limited, as with different set of available + addressing modes, the results may be quite different. + + The testcase comes from PR 29256 (and originally, the stream benchmark). */ + +/* { dg-do compile { target i?86-*-* x86_64-*-* powerpc*-*-*} } */ +/* { dg-options "-O3 -fdump-tree-final_cleanup" } */ + +# define N 2000000 +static double a[N],c[N]; +void tuned_STREAM_Copy() +{ + int j; + for (j=0; j
loop-19.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: recip-1.c =================================================================== --- recip-1.c (nonexistent) +++ recip-1.c (revision 816) @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -funsafe-math-optimizations -fdump-tree-recip" } */ + +float e(float *x, float *y, float *z) +{ + float m = __builtin_sqrt (*x * *x + *y * *y + *z * *z); + *x /= m; + *y /= m; + *z /= m; +} + +/* Look for only one division. */ +/* { dg-final { scan-tree-dump-times "= .* /" 1 "recip" } } */ +/* { dg-final { cleanup-tree-dump "recip" } } */
recip-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20030729-1.c =================================================================== --- 20030729-1.c (nonexistent) +++ 20030729-1.c (revision 816) @@ -0,0 +1,54 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-dom3" } */ + +extern void abort (void); +union tree_node; +typedef union tree_node *tree; + + +enum tree_code +{ + SET_TYPE, + RECORD_TYPE, + LAST_AND_UNUSED_TREE_CODE +}; +extern const char tree_code_type[]; + +struct tree_common +{ + + enum tree_code code:8; +}; + + + + + +union tree_node +{ + struct tree_common common; +}; + +readonly_fields_p (type) + tree type; +{ + + if (type->common.code != RECORD_TYPE) + return; + + if (tree_code_type[type->common.code] != 't') + abort (); + + return; +} + +/* A good optimizer would realize that the cast to (unsigned int) is + useless as the earlier cast of the same value of (unsigned char) will + always produce the same result. */ +/* { dg-final { scan-tree-dump-times "\\(unsigned int\\)" 0 "dom3"} } */ + +/* There should be one load of ->common.code. We currently fail this + because we load from ->common.code using different types. */ +/* { dg-final { scan-tree-dump-times "common\.code" 1 "dom3"} } */ + +/* { dg-final { cleanup-tree-dump "dom3" } } */
20030729-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: cfgcleanup-1.c =================================================================== --- cfgcleanup-1.c (nonexistent) +++ cfgcleanup-1.c (revision 816) @@ -0,0 +1,19 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-dce1" } */ +void +cleanup (int a, int b) +{ + if (a) + if (b) + a = 1; + else + b = 1; + else if (a) + a = 1; + else + b = 1; + return; +} +/* Dce should get rid of the initializers and cfgcleanup should elliminate ifs */ +/* { dg-final { scan-tree-dump-times "if " 0 "dce1"} } */ +/* { dg-final { cleanup-tree-dump "dce1" } } */
cfgcleanup-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: structopt-3.c =================================================================== --- structopt-3.c (nonexistent) +++ structopt-3.c (revision 816) @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-optimized" } */ + +struct foo +{ + int a; + int b; +} temp; +/* We should be able to optimize this to return 11. */ +int main(void) +{ + temp.a = 5; + temp.b = 6; + return temp.a + temp.b; +} +/* { dg-final { scan-tree-dump-times "return 11" 1 "optimized" } } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */
structopt-3.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20030807-7.c =================================================================== --- 20030807-7.c (nonexistent) +++ 20030807-7.c (revision 816) @@ -0,0 +1,38 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-dom3" } */ + +extern void abort (void); + +union tree_node; +typedef union tree_node *tree; +struct tree_common +{ + int code; +}; +struct tree_list +{ + tree purpose; +}; +union tree_node +{ + struct tree_common common; + struct tree_list list; +}; +void +simplify_condition (cond_p) + tree *cond_p; +{ + tree decl; + tree cond = *cond_p; + if (cond->common.code != 42) + abort (); + decl = cond->list.purpose; + if (cond->common.code != 42) + abort (); + c_simplify_stmt (&decl); +} + +/* There should be exactly one IF conditional. TBAA is not able to + determine that 'decl' and 'cond' can't alias. */ +/* { dg-final { scan-tree-dump-times "if " 1 "dom3" { xfail *-*-* } } } */ +/* { dg-final { cleanup-tree-dump "dom3" } } */
20030807-7.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: vrp10.c =================================================================== --- vrp10.c (nonexistent) +++ vrp10.c (revision 816) @@ -0,0 +1,25 @@ +/* { dg-do run } */ +/* { dg-options "-O2" } */ + +extern void abort (void); + +foo (int k, int j) +{ + if (k >= 10) + { + if (j > k) + { + /* We should fold this to if (0). */ + if (j < 10) + abort (); + } + } + + return j; +} + +main() +{ + foo (10, 3); + return 0; +}
vrp10.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: alias-13.c =================================================================== --- alias-13.c (nonexistent) +++ alias-13.c (revision 816) @@ -0,0 +1,33 @@ +/* { dg-do link } */ +/* { dg-options "-O2" } */ + + +struct a +{ + char a1; +}; + +int *aa; + +void g(int *a) +{ + aa = a; + *a = 2; +} + +int t(int i, struct a *b) +{ + g(&i); + b->a1 = 1; + i = 2; + if (b->a1 != 1) + link_failure (); +} +int main(void) +{ + struct a b; + t(1, &b); + return 0; +} + +
alias-13.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: loadpre6.c =================================================================== --- loadpre6.c (nonexistent) +++ loadpre6.c (revision 816) @@ -0,0 +1,76 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-pre-stats" } */ + +union tree_node; +typedef union tree_node *tree; + +struct tree_common +{ + tree chain; +}; + +struct tree_list +{ + struct tree_common common; + tree value; +}; + +union tree_node + +{ + struct tree_common common; + struct tree_list list; +}; + +extern void abort (void) __attribute__((noreturn)); + +void __attribute__((noinline)) +foo (void) +{ + abort (); +} + +/* There are some reloaded loads of *cell, and cell->common.chain on various + branches. */ +void __attribute__((noinline)) +remove_useless_vars (tree *unexpanded_var_list, int dump_file) +{ + tree var, *cell; + int c = 0; + for (cell = unexpanded_var_list; *cell; ) + { + var = (*cell)->list.value; + if (var) + { + if (dump_file) + foo (); + + *cell = ((*cell)->common.chain); + continue; + } + + cell = &((*cell)->common.chain); + } +} +extern void *malloc (__SIZE_TYPE__) __attribute__ ((malloc)); + +int +main (void) +{ + int i; + tree unexpanded_var_list, last = (tree) 0; + + for (i = 0; i < 2; i++) + { + unexpanded_var_list = malloc (sizeof (struct tree_list)); + unexpanded_var_list->list.value = (tree) (long unsigned) (i & 1); + unexpanded_var_list->common.chain = last; + last = unexpanded_var_list; + } + + remove_useless_vars (&unexpanded_var_list, 0); + return 0; +} +/* { dg-final { scan-tree-dump-times "Eliminated: 2" 1 "pre" } } */ +/* { dg-final { cleanup-tree-dump "pre" } } */ +
loadpre6.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: loop-7.c =================================================================== --- loop-7.c (nonexistent) +++ loop-7.c (revision 816) @@ -0,0 +1,35 @@ +/* PR tree-optimization/19828 */ +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-lim-details" } */ + +int cst_fun1 (int) __attribute__((__const__)); +int cst_fun2 (int) __attribute__((__const__)); +int pure_fun1 (int) __attribute__((__pure__)); +int pure_fun2 (int) __attribute__((__pure__)); +int foo (void); + +int xxx (void) +{ + int i, k = foo (), x = 0; + + for (i = 0; i < 100; i++) + { + x += cst_fun1 (k); + x += pure_fun1 (k); + + if (k) + { + x += cst_fun2 (k); + x += pure_fun2 (k); + } + } + + return x; +} + +/* Calls to cst_fun1 and pure_fun1 may be moved out of the loop. + Calls to cst_fun2 and pure_fun2 should not be, since calling + with k = 0 may be invalid. */ + +/* { dg-final { scan-tree-dump-times "Moving statement" 3 "lim" } } */ +/* { dg-final { cleanup-tree-dump "lim" } } */
loop-7.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: asm-1.c =================================================================== --- asm-1.c (nonexistent) +++ asm-1.c (revision 816) @@ -0,0 +1,17 @@ +/* Make sure that gcc understands that an in/out operand is a use as well + as a def. */ + +/* { dg-do compile } */ +/* { dg-options "-O -fdump-tree-optimized" } */ + +void f() +{ + int i = 42; + int j = 63; + + asm ("": "=m"(i), "+r"(j) : "m"(i)); +} + +/* { dg-final { scan-tree-dump-times "42" 1 "optimized" } } */ +/* { dg-final { scan-tree-dump-times "63" 1 "optimized" } } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */
asm-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: vrp18.c =================================================================== --- vrp18.c (nonexistent) +++ vrp18.c (revision 816) @@ -0,0 +1,34 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-vrp1" } */ + +static int blocksize = 4096; + +int bar (int); + +void foo (void) +{ + int toread; + int bytes; + static char eof_reached = 0; + + toread = blocksize; + bytes = 1; + + while (toread != 0) + { + bytes = bar (toread); + if (bytes <= 0) + { + if (bytes < 0) + continue; + break; + } + toread -= bytes; + } + + if (bytes == 0) + eof_reached = 1; +} + +/* { dg-final { scan-tree-dump-times "Simplified relational" 1 "vrp1" } } */ +/* { dg-final { cleanup-tree-dump "vrp1" } } */
vrp18.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pr26421.c =================================================================== --- pr26421.c (nonexistent) +++ pr26421.c (revision 816) @@ -0,0 +1,20 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-alias1-vops" } */ + +typedef struct { + int i; + int j; + int k; +} Foo; + +void bar(Foo*); +int foo(void) +{ + Foo a; + a.i = 1; + bar(&a); + return a.i; +} + +/* { dg-final { scan-tree-dump-times "V_MAY_DEF" 2 "alias1" } } */ +/* { dg-final { cleanup-tree-dump "alias1" } } */
pr26421.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pr21417.c =================================================================== --- pr21417.c (nonexistent) +++ pr21417.c (revision 816) @@ -0,0 +1,54 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-dom3-details" } */ + +struct tree_common +{ + int code; +}; +union tree_node +{ + struct tree_common common; +}; +typedef union tree_node *tree; + +extern tree test (tree, int, int); +extern tree foo (void); +extern void abort (void) __attribute__ ((__noreturn__)); + +tree +test (tree expr, int t, int D17630) +{ + int __i; + +L0: + if (expr->common.code != 142) goto L23; else goto L2; + +L2: + __i = 0; + goto L10; + +L10: + __i = __i + 1; + if (D17630 != __i) goto L8; else goto L19; + +L8: + if (t) goto L15; else goto L10; + +L15: + expr = foo (); + if (expr->common.code != 142) goto L23; else goto L0; + +L19: + abort (); + +L23: + return expr; +} + + +/* We should thread the backedge to the top of the loop; ie we only + execute the if (expr->common.code != 142) test once per loop + iteration. */ +/* { dg-final { scan-tree-dump-times "Threaded jump" 1 "dom3" } } */ +/* { dg-final { cleanup-tree-dump "dom3" } } */ +
pr21417.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: phi-opt-5.c =================================================================== --- phi-opt-5.c (nonexistent) +++ phi-opt-5.c (revision 816) @@ -0,0 +1,59 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -ffinite-math-only -fdump-tree-phiopt1" } */ + +float repl1 (float varx) +{ + if (varx < 0.0) + return 0.0; + else if (varx > 1.0) + return 1.0; + else + return varx; +} + +/* Should be turned to + + varx_4 = MIN_EXPR <1.0e+0, varx_2>; + varx_5 = MAX_EXPR ; */ + +/* { dg-final { scan-tree-dump "varx.*MIN_EXPR.*1\\.0" "phiopt1"} } */ +/* { dg-final { scan-tree-dump "varx.*MAX_EXPR.*0\\.0" "phiopt1"} } */ + +float repl2 (float vary) +{ + if (vary > 1.0) + return 1.0; + else if (vary < 0.0) + return 0.0; + else + return vary; +} + +/* Should be turned to + + vary_4 = MAX_EXPR <0.0, vary_2>; + vary_5 = MIN_EXPR ; */ + +/* { dg-final { scan-tree-dump "vary.*MAX_EXPR.*0\\.0" "phiopt1"} } */ +/* { dg-final { scan-tree-dump "vary.*MIN_EXPR.*1\\.0" "phiopt1"} } */ + +float repl3 (float varz, float vara, float varb) +{ + if (varz > vara) + return vara; + else if (varz < varb) + return varb; + else + return varz; +} + +/* Should be turned to + + if (varz_2 > vara_3) goto ; else goto ; + +:; + vara_6 = MAX_EXPR ; */ + +/* { dg-final { scan-tree-dump "if .*varz" "phiopt1"} } */ +/* { dg-final { scan-tree-dump "vara.*MAX_EXPR" "phiopt1"} } */ +/* { dg-final { cleanup-tree-dump "phiopt1" } } */
phi-opt-5.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: tailrecursion-4.c =================================================================== --- tailrecursion-4.c (nonexistent) +++ tailrecursion-4.c (revision 816) @@ -0,0 +1,18 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -foptimize-sibling-calls -fdump-tree-tailr-details" } */ +int +t(int a) +{ + int r; + if (a&1) + r = t(a-1); + else if (a) + r = t(a-2); + else + return 0; + if (r) + r=r; + return r; +} +/* { dg-final { scan-tree-dump-times "Eliminated tail recursion" 2 "tailr"} } */ +/* { dg-final { cleanup-tree-dump "tailr" } } */
tailrecursion-4.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pr21574.c =================================================================== --- pr21574.c (nonexistent) +++ pr21574.c (revision 816) @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fno-tree-dominator-opts -fdump-tree-store_ccp" } */ + +int +foo (int *p) +{ + *p = 0; + return *p; +} + +/* The store to *p should be propagated to the return statement. */ +/* { dg-final { scan-tree-dump-times "return 0" 1 "store_ccp" } } */ +/* { dg-final { cleanup-tree-dump "store_ccp" } } */
pr21574.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pr25734.c =================================================================== --- pr25734.c (nonexistent) +++ pr25734.c (revision 816) @@ -0,0 +1,34 @@ +/* { dg-do compile } */ +/* { dg-options "-Os" } */ + +struct list_head { + struct list_head *next; +}; +static inline __attribute__((always_inline)) void list_del_init(struct +list_head *entry) +{ + __list_del(entry->next); + (entry)->next = (entry); +}; +struct dentry { + void *d_fsdata; +}; +struct sysfs_dirent { + struct list_head s_sibling; + struct list_head s_children; +}; +const char *sysfs_get_name(struct sysfs_dirent *); +void sysfs_hash_and_remove(struct dentry * dir, const char * name) +{ + struct sysfs_dirent * sd; + struct sysfs_dirent * parent_sd = dir->d_fsdata; + for (sd = (struct sysfs_dirent *)((&parent_sd->s_children)->next); + &sd->s_sibling != (&parent_sd->s_children); + sd = (struct sysfs_dirent *)sd->s_sibling.next) { + if (!__builtin_strcmp(sysfs_get_name(sd), name)) + { + list_del_init(&sd->s_sibling); + break; + } + } +}
pr25734.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20040210-1.c =================================================================== --- 20040210-1.c (nonexistent) +++ 20040210-1.c (revision 816) @@ -0,0 +1,33 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-phiopt1-details" } */ + + +void abort(void); +void exit(int); + +int x, y; + +static void __attribute__ ((noinline)) +init_xy(void) +{ + x = 3; + y = 2; +} + +void +test4(void) +{ + init_xy(); + if ((x < y ? x++ : y++) != 2) + abort (); +} + +int +main(){ + test4 (); + exit (0); +} + +/* Should have no more than two ifs left after straightening. */ +/* { dg-final { scan-tree-dump-times "if " 2 "phiopt1"} } */ +/* { dg-final { cleanup-tree-dump "phiopt1" } } */
20040210-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: alias-1.c =================================================================== --- alias-1.c (nonexistent) +++ alias-1.c (revision 816) @@ -0,0 +1,17 @@ +/* { dg-options "-O2 -fargument-noalias-global -fdump-tree-optimized" } */ +int f; +void link_error (); + +void g(int *i) +{ + *i = 0; + f = 1; + if (*i != 0) + link_error (); +} + + +/* We should have removed the link_error on the tree level as we told GCC + that *i cannot point to f via the option -fargument-noalias-global. */ +/* { dg-final { scan-tree-dump-times "link_error" 0 "optimized"} } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */
alias-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20031022-1.c =================================================================== --- 20031022-1.c (nonexistent) +++ 20031022-1.c (revision 816) @@ -0,0 +1,28 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-dom1" } */ + +typedef struct edge_def +{ + int z; +} *edge; +typedef struct basic_block_def +{ + edge pred; +} *basic_block; +extern struct basic_block_def entry_exit_blocks[2]; +void +blah (int arf) +{ + edge e; + e = (&entry_exit_blocks[1])->pred; + for ( ; ;) + if (arf) + break; + commit_edge_insertions (); + e = (&entry_exit_blocks[1])->pred; + foo (e); +} + +/* There should be one load from entry_exit_blocks[1].pred. */ +/* { dg-final { scan-tree-dump-times "entry_exit_blocks.1..pred" 1 "dom1"} } */ +/* { dg-final { cleanup-tree-dump "dom1" } } */
20031022-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: loop-20.c =================================================================== --- loop-20.c (nonexistent) +++ loop-20.c (revision 816) @@ -0,0 +1,23 @@ +/* PR tree-optimization/29516 */ + +/* { dg-do compile { target fpic } } */ +/* { dg-options "-O -ftree-vrp -fPIC -fdump-tree-ivopts" } */ + +typedef struct gfc_se { int pre; } gfc_se; +typedef struct gfc_ss_info { int dim[7]; } gfc_ss_info; +int gfc_rank_cst[7 + 1]; +gfc_conv_array_transpose (gfc_se * se) { + int dest, src, dest_index, src_index; + gfc_ss_info *dest_info; + int n; + for (n = 0; n < 2; n++) { + dest_info->dim[n] = n; + src_index = gfc_rank_cst[1 - n]; + a (se->pre, b (dest, dest_index), c (src, src_index)); + } +} + +/* Ivopts should not produce multiplication by a pointer constant. */ + +/* { dg-final { scan-tree-dump-times "\\* \[0-9\]*B;" 0 "ivopts" } } */ +/* { dg-final { cleanup-tree-dump "ivopts" } } */
loop-20.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20030730-1.c =================================================================== --- 20030730-1.c (nonexistent) +++ 20030730-1.c (revision 816) @@ -0,0 +1,24 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-dom3" } */ + +extern void exit (int); +extern void *ggc_alloc (__SIZE_TYPE__); +typedef struct dw_attr_struct *dw_attr_ref; +typedef struct dw_attr_struct +{ + int dw_attr; +} +dw_attr_node; +void +foo (int attr_kind, unsigned long offset) +{ + dw_attr_ref attr = (dw_attr_ref) ggc_alloc (sizeof (dw_attr_node)); + attr->dw_attr = attr_kind; + if (attr != 0) + exit (0); +} + +/* There should be no IF conditionals. */ +/* { dg-final { scan-tree-dump-times "if " 0 "dom3" } } */ + +/* { dg-final { cleanup-tree-dump "dom3" } } */
20030730-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20031106-3.c =================================================================== --- 20031106-3.c (nonexistent) +++ 20031106-3.c (revision 816) @@ -0,0 +1,22 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-optimized" } */ + +extern void link_error (void); + +/* Check for cprop on array elements. */ + +void foo (int testarray[]) +{ + testarray[0] = 0; + testarray[1] = 1; + testarray[0]++; + testarray[1]++; + if (testarray[0] != 1) + link_error (); + if (testarray[1] != 2) + link_error (); +} + +/* There should be no link_error calls. */ +/* { dg-final { scan-tree-dump-times "link_error" 0 "optimized" { xfail *-*-* } } } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */
20031106-3.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20040513-2.c =================================================================== --- 20040513-2.c (nonexistent) +++ 20040513-2.c (revision 816) @@ -0,0 +1,25 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-dom2" } */ +int link_error(void); +int s(void); + +int t(int i) +{ + _Bool g = i == 4; + int h = g; + _Bool j = h; + int k = j; + _Bool l = k == 0; + _Bool o = !l; + int m = o; + + if (m) + if (i != 4) + return link_error(); + return 0; +} + +/* There should be no link_error calls, if there is any, the + optimization has failed */ +/* { dg-final { scan-tree-dump-times "link_error" 0 "dom2"} } */ +/* { dg-final { cleanup-tree-dump "dom2" } } */
20040513-2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ssa-fre-1.c =================================================================== --- ssa-fre-1.c (nonexistent) +++ ssa-fre-1.c (revision 816) @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-options "-O -fdump-tree-fre-details" } */ + +/* From PR27090. */ + +int f(int *a) +{ + int t = *a; + unsigned *b = (unsigned *)a; + int *c = (int*)b; + return *c + t; +} + +/* { dg-final { scan-tree-dump "Replaced \\\(int \\\*\\\) b_.*with a_" "fre" } } */ +/* { dg-final { scan-tree-dump "Replaced \\\*c_.*with t_" "fre" } } */ +/* { dg-final { cleanup-tree-dump "fre" } } */
ssa-fre-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: alias-9.c =================================================================== --- alias-9.c (nonexistent) +++ alias-9.c (revision 816) @@ -0,0 +1,15 @@ +/* { dg-do run } */ +/* { dg-options "-O2" } */ + +void abort(void); +int main() +{ + int a[32]; + int i = 1; + a[0] = 1; + a[1] = 2; + if (*(a + i) != 2) + abort(); + return 0; +} +
alias-9.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20030815-1.c =================================================================== --- 20030815-1.c (nonexistent) +++ 20030815-1.c (revision 816) @@ -0,0 +1,43 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-dom3" } */ + +extern void abort (void); +typedef unsigned int size_t; +struct rtx_def; +typedef struct rtx_def *rtx; +typedef union varray_data_tag +{ + struct reg_info_def *reg[1]; +} varray_data; +struct varray_head_tag +{ + size_t num_elements; + varray_data data; +}; +typedef struct varray_head_tag *varray_type; +typedef struct reg_info_def +{ +} reg_info; +extern varray_type reg_n_info; +static rtx *reg_base_value; +static rtx *new_reg_base_value; + +rtx +blah (unsigned int regno) +{ + if (new_reg_base_value[regno] && ((*( + { + if (regno >= + reg_n_info-> + num_elements) + abort (); + ®_n_info->data.reg[regno];} + )))) + return reg_base_value[regno]; +} + +/* If we have more than 1 cast to a struct rtx_def * *, then we failed to + eliminate some useless typecasting. The first type cast is needed + to convert the unsigned int regno parameter into a struct rtx_def **. */ +/* { dg-final { scan-tree-dump-times "\\(struct rtx_def \\* \\*\\)" 1 "dom3"} } */ +/* { dg-final { cleanup-tree-dump "dom3" } } */
20030815-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20030814-3.c =================================================================== --- 20030814-3.c (nonexistent) +++ 20030814-3.c (revision 816) @@ -0,0 +1,23 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-dom3" } */ + +extern void abort (void); + +void +foo (int value) +{ + switch (value) + { + case 40: + case 42: + if (value != 42) + abort (); + case 50: + blah (); + } +} + +/* There should be one IF conditional. */ +/* { dg-final { scan-tree-dump-times "if " 1 "dom3"} } */ + +/* { dg-final { cleanup-tree-dump "dom3" } } */
20030814-3.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20030917-2.c =================================================================== --- 20030917-2.c (nonexistent) +++ 20030917-2.c (revision 816) @@ -0,0 +1,40 @@ +/* This test was causing an ICE in DCE because we were allowing void * + pointers to have a memory tag, which we were copying when doing copy + propagation. Since void * can never be de-referenced, its memory tag + was never renamed. */ + +/* { dg-do compile } */ +/* { dg-options "-O -ftree-dominator-opts" } */ + +typedef __SIZE_TYPE__ size_t; +typedef union tree_node *tree; +struct operands_d +{ + tree *def_op; +}; + +void +gt_ggc_mx_operands_d (void *x_p) +{ + struct operands_d *const x = (struct operands_d *) x_p; + if ((*x).def_op != ((void *) 0)) + { + size_t i0; + do + { + const void *const a__ = ((*x).def_op); + if (a__ != ((void *) 0) && a__ != (void *) 1) + ggc_set_mark (a__); + } + while (0); + for (i0 = 0; i0 < (size_t) (1); i0++) + { + do + { + if ((void *) (*x).def_op[i0] != ((void *) 0)) + gt_ggc_mx_lang_tree_node ((*x).def_op[i0]); + } + while (0); + } + } +}
20030917-2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pr21001.c =================================================================== --- pr21001.c (nonexistent) +++ pr21001.c (revision 816) @@ -0,0 +1,21 @@ +/* PR tree-optimization/21001 + VRP did not insert ASSERT_EXPRs when the variable tested in a + COND_EXPR is a single-use variable. By propagating the definition + of the single-use variable into the COND_EXPR, we can get useful + range infomation out of the conditional. */ + +/* { dg-do compile } */ +/* { dg-options "-O2 -fno-tree-dominator-opts -fdump-tree-vrp1-details" } */ + +int +foo (int a) +{ + int b = a != 0; + if (b) + if (a != 0) + return 1; + return 0; +} + +/* { dg-final { scan-tree-dump-times "Folding predicate" 1 "vrp1"} } */ +/* { dg-final { cleanup-tree-dump "vrp1" } } */
pr21001.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: vrp02.c =================================================================== --- vrp02.c (nonexistent) +++ vrp02.c (revision 816) @@ -0,0 +1,24 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-vrp1" } */ + +struct A +{ + int a; + int b; +}; + +foo (struct A *p, struct A *q) +{ + int x = p->a; + if (p == q) + return q->a; + + /* We should fold this to 'if (1)' but the assertion for 'p == q' + was overwriting the assertion 'p != 0' from the first dereference + of 'p'. */ + if (p) + return x + p->b; +} + +/* { dg-final { scan-tree-dump-times "Folding predicate p_.*to 1" 1 "vrp1" } } */ +/* { dg-final { cleanup-tree-dump "vrp1" } } */
vrp02.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ssa-dom-cse-1.c =================================================================== --- ssa-dom-cse-1.c (nonexistent) +++ ssa-dom-cse-1.c (revision 816) @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-fre-details" } */ +int t(int a) __attribute__ ((const)); +void q (void); +void +threading(int a,int b) +{ + if (t(a)) + { + if (t(a)) + q(); + } +} +/* We should thread the jump twice and eliminate it. */ +/* { dg-final { scan-tree-dump-times "Replaced.* t " 1 "fre"} } */ +/* { dg-final { cleanup-tree-dump "fre" } } */
ssa-dom-cse-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ssa-pre-3.c =================================================================== --- ssa-pre-3.c (nonexistent) +++ ssa-pre-3.c (revision 816) @@ -0,0 +1,15 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-pre-stats" } */ +unsigned foo1 (unsigned a, unsigned b) +{ + unsigned i, j, k; + for (i = 0; i != a; i++) + { + j += 4*b; + k += 4*a; + } + return j + k; +} +/* We should eliminate both 4*b and 4*a from the main body of the loop */ +/* { dg-final { scan-tree-dump-times "Eliminated: 2" 1 "pre"} } */ +/* { dg-final { cleanup-tree-dump "pre" } } */
ssa-pre-3.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: inline_asm-1.c =================================================================== --- inline_asm-1.c (nonexistent) +++ inline_asm-1.c (revision 816) @@ -0,0 +1,20 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-optimized -fdump-tree-alias1-vops" } */ +/* Test to make sure that inline-asm causes a V_MAY_DEF and that we call test_function twice. */ + +char test_function(void ) __attribute__((__pure__)); +char f(char *a) +{ + char b = test_function(); + asm("":"=m"(*a):"r"(b)); + b = test_function(); + return b; +} + +/* test_function should be called twice as the inline-asm changes memory. */ +/* { dg-final { scan-tree-dump-times "test_function" 2 "optimized"} } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */ + +/* There should a V_MAY_DEF for the inline-asm. */ +/* { dg-final { scan-tree-dump-times "V_MAY_DEF" 1 "alias1"} } */ +/* { dg-final { cleanup-tree-dump "alias1" } } */
inline_asm-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pr18133-2.c =================================================================== --- pr18133-2.c (nonexistent) +++ pr18133-2.c (revision 816) @@ -0,0 +1,43 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-optimized-blocks" } */ + +int c, d; + +int +bar (int a) +{ + void *p; + int b; + + if (a!=0) + { + b = 3; + p = &&L0; + } + else + { + b = 5; + p = &&L1; + } + + goto *p; + + L0: + c = b; + return 1; + + L1: + d = b; + return 0; +} + +/* The both paths to the block containing the goto *p should + have been threaded, thus eliminating the need for the goto *p. */ + +/* { dg-final { scan-tree-dump-times "goto p" 0 "optimized" } } */ + +/* There should not be any abnormal edges as DOM removed the + computed goto. */ + +/* { dg-final { scan-tree-dump-times "ab" 0 "optimized" } } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */
pr18133-2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pr22236.c =================================================================== --- pr22236.c (nonexistent) +++ pr22236.c (revision 816) @@ -0,0 +1,33 @@ +/* { dg-do run } */ +/* { dg-options "-O1 -fno-tree-vrp -fwrapv" } */ + +/* PR tree-optimization/22236 + + Avoid conversion of (signed char) {(uchar)1, +, (uchar)1}_x when + it is not possible to prove that the scev does not wrap. + + In this PR, a sequence 1, 2, ..., 255 has to be converted to + signed char, but this would wrap: 1, 2, ..., 127, -128, ... The + result should not be a linear scev {(schar)1, +, (schar)1}_x. + The conversion should be kept: (schar) {(uchar)1, +, (uchar)1}_x. + */ + +void abort(void); + +static inline void +foo (signed char a) +{ + int b = a - 0x7F; + if (b > 1) + abort(); +} + +int main() +{ + unsigned char b; + for(b = 0; b < 0xFF; b++) + foo (b); + + return 0; +} +
pr22236.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: vrp27.c =================================================================== --- vrp27.c (nonexistent) +++ vrp27.c (revision 816) @@ -0,0 +1,33 @@ +/* PR middle-end/26361. */ +/* { dg-do run } */ +/* { dg-options "-O2" } */ + +void abort(void); + +__attribute__((noinline)) +void gen_rtx_CONST_INT(long long x) { + if (-x > 10) + abort(); +} +__attribute__((noinline)) +int alpha_expand_prologue(long frame_size) +{ + unsigned long long a; + int probed; + if (frame_size <= 1) return; + unsigned long long b = -2; + a = -2; + do { + int a1 = a; + probed = -a1; + gen_rtx_CONST_INT (a1); + a -= 2; + a1 = -a; + probed = a1; + } while (probed < frame_size); +} + +int main(void) { + alpha_expand_prologue(10); + return 0; +}
vrp27.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pr18134.c =================================================================== --- pr18134.c (nonexistent) +++ pr18134.c (revision 816) @@ -0,0 +1,26 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-optimized" } */ + +int foo (int a) +{ +void *p; +if (a!=0) + p = &&L0; +else + p = &&L1; +goto *p; +L0: +return 1; +L1: +return 0; +} + +/* Everything should have been cleaned up leaving a simple + return statement. */ +/* { dg-final { scan-tree-dump-times "return.*a != 0" 1 "optimized" } } */ + +/* There should not be any abnormal edges as DOM removed the + computed gotos. */ + +/* { dg-final { scan-tree-dump-times "ab" 0 "optimized" } } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */
pr18134.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pr23382.c =================================================================== --- pr23382.c (nonexistent) +++ pr23382.c (revision 816) @@ -0,0 +1,25 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-alias-vops" } */ +struct a +{ + int length; + int a1[256]; +}; + +void *malloc(__SIZE_TYPE__ size) __attribute__((malloc)); + +void f(void) +{ + struct a *a = malloc(sizeof(struct a)); +} +/* { dg-final { scan-tree-dump-times "V_MAY_DEF
pr23382.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pr20739.c =================================================================== --- pr20739.c (nonexistent) +++ pr20739.c (revision 816) @@ -0,0 +1,24 @@ +/* PR middle-end/20739 */ + +/* dg-do compile */ +/* dg-options "-O" */ + +/* We used to fail to compile this because gimplification dropped the + conversion that added the const qualifier to the sub-expression + involving baz, and then immediately noticed and reported its + absence. */ + +typedef struct +{ + char chars[5]; +} +baz_t; + +extern baz_t * baz; + +extern void foo (baz_t); +int +bar (const baz_t * ls) +{ + foo (ls == 0 ? *(&baz[0]) : *ls); +}
pr20739.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20041110-1.c =================================================================== --- 20041110-1.c (nonexistent) +++ 20041110-1.c (revision 816) @@ -0,0 +1,26 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -ftree-loop-linear" } */ + +/* This testcase was causing an ICE in building distance vectors because + we weren't ignoring the fact that one of the induction variables + involved in the dependence was outside of the loop. */ +extern int foo (int, int); +int +main (void) +{ + int a[50]; + int b[50]; + int i, j, k; + for (i = 4; i < 30; i++) + { + for (j = 3; j < 40; j++) + { + for (k = 9; k < 50; k++) + { + b[j] = a[i]; + a[k] = b[i]; + } + } + } + foo (a[i], b[i]); +}
20041110-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20031031-1.c =================================================================== --- 20031031-1.c (nonexistent) +++ 20031031-1.c (revision 816) @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-options "-O1" } */ + +/* This program requires the SSA renamer to be run after the second DOM + pass. Test provided by Falk Hueffner as Bugzilla #12825. */ + +struct floppy_raw_cmd { + int flags, track; +} *raw_cmd, default_raw_cmd; + +void +setup_format_params (void) +{ + raw_cmd = &default_raw_cmd; + raw_cmd->track = 0; + raw_cmd->flags = 0; +}
20031031-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: loadpre11.c =================================================================== --- loadpre11.c (nonexistent) +++ loadpre11.c (revision 816) @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-pre-stats" } */ +int *t; +int g(int); +int f(int tt) +{ + int *t1 = t; + if (*t1) + *t1 = 2; + return g(*t1); +} +/* { dg-final { scan-tree-dump-times "Eliminated: 1" 1 "pre"} } */ +/* { dg-final { cleanup-tree-dump "pre" } } */ +
loadpre11.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ssa-ccp-2.c =================================================================== --- ssa-ccp-2.c (nonexistent) +++ ssa-ccp-2.c (revision 816) @@ -0,0 +1,172 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-optimized" } */ + +extern void link_error (void); + + +/* check that cprop for variables of different types still works even + if function calls or assignments to different types of data are + interposed. */ + +int test7 (int *intarr) +{ + extern int foo7 (int); + int u = 7, v1; + foo7 (u); + v1 = u; + if (v1 != 7) + link_error (); + return v1; +} + +int test77 (int *arr) +{ + int u = 7, v1; + arr[0] = 4; + v1 = u; + if (v1 != 7) + link_error (); + return v1 + arr[0]; +} + +int test777 (void) +{ + extern int foo(int *); + int u = 7, v1; + static int sarr[10]; + sarr[0] = 4; + v1 = u; + if (v1 != 7) + link_error (); + foo (sarr); + return v1 + sarr[0]; +} + +int garr[10]; +int test7777 (void) +{ + int u = 7, v1; + garr[0] = 4; + v1 = u; + if (v1 != 7) + link_error (); + return v1 + garr[0]; +} + +int test88 (int *arr) +{ + static int l; + int v1; + l = 8; + arr[0] = 4; + v1 = l; + if (v1 != 8) + link_error (); + l = foo88 (l); + return v1 + arr[0]; +} + +int test888 (void) +{ + static int l; + extern int foo(int *); + int v1; + static int sarr[10]; + l = 8; + sarr[0] = 4; + v1 = l; + if (v1 != 8) + link_error (); + foo (sarr); + l = foo88(l); + return v1 + sarr[0]; +} + +int test8888 (void) +{ + static int l; + int v1; + l = 8; + garr[0] = 4; + v1 = l; + if (v1 != 8) + link_error (); + return v1 + garr[0]; +} + + + +/* global var */ +int g9; +int garr9[10]; +int test9 (int *intarr) +{ + extern int foo9 (int) __attribute__ ((const)); + int h, v; + g9 = 9; + h = foo9 (g9); + v = g9; + if (v != 9) + link_error (); + return g9; +} + +int test99 (int *intarr) +{ + extern int foo9 (int) __attribute__ ((pure)); + int h, v; + g9 = 9; + h = foo9 (g9); + v = g9; + if (v != 9) + link_error (); + return g9; +} + +extern int foo99 (int); + +int test999 (int *arr) +{ + static int l; + int v1; + g9 = 9; + l = 4; + v1 = g9; + if (v1 != 9) + link_error (); + l = foo99 (l); + return v1 + l; +} + + +int test9999 (void) +{ + int v1; + static int sarr[10]; + g9 = 9; + sarr[0] = 4; + v1 = g9; + if (v1 != 9) + link_error (); + foo (sarr); + g9 = foo99 (g9); + return v1 + sarr[0]; +} + + +int test99999 (void) +{ + int v1; + g9 = 9; + garr9[0] = 4; + v1 = g9; + if (v1 != 9) + link_error (); + return v1 + garr9[0]; +} + + +/* There should be not link_error calls, if there is any the + optimization has failed */ +/* { dg-final { scan-tree-dump-times "link_error" 0 "optimized"} } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */
ssa-ccp-2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: bool-3.c =================================================================== --- bool-3.c (nonexistent) +++ bool-3.c (revision 816) @@ -0,0 +1,18 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-optimized" } */ + +int f(_Bool x) +{ + int y; + if (!x) + y = 0; + else + y = 1; + return y; +} + +/* There should be no == 0. Though PHI-OPT or invert_truth does not + fold its tree. */ +/* { dg-final { scan-tree-dump-times "== 0" 0 "optimized" { xfail *-*-* } } } */ + +/* { dg-final { cleanup-tree-dump "optimized" } } */
bool-3.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20030820-1.c =================================================================== --- 20030820-1.c (nonexistent) +++ 20030820-1.c (revision 816) @@ -0,0 +1,24 @@ +/* { dg-do compile } */ +/* { dg-options "-O1" } */ + +/* A test for unreachable blocks removal -- bind_expr whose entry is + unreachable, but it contains reachable statements. */ + +void foo(void) +{ + if (1) + { + goto bla; + } + else + { +xxx: + { +bla: + bar (); + return; + } + goto xxx; + } +} +
20030820-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: loadpre19.c =================================================================== --- loadpre19.c (nonexistent) +++ loadpre19.c (revision 816) @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-pre-stats" } */ +typedef int type[2]; +int main(type *a, int argc) +{ + int d, e; + + /* Should be able to eliminate the second load of *a along the main path. */ + d = (*a)[argc]; + if (!d) + argc++; + e = (*a)[argc]; + return e; +} +/* { dg-final { scan-tree-dump-times "Eliminated: 1" 1 "pre" } } */ +/* { dg-final { cleanup-tree-dump "pre" } } */
loadpre19.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20030922-2.c =================================================================== --- 20030922-2.c (nonexistent) +++ 20030922-2.c (revision 816) @@ -0,0 +1,24 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-dom1" } */ + +struct rtx_def; +typedef struct rtx_def *rtx; +struct rtx_def +{ + int bb; +}; +static int *block_to_bb; +static int target_bb; + +int +rgn_rank (rtx insn1, rtx insn2) +{ + if (block_to_bb[insn1->bb] != block_to_bb[insn2->bb]) + if (block_to_bb[insn2->bb] == target_bb + && block_to_bb[insn1->bb] != target_bb) + return 1; +} + +/* There should be two IF conditionals. */ +/* { dg-final { scan-tree-dump-times "if " 2 "dom1" } } */ +/* { dg-final { cleanup-tree-dump "dom1" } } */
20030922-2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20030824-1.c =================================================================== --- 20030824-1.c (nonexistent) +++ 20030824-1.c (revision 816) @@ -0,0 +1,23 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-optimized" } */ + +struct A +{ + int a,b; +}; + +int foo (int x, int y) +{ + int i, j; + struct A a,b; + + a.a = x; + b.b = y; + j = a.a; + i = b.b; + return i + j; +} + +/* The addition should be optimized into 'y+x'. */ +/* { dg-final { scan-tree-dump-times "\[xy\] \\+ \[xy]" 1 "optimized"} } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */
20030824-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: reassoc-4.c =================================================================== --- reassoc-4.c (nonexistent) +++ reassoc-4.c (revision 816) @@ -0,0 +1,18 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-optimized -ffast-math" } */ +float a, b, c, d; +extern int printf (const char *, ...); +int main(void) +{ + float e; + float f; + /* We should not be able to transform these into the same expression, and only have two additions. */ + e = a + b; + e = e + c; + f = c + a; + f = f + b; + printf ("%f %f\n", e, f); +} + +/* { dg-final { scan-tree-dump-times "\\\+" 2 "optimized"} } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */
reassoc-4.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20030708-1.c =================================================================== --- 20030708-1.c (nonexistent) +++ 20030708-1.c (revision 816) @@ -0,0 +1,43 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-dom3" } */ +extern void abort (void); +struct rtx_def; +typedef struct rtx_def *rtx; +enum rtx_code +{ + CALL_INSN, + EXPR_LIST, + NOTE, + LAST = 256 +}; + +struct rtx_def +{ + + enum rtx_code code:16; +}; + +int +nonlocal_mentioned_p (x) + rtx x; +{ + if (x->code == CALL_INSN) + { + rtx const _rtx = ((x)); + if (_rtx->code != CALL_INSN + && _rtx->code != NOTE + && _rtx->code != EXPR_LIST) + abort (); + } + + blah (&x); +} + +/* There should be no casts to a short unsigned int since the entire + set of conditionals should optimize away. */ +/* { dg-final { scan-tree-dump-times "\\(short unsigned int\\)" 0 "dom3"} } */ + +/* There should be no IF conditionals. */ +/* { dg-final { scan-tree-dump-times "if " 0 "dom3"} } */ + +/* { dg-final { cleanup-tree-dump "dom3" } } */
20030708-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: recip-2.c =================================================================== --- recip-2.c (nonexistent) +++ recip-2.c (revision 816) @@ -0,0 +1,28 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -funsafe-math-optimizations -fdump-tree-recip" } */ + +float e(float a, float b, float c, float d, float e, float f) +{ + if (a < b) + { + a = a + b; + c = c + d; + } + + /* The PHI nodes for these divisions should be combined. */ + d = d / a; + e = e / a; + f = f / a; + + a = a / c; + b = b / c; + + /* This should not be left as a multiplication. */ + c = 1 / c; + + return a + b + c + d + e + f; +} + +/* { dg-final { scan-tree-dump-times " / " 2 "recip" } } */ +/* { dg-final { scan-tree-dump-times " \\* " 5 "recip" } } */ +/* { dg-final { cleanup-tree-dump "recip" } } */
recip-2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ssa-dse-5.c =================================================================== --- ssa-dse-5.c (nonexistent) +++ ssa-dse-5.c (revision 816) @@ -0,0 +1,33 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-optimized" } */ + +int x; + +int +f1 (int i, int j, int k) +{ + int *p = k ? &i : &j; + i = 3; + *p = 5; + x = j; +} + +/* The assignment "i = 3" is partialy dead. Our DSE pass doesn't handle + detection of partially dead assignments. + + There's two outputs which would indicate that the optimization was + performed. + + If we used block copying to detect and eliminate the partially dead + store, then we should see an assignment "i = 5" somewhere in the + dump file. + + Another approach would be to redirect the path from the true arm + of the first conditional so that it reaches the statement *p = 5 + rather than i = 3. */ + +/* { dg-final { scan-tree-dump-times "i = 5" 1 "optimized" { xfail *-*-* }} } */ +/* { dg-final { scan-tree-dump-times ":;\[\n\t \]*\\*p = 5" 1 "optimized" { xfail *-*-*}} } */ + +/* { dg-final { cleanup-tree-dump "optimized" } } */ +
ssa-dse-5.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ltrans-8.c =================================================================== --- ltrans-8.c (nonexistent) +++ ltrans-8.c (revision 816) @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -ftree-loop-linear -fdump-tree-ltrans-all" } */ +double foo(double *a) +{ + int i,j; + double r = 0.0; + for (i=0; i<8; ++i) + for (j=0; j<8; ++j) + r += a[j*8+i]; + return r; +} + +/* { dg-final { scan-tree-dump-times "transformed loop" 1 "ltrans"} } */ +/* { dg-final { cleanup-tree-dump "ltrans" } } */
ltrans-8.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20030807-8.c =================================================================== --- 20030807-8.c (nonexistent) +++ 20030807-8.c (revision 816) @@ -0,0 +1,55 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-dom3" } */ + +struct die_struct; +typedef struct die_struct *dw_die_ref; +typedef struct dw_loc_list_struct *dw_loc_list_ref; +enum dw_val_class +{ + dw_val_class_loc_list, +}; +typedef struct dw_val_struct +{ + enum dw_val_class val_class; + union dw_val_struct_union + { + dw_loc_list_ref val_loc_list; + } + v; +} +dw_val_node; +typedef struct dw_attr_struct *dw_attr_ref; +typedef struct dw_attr_struct +{ + dw_val_node dw_attr_val; +} +dw_attr_node; + +extern __inline__ enum dw_val_class +AT_class (a) + dw_attr_ref a; +{ + return a->dw_attr_val.val_class; +} + +extern __inline__ dw_loc_list_ref +AT_loc_list (a) + dw_attr_ref a; +{ + if (AT_class (a) == dw_val_class_loc_list) + return a->dw_attr_val.v.val_loc_list; +} + +void +output_location_lists (die) + dw_die_ref die; +{ + dw_die_ref c; + dw_attr_ref d_attr; + if (AT_class (d_attr) == dw_val_class_loc_list) + output_loc_list (AT_loc_list (d_attr)); +} + +/* There should be exactly one IF conditional, in output_location_lists. */ +/* { dg-final { scan-tree-dump-times "if " 1 "dom3"} } */ +/* { dg-final { cleanup-tree-dump "dom3" } } */
20030807-8.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: vrp11.c =================================================================== --- vrp11.c (nonexistent) +++ vrp11.c (revision 816) @@ -0,0 +1,20 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-vrp1" } */ + +foo (int k, int j, int z) +{ + if (k > z) + { + if (j > k) + { + /* We should fold this to if (1). */ + if (j > z) + return j; + } + } + + return j; +} + +/* { dg-final { scan-tree-dump-times "Folding predicate.*to 1" 1 "vrp1" } } */ +/* { dg-final { cleanup-tree-dump "vrp1" } } */
vrp11.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: loadpre7.c =================================================================== --- loadpre7.c (nonexistent) +++ loadpre7.c (revision 816) @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-pre-stats" } */ +/* We can't eliminate the *p load here in any sane way, as eshup8 may + change it. */ +void +enormlz (x) + unsigned short x[]; +{ + register unsigned short *p; + p = &x[2]; + while ((*p & 0xff00) == 0) + { + eshup8 (x); + } +} +/* { dg-final { scan-tree-dump-times "Eliminated: 0" 1 "pre"} } */ +/* { dg-final { cleanup-tree-dump "pre" } } */
loadpre7.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pr14341.c =================================================================== --- pr14341.c (nonexistent) +++ pr14341.c (revision 816) @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-vrp1" } */ +/* { dg-require-effective-target int32plus } */ + +void fn_call (int); +int h(int, int); +void t() +{ + int i; + int x; + for( i = 0; i < 100000000; i++ ){ + fn_call (i < 100000000); + } +} + +/* { dg-final { scan-tree-dump-times "fn_call \\(1\\)" 1 "vrp1" } } */ +/* { dg-final { cleanup-tree-dump "vrp1" } } */
pr14341.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: loop-8.c =================================================================== --- loop-8.c (nonexistent) +++ loop-8.c (revision 816) @@ -0,0 +1,25 @@ +/* A test for strength reduction of ivs with nonconstant step. */ + +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-optimized" } */ + +int bar (void); + +int a[100]; + +void xxx (void) +{ + int iter, step = bar (); + + for (iter = 0; iter < 10; iter++) + a[iter * step] = bar (); +} + +/* The array access should be strength reduced. But to determine the value of + the step, we need to calculate step * sizeof (int), thus we need to be + a bit careful about which multiplications we disallow. */ + +/* { dg-final { scan-tree-dump-times "step \\* \[^0-9\]" 0 "optimized" } } */ +/* { dg-final { scan-tree-dump-times "\[^0-9\] \\* step" 0 "optimized" } } */ + +/* { dg-final { cleanup-tree-dump "optimized" } } */
loop-8.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: asm-2.c =================================================================== --- asm-2.c (nonexistent) +++ asm-2.c (revision 816) @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-optimized" } */ + +#ifdef __hppa__ +#define REGISTER "1" +#else +#define REGISTER "0" +#endif + +void baz(void) +{ + register int xyzzy asm(REGISTER) = 1; + asm volatile ("" : : "r"(xyzzy)); +} + +/* { dg-final { scan-tree-dump-times "asm\[^\\r\\n\]*xyzzy" 1 "optimized" } } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */
asm-2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pr23234.c =================================================================== --- pr23234.c (nonexistent) +++ pr23234.c (revision 816) @@ -0,0 +1,58 @@ +/* The problem in this PR was mostly finding a suitable place to insert + the reciprocals of the function arguments. This test case tries to + test three possible ways of how this may go wrong. */ +/* { dg-options "-O2 -ffast-math" } */ +/* { dg-do compile } */ + +/* The original test case. */ +double +f1 (double a, double b, double c) +{ + double y0; + double y1; + + if (a == 0.0) + { + y0 = -c / b; + return y0; + } + y0 = c / b; + y1 = a / b; + return y0 * y1; +} + +/* Labels may end up in the middle of a block. Also bad. */ +double +f2 (double a, double b, double c) +{ + double y0; + double y1; + +a_label: +another_label: + if (a == 0.0) + { + y0 = -c / b; + return y0; + } + y0 = c / b; + y1 = a / b; + return y0 * y1; +} + +/* Uses must still be dominated by their defs. */ +double +f3 (double a, double b, double c) +{ + double y0; + double y1; + + y0 = -c / b; + if (a == 0.0) + { + return y0; + } + y0 = c / b; + y1 = a / b; + return y0 * y1; +}
pr23234.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: vrp19.c =================================================================== --- vrp19.c (nonexistent) +++ vrp19.c (revision 816) @@ -0,0 +1,27 @@ +/* { dg-do compile } */ +/* { dg-options "-fwrapv -O1 -ftree-vrp -fdump-tree-vrp1" } */ + +#include +extern void abort (); +extern void exit (int); + +int f (int a) { + if (a != INT_MIN) { + a = a > 0 ? a : -a; + if (a < 0) + return 1; + } + return 0; +} + +int g (int b) { + if (b != INT_MIN) { + b = b > 0 ? b : -b; + if (b >= 0) + return 0; + } + return 1; +} +/* { dg-final { scan-tree-dump "Folding predicate a_. < 0 to 0" "vrp1" } } */ +/* { dg-final { scan-tree-dump "Folding predicate b_. >= 0 to 1" "vrp1" } } */ +/* { dg-final { cleanup-tree-dump "vrp1" } } */
vrp19.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pr23391.c =================================================================== --- pr23391.c (nonexistent) +++ pr23391.c (revision 816) @@ -0,0 +1,23 @@ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +void +foo (int N) +{ + int C; + double R; + + R = 0.0; + do + { + R += 0.001; + C = (int) (R * N); + if (-R * N <= R * N) + { + C++; + } + } + while (C < 0); + + return; +}
pr23391.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: tailrecursion-5.c =================================================================== --- tailrecursion-5.c (nonexistent) +++ tailrecursion-5.c (revision 816) @@ -0,0 +1,77 @@ +/* { dg-do run } */ +/* { dg-options "-O1 -foptimize-sibling-calls -fdump-tree-optimized" } */ + +extern void abort (void); +extern void exit (int); + +int sum (int n) +{ + if (n == 0) + return 0; + + return n + sum (n - 1); +} + +int fac (int n) +{ + if (n == 0) + return 1; + + return n * fac (n - 1); +} + +int sq_sum (int n) +{ + if (n == 0) + return 0; + + return n * n + sq_sum (n - 1); +} + +int pow2m1 (int n) +{ + if (n == 0) + return 0; + + return 2 * pow2m1 (n - 1) + 1; +} + +int fib (int n) +{ + if (n <= 1) + return 1; + + return fib (n - 2) + fib (n - 1); +} + +int main(void) +{ + if (sum (5) != 15) + abort (); + + if (fac (5) != 120) + abort (); + + if (sq_sum (5) != 55) + abort (); + + if (pow2m1 (5) != 31) + abort (); + + if (fib (5) != 8) + abort (); + + exit (0); +} + +/* There is one call of sum in main and then 2 instances of the word in + ;; Function sum (sum) and one in the function header. */ +/* { dg-final { scan-tree-dump-times "\\msum\\M" 4 "optimized"} } */ +/* { dg-final { scan-tree-dump-times "\\mfac\\M" 4 "optimized"} } */ +/* { dg-final { scan-tree-dump-times "\\msq_sum\\M" 4 "optimized"} } */ +/* { dg-final { scan-tree-dump-times "\\mpow2m1\\M" 4 "optimized"} } */ + +/* There is one recursive call to fib. */ +/* { dg-final { scan-tree-dump-times "\\mfib\\M" 5 "optimized"} } */ + +/* { dg-final { cleanup-tree-dump "optimized" } } */
tailrecursion-5.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: loadpre20.c =================================================================== --- loadpre20.c (nonexistent) +++ loadpre20.c (revision 816) @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-pre-stats" } */ +typedef int type[2]; +int main(type *a, int argc) +{ + int d, e; + + /* Should be able to eliminate the second load of *a along the main path. */ + d = (*a)[argc]; + if (!d) + a++; + e = (*a)[argc]; + return e; +} +/* { dg-final { scan-tree-dump-times "Eliminated: 1" 1 "pre" } } */ +/* { dg-final { cleanup-tree-dump "pre" } } */
loadpre20.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: alias-2.c =================================================================== --- alias-2.c (nonexistent) +++ alias-2.c (revision 816) @@ -0,0 +1,27 @@ +/* { dg-options "-O2 -fdump-tree-optimized" } */ +static int a; +int f; +void bar (void) __attribute__((noinline)); +void bar (void) +{ + f = 9; +} + +void link_error (); + +int foo() +{ + int b, c; + a = 5; + b = a; + bar (); + b = b + a; + if (b != 10) + link_error (); + return b; +} + +/* We should have removed the link_error on the tree level as GCC can tell that + a is not touched by the calling bar at all. */ +/* { dg-final { scan-tree-dump-times "link_error" 0 "optimized"} } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */
alias-2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20040313-1.c =================================================================== --- 20040313-1.c (nonexistent) +++ 20040313-1.c (revision 816) @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-options "-O3" } */ + +/* Test provided by Volker Reichelt in PR 14553. The redundant PHI + node elimination pass was not using the right API functions to + propagate pointers, which resulted in dereferenced pointers that + did not have memory tags associated with them. */ + +void foo(int* p) +{ + int i; + for (i=1; i>0; --i, ++p) + *p=0; +} + +void bar(int* p) { foo(p); }
20040313-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20031106-4.c =================================================================== --- 20031106-4.c (nonexistent) +++ 20031106-4.c (revision 816) @@ -0,0 +1,30 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-optimized" } */ + +extern void link_error (void); + +/* Check for cprop on fields of the same struct. */ + +struct s +{ + char d; + int a, b; + double m; +}; + + +void foo (struct s* r) +{ + r->a = 0; + r->b = 1; + r->a++; + r->b++; + if (r->a != 1) + link_error (); + if (r->b != 2) + link_error (); +} + +/* There should be no link_error calls. */ +/* { dg-final { scan-tree-dump-times "link_error" 0 "optimized" { xfail *-*-* } } } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */
20031106-4.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20030730-2.c =================================================================== --- 20030730-2.c (nonexistent) +++ 20030730-2.c (revision 816) @@ -0,0 +1,24 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-dom3" } */ + +extern void exit (int); +extern void *ggc_alloc (__SIZE_TYPE__); +typedef struct dw_attr_struct *dw_attr_ref; +typedef struct dw_attr_struct +{ + int dw_attr; +} +dw_attr_node; +void +foo (int attr_kind, unsigned long offset) +{ + dw_attr_ref attr = (dw_attr_ref) ggc_alloc (sizeof (dw_attr_node)); + attr->dw_attr = attr_kind; + if (attr != ((void *)0)) + exit (0); +} + +/* There should be no IF conditionals. */ +/* { dg-final { scan-tree-dump-times "if " 0 "dom3" } } */ + +/* { dg-final { cleanup-tree-dump "dom3" } } */
20030730-2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20040514-1.c =================================================================== --- 20040514-1.c (nonexistent) +++ 20040514-1.c (revision 816) @@ -0,0 +1,19 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-phiopt1-details" } */ + +int t( int i) +{ + int j; + if(i ==0) + { + j = 1; + goto end; + } + j = 0; +end: + return j; +} + +/* Should have no ifs left after straightening. */ +/* { dg-final { scan-tree-dump-times "if " 0 "phiopt1"} } */ +/* { dg-final { cleanup-tree-dump "phiopt1" } } */
20040514-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: scev-1.c =================================================================== --- scev-1.c (nonexistent) +++ scev-1.c (revision 816) @@ -0,0 +1,19 @@ +/* PR tree-optimization/19899 */ +/* Decrementing a floating-point variable in a loop caused an ICE. */ + +/* { dg-do run } */ +/* { dg-options "-O -ftree-vectorize" } */ + +extern void abort (void); + +int main() +{ + float i=1; + + while (i>=0) + --i; + + if (i != -1) + abort(); + return 0; +}
scev-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ssa-fre-2.c =================================================================== --- ssa-fre-2.c (nonexistent) +++ ssa-fre-2.c (revision 816) @@ -0,0 +1,18 @@ +/* { dg-do compile } */ +/* { dg-options "-O -fdump-tree-fre-details" } */ + +/* From PR14287. */ + +short g, h; + +void +foo (long a) +{ + short b = a & 3; + long c = b; + g = c; + h = c; +} + +/* { dg-final { scan-tree-dump "Replaced \\\(short int\\\) c_.*with b_" "fre" } } */ +/* { dg-final { cleanup-tree-dump "fre" } } */
ssa-fre-2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20040518-1.c =================================================================== --- 20040518-1.c (nonexistent) +++ 20040518-1.c (revision 816) @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-phiopt1-details" } */ +int f(int a, int b) +{ + int c = b; + if (a != b) + c = a; + return c; +} + +/* Should have no ifs left after straightening. */ +/* { dg-final { scan-tree-dump-times "if " 0 "phiopt1"} } */ +/* { dg-final { cleanup-tree-dump "phiopt1" } } */
20040518-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: andor-1.c =================================================================== --- andor-1.c (nonexistent) +++ andor-1.c (revision 816) @@ -0,0 +1,65 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-original" } */ + +unsigned int test1(unsigned int a) +{ + return (a & 1) | 1; +} + +int test2(int b) +{ + return (b & 1) | 1; +} + +unsigned int test3(unsigned int c) +{ + return (c | 1) & 1; +} + +int test4(int d) +{ + return (d | 1) & 1; +} + +unsigned int test5(unsigned int e) +{ + return (e | 4) & 6; +} + +int test6(int f) +{ + return (f | 4) & 6; +} + +unsigned int test7(unsigned int g) +{ + return (g & -2) | 1; +} + +int test8(int h) +{ + return (h & -2) | 1; +} + +unsigned int test9(unsigned int i) +{ + return (i & 3) | 1; +} + +int test10(int j) +{ + return (j & 3) | 1; +} + +/* { dg-final { scan-tree-dump-times "a \& 1 \\| 1" 0 "original" } } */ +/* { dg-final { scan-tree-dump-times "b \& 1 \\| 1" 0 "original" } } */ +/* { dg-final { scan-tree-dump-times "\\(c \\| 1\\) \& 1" 0 "original" } } */ +/* { dg-final { scan-tree-dump-times "\\(d \\| 1\\) \& 1" 0 "original" } } */ +/* { dg-final { scan-tree-dump-times "e \& 2 \\| 4" 1 "original" } } */ +/* { dg-final { scan-tree-dump-times "f \& 2 \\| 4" 1 "original" } } */ +/* { dg-final { scan-tree-dump-times "g \\| 1" 1 "original" } } */ +/* { dg-final { scan-tree-dump-times "h \\| 1" 1 "original" } } */ +/* { dg-final { scan-tree-dump-times "i \& 2 \\| 1" 1 "original" } } */ +/* { dg-final { scan-tree-dump-times "j \& 2 \\| 1" 1 "original" } } */ +/* { dg-final { cleanup-tree-dump "original" } } */ +
andor-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20030814-4.c =================================================================== --- 20030814-4.c (nonexistent) +++ 20030814-4.c (revision 816) @@ -0,0 +1,43 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-dom3 -fdump-tree-optimized" } */ + +extern void abort (void); +union tree_node; +typedef union tree_node *tree; +extern const char tree_code_type[]; +struct tree_common +{ + int code; +}; +struct tree_decl +{ + long pointer_alias_set; +}; +union tree_node +{ + struct tree_common common; + struct tree_decl decl; +}; +long +blah (decl, set) + tree decl; + long set; +{ + decl->decl.pointer_alias_set = set; + if (tree_code_type[decl->common.code] != 'd') + abort (); + record_alias_subset (decl->decl.pointer_alias_set); + if (set != -1) + set = 0; + return set; +} + +/* There should be precisely one reference to pointer_alias_set. If there is + more than one, then the dominator optimizations failed. */ +/* { dg-final { scan-tree-dump-times "pointer_alias_set" 1 "dom3"} } */ +/* { dg-final { cleanup-tree-dump "dom3" } } */ + +/* The assignment set = -1 in the ELSE clause of the last IF + statement should be removed by the final cleanup phase. */ +/* { dg-final { scan-tree-dump-times "set = -1" 0 "optimized"} } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */
20030814-4.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20030918-1.c =================================================================== --- 20030918-1.c (nonexistent) +++ 20030918-1.c (revision 816) @@ -0,0 +1,15 @@ +/* The compiler was failing to adjust pointer dereferences into array + references after propagating &equot[0] into p. */ + +/* { dg-do compile } */ +/* { dg-options "-O -ftree-dominator-opts" } */ + +static unsigned short equot[(6 +3)]; +int +foo (num) + unsigned short num[]; +{ + unsigned short *p = &equot[0]; + *p++ = num[0]; + *p++ = num[1]; +}
20030918-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: complex-1.c =================================================================== --- complex-1.c (nonexistent) +++ complex-1.c (revision 816) @@ -0,0 +1,13 @@ +/* Verify that we don't libcall for complex * real. */ +/* { dg-do compile } */ +/* { dg-options "-std=c99 -O -fdump-tree-optimized" } */ + +typedef _Complex float C; + +C foo(C x, float y) +{ + return x * y; +} + +/* { dg-final { scan-tree-dump-times "__mul" 0 "optimized" } } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */
complex-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20030917-3.c =================================================================== --- 20030917-3.c (nonexistent) +++ 20030917-3.c (revision 816) @@ -0,0 +1,24 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fno-tree-dominator-opts -fdump-tree-store_ccp" } */ + +extern int printf (const char *, ...); + +main () +{ + int variable = 0; + int p = 1; + while (1) + { + if (p) + break; + variable = variable + 1; + if (variable == 10) + break; + } + printf("%d\n", variable); +} + + +/* The argument to "printf" should be a constant, not a variable. */ +/* { dg-final { scan-tree-dump-times "printf.*, 0" 1 "store_ccp"} } */ +/* { dg-final { cleanup-tree-dump "store_ccp" } } */
20030917-3.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: vrp20.c =================================================================== --- vrp20.c (nonexistent) +++ vrp20.c (revision 816) @@ -0,0 +1,28 @@ +/* { dg-do compile } */ +/* { dg-options "-fwrapv -O1 -ftree-vrp -fdump-tree-vrp1" } */ + +extern void abort (); +extern void exit (int); + +int f (int a) { + if (a != 0) { + a = a > 0 ? a : -a; + if (a == 0) + return 1; + return 0; + } + return 0; +} + +int g (int b) { + if (b != 0) { + b = b > 0 ? b : -b; + if (b != 0) + return 0; + } + return 1; +} + +/* { dg-final { scan-tree-dump "Folding predicate a_. == 0 to 0" "vrp1" } } */ +/* { dg-final { scan-tree-dump "Folding predicate b_. != 0 to 1" "vrp1" } } */ +/* { dg-final { cleanup-tree-dump "vrp1" } } */
vrp20.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: vrp03.c =================================================================== --- vrp03.c (nonexistent) +++ vrp03.c (revision 816) @@ -0,0 +1,35 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-vrp1" } */ + +struct A +{ + int a; + int b; +}; + +foo (struct A *p, struct A *q) +{ + int *r = 0; + + if (p) + { + if (p == q) + { + /* This should be folded to 'if (1)' because q is [p, p] + and p is ~[0, 0]. */ + if (q) + r = &q->a; + + /* This should be folded to 'if (1)' because q should be + ~[0, 0] and thus &q->a should be ~[0, 0]. */ + if (r) + return 5; + } + } + + return q->a; +} + +/* { dg-final { scan-tree-dump-times "Folding predicate q_.*to 1" 1 "vrp1" } } */ +/* { dg-final { scan-tree-dump-times "Folding predicate r_.*to 1" 1 "vrp1" } } */ +/* { dg-final { cleanup-tree-dump "vrp1" } } */
vrp03.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ssa-pre-4.c =================================================================== --- ssa-pre-4.c (nonexistent) +++ ssa-pre-4.c (revision 816) @@ -0,0 +1,15 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-pre-stats" } */ +int main(void) +{ + int x, c, y; + x = 3; + if (c) + x = 2; + y = x + 1; + return y; +} +/* We should eliminate the x+1 computation from this routine, replacing + it with a phi of 3, 4 */ +/* { dg-final { scan-tree-dump-times "Eliminated: 1" 1 "pre"} } */ +/* { dg-final { cleanup-tree-dump "pre" } } */
ssa-pre-4.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: inline_asm-2.c =================================================================== --- inline_asm-2.c (nonexistent) +++ inline_asm-2.c (revision 816) @@ -0,0 +1,18 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-alias1-vops" } */ +/* Test to make sure that inline-asm causes a V_MAY_DEF. */ + + +void link_error(); +void f(char *a) +{ + int *a1 = (int *)a; + if (*a == 0) + asm("":"=m"(*a1)); + if (*a == 0) + link_error (); +} + +/* There should a V_MAY_DEF for the inline-asm and one for the link_error. */ +/* { dg-final { scan-tree-dump-times "V_MAY_DEF" 2 "alias1"} } */ +/* { dg-final { cleanup-tree-dump "alias1" } } */
inline_asm-2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pr24117.c =================================================================== --- pr24117.c (nonexistent) +++ pr24117.c (revision 816) @@ -0,0 +1,24 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-optimized" } */ + +typedef struct { + int x; + int z; +} Foo_t; + +char *xm; +void bar(void); + +void foo(void) +{ + Foo_t x; + x.x = 1; + x.z = 2; + xm = (char *)&x; + bar(); + /* We can't propagate x.z past bar, so this link_error should still be there. */ + if (x.z != 2) + link_error (); +} +/* { dg-final { scan-tree-dump-times "link_error" 1 "optimized"} } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */
pr24117.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: vrp28.c =================================================================== --- vrp28.c (nonexistent) +++ vrp28.c (revision 816) @@ -0,0 +1,32 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-vrp1" } */ + +int f(_Bool a) +{ + int t = a; + if (t != 2) + return 0; + return 1; +} + +int f1(unsigned char a) +{ + int t = a; + if (t != 256) + return 0; + return 1; +} + +int f3 (unsigned char c) +{ + int i = c; + if (i < 0 || i > 255) + return -1; + else + return 0; +} + +/* { dg-final { scan-tree-dump-times "if " 0 "vrp1" } } * / +/* { dg-final { cleanup-tree-dump "vrp1" } } */ + +
vrp28.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pr21086.c =================================================================== --- pr21086.c (nonexistent) +++ pr21086.c (revision 816) @@ -0,0 +1,19 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-vrp1" } */ + +int +foo (int *p) +{ + int a = *p; + int b = p != 0; + + *p = b; + + if (b) + return a; + else + return 0; +} + +/* { dg-final { scan-tree-dump-times "Folding predicate " 2 "vrp1" } } */ +/* { dg-final { cleanup-tree-dump "vrp1" } } */
pr21086.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pr14814.c =================================================================== --- pr14814.c (nonexistent) +++ pr14814.c (revision 816) @@ -0,0 +1,25 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-forwprop2" } */ + + +struct YY { + double e[3]; }; + +static inline double *y(struct YY* this_1) { return &this_1->e[1]; } + +struct XX { + struct YY v; + }; + +static inline struct YY direction (const struct XX* this_1) { return this_1->v;} + +int foo(const struct XX* r) { + struct YY t = direction(r); + if (*y(&t) < 0.000001) return 0; + return 1; +} + +/* { dg-final { scan-tree-dump-times "&" 0 "forwprop2" } } */ +/* { dg-final { cleanup-tree-dump "forwprop2" } } */ + +
pr14814.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ssa-sink-1.c =================================================================== --- ssa-sink-1.c (nonexistent) +++ ssa-sink-1.c (revision 816) @@ -0,0 +1,11 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-sink-stats" } */ +int +foo (int a, int b, int c) +{ + int x = a * b; + return c ? x : a; +} +/* We should sink the x = a * b calculation into the branch that returns x. */ +/* { dg-final { scan-tree-dump-times "Sunk statements:1" 1 "sink" } } */ +/* { dg-final { cleanup-tree-dump "sink" } } */
ssa-sink-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20040121-1.c =================================================================== --- 20040121-1.c (nonexistent) +++ 20040121-1.c (revision 816) @@ -0,0 +1,28 @@ + + +/* Test that (p!=0) + (q!=0) is computed as int, + not boolean */ +/* { dg-options "-O3" } */ +/* { dg-do run } */ +extern void abort (void); +char *foo(char *p, char *q) { + int x = (p !=0) + (q != 0); + if (x==2) return "a"; else return 0; +} +extern char *bar(char*, char*) __attribute__((noinline)); +char *bar(char *first, char *last) +{ + int y; + if (!first) return last; + if (!last) return first; + if (*first == 'a') + return foo(first, last); + return 0; +} +main() { + char *p = "a", *q = "b"; + if (p) + if (bar(p,q)) + return 0; + abort(); +}
20040121-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: loadpre12.c =================================================================== --- loadpre12.c (nonexistent) +++ loadpre12.c (revision 816) @@ -0,0 +1,15 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-pre-stats" } */ +typedef int type[2]; +type *t; +int g(int); +int f(int tt) +{ + type *t1 = t; + if ((*t1)[0]) + (*t1)[0] = 2; + return g((*t1)[0]); +} + +/* { dg-final { scan-tree-dump-times "Eliminated: 1" 1 "pre" { xfail *-*-* } } } */ +/* { dg-final { cleanup-tree-dump "pre" } } */
loadpre12.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ssa-ccp-3.c =================================================================== --- ssa-ccp-3.c (nonexistent) +++ ssa-ccp-3.c (revision 816) @@ -0,0 +1,135 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-store_ccp" } */ + +extern void link_error (void); + +/* some addresses clearly cannot be equal, check that some address + expressions can be evaluated as constants */ + +char g1, g2; +void test6 (char p1, char p2) +{ + char l1 = 1, l2 = 2; + static char s1 = 5, s2 = 7; + if (&l1 == &l2) + link_error (); + + if (&p1 == &p2) + link_error (); + + if (&s1 == &s2) + link_error (); + + if (&g1 == &g2) + link_error (); + + if (&p1 == &l1) + link_error (); + + if (&p1 == &s1) + link_error (); + + if (&p1 == &l2) + link_error (); + + if (&p1 == &g1) + link_error (); + + if (&l1 == &g1) + link_error (); + + if (&s1 == &g1) + link_error (); +} + +extern void *alloc (int) __attribute__ ((malloc)); +char gca1[128]; +char* __restrict__ rgc1; +char* test66 (char * __restrict__ rp1, char * __restrict__ rp2, char *p1) +{ + char * __restrict__ rl1 = p1; + char * l1 = (char*) alloc (20); + + if (l1 == rgc1) + link_error (); + + if (l1 == rp1) + link_error (); + + if (l1 == rl1) + link_error (); + + if (l1 == gca1) + link_error (); + + if (rl1 == rgc1) + link_error (); + + if (rl1 == rp1) + link_error (); + + if (rl1 == gca1) + link_error (); + + if (rp1 == rp2) + link_error (); + + if (rp1 == rgc1) + link_error (); + + if (rp1 == gca1) + link_error (); + + if (gca1 == rgc1) + link_error (); + +} + +int gci1[128]; +int* __restrict__ rgi1; +int* test666 (int * __restrict__ rp1, int * __restrict__ rp2, int *p1) +{ + int * __restrict__ rl1 = p1; + int * l1 = (int*) alloc (20); + + if (l1 == rgi1) + link_error (); + + if (l1 == rp1) + link_error (); + + if (l1 == rl1) + link_error (); + + if (l1 == gci1) + link_error (); + + if (rl1 == rgi1) + link_error (); + + if (rl1 == rp1) + link_error (); + + if (rl1 == gci1) + link_error (); + + if (rp1 == rp2) + link_error (); + + if (rp1 == rgi1) + link_error (); + + if (rp1 == gci1) + link_error (); + + if (gci1 == rgi1) + link_error (); +} + + +/* There should be not link_error calls, if there is any the + optimization has failed */ +/* ??? While we indeed don't handle some of these, a couple of the + restrict tests are incorrect. */ +/* { dg-final { scan-tree-dump-times "link_error" 0 "store_ccp" { xfail *-*-* } } } */ +/* { dg-final { cleanup-tree-dump "store_ccp" } } */
ssa-ccp-3.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pr27781.c =================================================================== --- pr27781.c (nonexistent) +++ pr27781.c (revision 816) @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-require-weak "" } */ +/* { dg-options "-O2 -fdump-tree-optimized" } */ + +void __attribute__((weak)) func(void) +{ + /* no code */ +} + +int main() +{ + func(); + return 0; +} + +/* { dg-final { scan-tree-dump "func \\(\\);" "optimized" } } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */
pr27781.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: bool-4.c =================================================================== --- bool-4.c (nonexistent) +++ bool-4.c (revision 816) @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-optimized" } */ + +int f(_Bool x) +{ + return (x != 0); +} + +/* There should be no != 0 which is produced by the front-end as + bool_var != 0 is the same as bool_var. */ +/* { dg-final { scan-tree-dump-times "!= 0" 0 "optimized"} } */ + +/* There should be no adde for powerpc. Check if we actually optimized + away the comparison. */ +/* { dg-final { scan-assembler-times "adde" 0 { target powerpc*-*-* } } } */ + +/* { dg-final { cleanup-tree-dump "optimized" } } */
bool-4.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20030820-2.c =================================================================== --- 20030820-2.c (nonexistent) +++ 20030820-2.c (revision 816) @@ -0,0 +1,24 @@ +/* { dg-do compile } */ +/* { dg-options "-O1" } */ + +/* A test for variables getting out of their scope in copy propagation. */ + +void foo(void) +{ + int k; + + goto forward; +back: + bla (k); + return; + +forward: + { + int i = bar (); + + k = i; + + goto back; + } +} +
20030820-2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20040326-1.c =================================================================== --- 20040326-1.c (nonexistent) +++ 20040326-1.c (revision 816) @@ -0,0 +1,32 @@ +/* { dg-options "-O2 -fno-inline-functions" } */ +/* { dg-do run } */ +/* When there are no call-clobbered variables, we should still create + a .GLOBAL_VAR to model the side effects of functions. Without it, + we were moving the call to Faref() inside the second call to + Faset(). */ +extern void abort (void); +extern void exit (int); + +main () +{ + int table, c, elt; + int tem = Faref (table, elt); + Faset (table, elt, c); + Faset (table, c, tem);/* tem cannot be replaced with Faref (table, elt) */ + exit (0); +} + +int j = 0; + +int __attribute__ ((noinline)) Faref (table, elt) +{ + j = 1; + return 0; +} + +int __attribute__ ((noinline)) Faset (table, elt, c) +{ + if (j != 1) + abort (); + return 0; +}
20040326-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: builtin-vfprintf-1.c =================================================================== --- builtin-vfprintf-1.c (nonexistent) +++ builtin-vfprintf-1.c (revision 816) @@ -0,0 +1,39 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-fab" } */ + +#include + +typedef struct { int i; } FILE; +FILE *fp; +extern int vfprintf (FILE *, const char *, va_list); +volatile int vi0, vi1, vi2, vi3, vi4, vi5, vi6, vi7, vi8, vi9, via; + +void +test (va_list ap1, va_list ap2, va_list ap3, va_list ap4, va_list ap5, + va_list ap6, va_list ap7) +{ + vi0 = 0; + vfprintf (fp, "hello", ap1); + vi1 = 0; + vfprintf (fp, "hello\n", ap2); + vi2 = 0; + vfprintf (fp, "a", ap3); + vi3 = 0; + vfprintf (fp, "", ap4); + vi4 = 0; + vfprintf (fp, "%s", ap5); + vi5 = 0; + vfprintf (fp, "%c", ap6); + vi6 = 0; + vfprintf (fp, "%s\n", ap7); + vi7 = 0; +} + +/* { dg-final { scan-tree-dump "vi0.*fwrite.*\"hello\".*1, 5, fp.*vi1" "fab"} } */ +/* { dg-final { scan-tree-dump "vi1.*fwrite.*\"hello\\\\n\".*1, 6, fp.*vi2" "fab"} } */ +/* { dg-final { scan-tree-dump "vi2.*fputc.*fp.*vi3" "fab"} } */ +/* { dg-final { scan-tree-dump "vi3 = 0\[^\(\)\]*vi4 = 0" "fab"} } */ +/* { dg-final { scan-tree-dump "vi4.*vfprintf.*\"%s\".*vi5" "fab"} } */ +/* { dg-final { scan-tree-dump "vi5.*vfprintf.*\"%c\".*vi6" "fab"} } */ +/* { dg-final { scan-tree-dump "vi6.*vfprintf.*\"%s\\\\n\".*vi7" "fab"} } */ +/* { dg-final { cleanup-tree-dump "fab" } } */
builtin-vfprintf-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: reassoc-5.c =================================================================== --- reassoc-5.c (nonexistent) +++ reassoc-5.c (revision 816) @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-optimized" } */ +extern int printf (const char *, ...); +int main(int argc, int b) +{ + /* We should be able to get rid of the a - i. */ + int i; + for (i = 0; i < 50; i++) + { + int a = b + i; + int c = a - i; + int d = argc + b; + printf ("%d %d\n", c,d); + } +} +/* { dg-final { scan-tree-dump-times "a - i" 0 "optimized"} } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */
reassoc-5.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20030807-1.c =================================================================== --- 20030807-1.c (nonexistent) +++ 20030807-1.c (revision 816) @@ -0,0 +1,45 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-dom3" } */ + +struct rtx_def; +typedef struct rtx_def *rtx; + + + +union rtunion_def +{ + int rtint; +}; +typedef union rtunion_def rtunion; + + + +struct rtx_def +{ + rtunion fld[1]; + +}; + +static int *uid_cuid; +static int max_uid_cuid; + +rtx +bar (rtx r) +{ + rtx place = r; + + if (place->fld[0].rtint <= max_uid_cuid + && (place->fld[0].rtint > max_uid_cuid ? insn_cuid (place) : + uid_cuid[place->fld[0].rtint])) + return r; + + return 0; +} + +/* There should be two IF conditionals. One tests <= max_uid_cuid, the + other tets the value in uid_cuid. If either is false the jumps + are threaded to the return 0. Which in turn means the path + which combines the result of those two tests into a new test + must always be true and it is optimized appropriately. */ +/* { dg-final { scan-tree-dump-times "if " 2 "dom3"} } */ +/* { dg-final { cleanup-tree-dump "dom3" } } */
20030807-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20030824-2.c =================================================================== --- 20030824-2.c (nonexistent) +++ 20030824-2.c (revision 816) @@ -0,0 +1,23 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-optimized" } */ + +struct A +{ + int a,b; +}; + +int foo (int x, int y) +{ + int i, j; + struct A a; + + a.a = x; + a.b = y; + j = a.a; + i = a.b; + return i + j; +} + +/* This function should be optimized into 'return y+x'. */ +/* { dg-final { scan-tree-dump-times "return \[xy\] \\+ \[xy\]" 1 "optimized"} } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */
20030824-2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ltrans-1.c =================================================================== --- ltrans-1.c (nonexistent) +++ ltrans-1.c (revision 816) @@ -0,0 +1,23 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -ftree-loop-linear -fdump-tree-ltrans-all" } */ +/* { dg-require-effective-target size32plus } */ + +double u[1782225]; +int foo(int N, int *res) +{ + int i, j; + double sum = 0.0; + /* This loop should be converted to a perfect nest and + interchanged. */ + for (i = 0; i < N; i++) + { + for (j = 0; j < N; j++) + sum = sum + u[i + 1335 * j]; + + u[1336 * i] *= 2; + } + *res = sum + N; +} +/* { dg-final { scan-tree-dump-times "converted loop nest to perfect loop nest" 1 "ltrans"} } */ +/* { dg-final { scan-tree-dump-times "transformed loop" 1 "ltrans"} } */ +/* { dg-final { cleanup-tree-dump "ltrans" } } */
ltrans-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ssa-dse-6.c =================================================================== --- ssa-dse-6.c (nonexistent) +++ ssa-dse-6.c (revision 816) @@ -0,0 +1,18 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-dse1" } */ + +int foo11 (int c) +{ + static int local1, local2; + local1 = 0; + local2 += c; + local1 = 2; + local2++; + return local1 + local2; +} + +/* There should only be one assignment to local1 and local2. */ +/* { dg-final { scan-tree-dump-times "local1 = " 1 "dse1"} } */ +/* { dg-final { scan-tree-dump-times "local2 = " 1 "dse1"} } */ + +/* { dg-final { cleanup-tree-dump "dse1" } } */
ssa-dse-6.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: recip-3.c =================================================================== --- recip-3.c (nonexistent) +++ recip-3.c (revision 816) @@ -0,0 +1,27 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fno-trapping-math -funsafe-math-optimizations -fdump-tree-recip" } */ + +double F[2] = { 0.0, 0.0 }, e; + +/* In this case the optimization is interesting. */ +float h () +{ + int i; + double E, W, P, d; + + W = 1.; + d = 2.*e; + E = 1. - d; + + for( i=0; i < 2; i++ ) + if( d > 0.01 ) + { + P = ( W < E ) ? (W - E)/d : (E - W)/d; + F[i] += P; + } + + F[0] += E / d; +} + +/* { dg-final { scan-tree-dump-times " / " 1 "recip" } } */ +/* { dg-final { cleanup-tree-dump "recip" } } */
recip-3.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: gen-vect-2.c =================================================================== --- gen-vect-2.c (nonexistent) +++ gen-vect-2.c (revision 816) @@ -0,0 +1,37 @@ +/* { dg-do run { target vect_cmdline_needed } } */ +/* { dg-options "-O2 -ftree-vectorize -ftree-vectorizer-verbose=3 -fdump-tree-vect-stats" } */ + +#include + +#define N 16 + +#if __LONG_MAX__ == 2147483647 +typedef short half_word; +#else +typedef int half_word; +#endif + +int main () +{ + half_word cb[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; + half_word ca[N]; + int i; + + for (i = 0; i < N; i++) + { + ca[i] = cb[i]; + } + + /* check results: */ + for (i = 0; i < N; i++) + { + if (ca[i] != cb[i]) + abort (); + } + + return 0; +} + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */ +/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" } } */ +/* { dg-final { cleanup-tree-dump "vect" } } */
gen-vect-2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: loop-1.c =================================================================== --- loop-1.c (nonexistent) +++ loop-1.c (revision 816) @@ -0,0 +1,47 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -ftree-loop-ivcanon -funroll-loops -fdump-tree-ivcanon-details -fdump-tree-cunroll-details -fdump-tree-optimized" } */ + +/* On 31-bit S/390 the function address will be stored (once) in the literal pool, + so scan-assembler-times "foo" will return 1 even if the loop is fully unrolled. + -msmall-exec avoids this by enabling a call instruction with immediate operand. */ +/* { dg-options "-O1 -ftree-loop-ivcanon -funroll-loops -fdump-tree-ivcanon-details -fdump-tree-cunroll-details -fdump-tree-optimized -msmall-exec" { target s390-*-* } } */ + +/* On Darwin, we call extern functions via a stub in PIC mode which is default and + the stub is named after the function. To avoid this we use -static to go out + of PIC mode. */ +/* { dg-options "-O1 -ftree-loop-ivcanon -funroll-loops -fdump-tree-ivcanon-details -fdump-tree-cunroll-details -fdump-tree-optimized -static" { target *-*-darwin* } } */ + +void xxx(void) +{ + int x = 45; + + while (x >>= 1) + foo (); +} + +/* We should be able to find out that the loop iterates four times and unroll it completely. */ + +/* { dg-final { scan-tree-dump-times "Added canonical iv to loop 1, 4 iterations" 1 "ivcanon"} } */ +/* { dg-final { cleanup-tree-dump "ivcanon" } } */ +/* { dg-final { scan-tree-dump-times "Unrolled loop 1 completely" 1 "cunroll"} } */ +/* { dg-final { cleanup-tree-dump "cunroll" } } */ +/* { dg-final { scan-tree-dump-times "foo" 5 "optimized"} } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */ + +/* Because hppa and ia64 targets include an external declaration for foo as + well as the calls we need to look for something more specific then just + foo in order to count only the calls and not the declaration. */ +/* The SH targets always use separate instructions to load the address + and to do the actual call - bsr is only generated by link time + relaxation. */ +/* CRIS keeps the address in a register. */ +/* m68k sometimes puts the address in a register, depending on CPU and PIC. */ + +/* { dg-final { scan-assembler-times "foo" 5 { xfail hppa*-*-* ia64*-*-* sh*-*-* cris-*-* m68k-*-* } } } */ +/* { dg-final { scan-assembler-times "foo,%r" 5 { target hppa*-*-* } } } */ +/* { dg-final { scan-assembler-times "= foo" 5 { target ia64*-*-* } } } */ +/* { dg-final { scan-assembler-times "jsr|blink\ttr?,r18" 5 { target sh*-*-* } } } */ +/* { dg-final { scan-assembler-times "Jsr \\\$r" 5 { target cris-*-* } } } */ +/* { dg-final { scan-assembler-times "\[jb\]sr" 5 { target m68k-*-* } } } */ + +
loop-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20030807-9.c =================================================================== --- 20030807-9.c (nonexistent) +++ 20030807-9.c (revision 816) @@ -0,0 +1,20 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-dom3" } */ + +static void +bar () +{ + const char *label2 = (*"*.L_sfnames_b" == '*') + "*.L_sfnames_b"; + oof (label2); +} + +void +ooof () +{ + if (""[0] == 0) + foo(); +} + +/* There should be no IF conditionals. */ +/* { dg-final { scan-tree-dump-times "if " 0 "dom3"} } */ +/* { dg-final { cleanup-tree-dump "dom3" } } */
20030807-9.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: vrp12.c =================================================================== --- vrp12.c (nonexistent) +++ vrp12.c (revision 816) @@ -0,0 +1,23 @@ +/* { dg-do link } */ +/* { dg-options -O2 } */ + +foo (int i) +{ + int x; + + x = i; + if (i < -10) + { + x = __builtin_abs (i); + /* VRP was incorrectly folding this to if (1). */ + if (x < 0) + link_error (); + } + + return x; +} + +main() +{ + foo (-30); +}
vrp12.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: loadpre8.c =================================================================== --- loadpre8.c (nonexistent) +++ loadpre8.c (revision 816) @@ -0,0 +1,97 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-pre-stats" } */ +typedef union tree_node *tree; +struct tree_common +{ + tree chain; +} +VEC_constructor_elt_base; +struct tree_ssa_name +{ + tree var; +}; +union tree_node +{ + struct tree_common common; + struct tree_ssa_name ssa_name; +}; +struct edge_def +{ + struct basic_block_def *dest; +}; +typedef struct edge_def *edge; +typedef struct VEC_edge_base +{ +} +VEC_edge_base; +edge +VEC_edge_base_index (const VEC_edge_base * vec_, unsigned ix_) +{ +} +typedef struct VEC_edge_gc +{ + VEC_edge_base base; +} +VEC_edge_gc; +struct basic_block_def +{ + VEC_edge_gc *succs; +}; +typedef struct basic_block_def *basic_block; +typedef struct +{ + unsigned index; + VEC_edge_gc **container; +} +edge_iterator; +__inline__ VEC_edge_gc * +ei_container (edge_iterator i) +{ + return *i.container; +} +__inline__ edge_iterator +ei_start_1 (VEC_edge_gc ** ev) +{ + edge_iterator i; + i.container = ev; + return i; +} +ei_next (edge_iterator * i) +{ +} +static __inline__ edge +ei_edge (edge_iterator i) +{ + return (edge) (VEC_edge_base_index ((((ei_container (i))) ? &((ei_container (i)))->base : 0), (i.index))); +} +static __inline__ unsigned char +ei_cond (edge_iterator ei, edge * p) +{ + *p = ei_edge (ei); +} +typedef tree *def_operand_p; +extern tree *get_phi_result_ptr (tree); +static __inline__ tree +get_def_from_ptr (def_operand_p def) +{ +} +tree +phi_nodes (basic_block bb) +{ +} + +/* We can eliminate a load of the SRA'd variable edge_iterator.container */ +rewrite_add_phi_arguments (basic_block bb) +{ + edge e; + edge_iterator ei; + for ((ei) = ei_start_1 (&((bb->succs))); ei_cond ((ei), &(e)); + ei_next (&(ei))) + { + tree phi; + for (phi = phi_nodes (e->dest); phi; phi = (((phi))->common.chain)) + get_reaching_def ((get_def_from_ptr (get_phi_result_ptr (phi)))->ssa_name.var); + } +} +/* { dg-final { scan-tree-dump-times "Eliminated: 1" 1 "pre"} } */ +/* { dg-final { cleanup-tree-dump "pre" } } */
loadpre8.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: loop-9.c =================================================================== --- loop-9.c (nonexistent) +++ loop-9.c (revision 816) @@ -0,0 +1,24 @@ +/* Without TARGET_MEM_REFs, dom creates code like + + i1 = 4 * i; + *(p + i1) = i; + *(p + i1 + 4) = i + + causing us to have unnecessary multiplication by 4 in the + result. */ + +/* { dg-do compile } */ +/* { dg-options "-O1" } */ + +void foo (int *p) +{ + int i; + + for (i = 0; i < 100; i++) + { + p[i] = i; + p[i + 1] = i; + } +} + +/* { dg-final { scan-assembler-times "lea\\t" 0 { target i?86-*-* x86_64-*-* } } } */
loop-9.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: asm-3.c =================================================================== --- asm-3.c (nonexistent) +++ asm-3.c (revision 816) @@ -0,0 +1,32 @@ +/* PR 17739 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-optimized" } */ + +#ifdef __hppa__ +#define REGISTER "1" +#else +#define REGISTER "0" +#endif + +static inline int source(void) +{ + register int hardreg __asm__(REGISTER); + asm("" : "=r"(hardreg)); + return hardreg; +} + +void test(void) +{ + int t = source(); + foo(t); + bar(t); +} + +/* Hardreg should appear exactly 3 times -- declaration, asm stmt, + and copy out. */ +/* { dg-final { scan-tree-dump-times "hardreg" 3 "optimized" } } */ + +/* In particular, hardreg should *not* appear in the call to bar. */ +/* { dg-final { scan-tree-dump-times "bar \[(\]t\[)\]" 1 "optimized" } } */ + +/* { dg-final { cleanup-tree-dump "optimized" } } */
asm-3.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: stdarg-1.c =================================================================== --- stdarg-1.c (nonexistent) +++ stdarg-1.c (revision 816) @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-stdarg" } */ + +#include + +/* This can be handled on all arches. If there is no va_start, registers don't need + to be saved. */ +void +f1 (int i, ...) +{ +} +/* { dg-final { scan-tree-dump "f1: va_list escapes 0, needs to save 0 GPR units and 0 FPR units" "stdarg" } } */ +/* { dg-final { cleanup-tree-dump "stdarg" } } */
stdarg-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pr26180.c =================================================================== --- pr26180.c (nonexistent) +++ pr26180.c (revision 816) @@ -0,0 +1,44 @@ +/* { dg-do run } */ +/* { dg-options "-O2" } */ +/* { dg-require-effective-target int32plus } */ + +void abort(void); +int bar(int x, int y) +{ + int x1, y1; + int x2, y2; + unsigned int x3, y3, w; + int z = 1; + + x1 = (x < (1 << 30)); + y1 = (y < (1 << 30)); + if (x1) + if (y1) { + x2 = ((x > 0)? (x): -(x)); + y2 = ((y > 0)? (y): -(y)); + + x3 = x2; + y3 = y2; + w = x3 * y3; + + if (w >= (1 << 30)) { + z = 1; + } else { + z = -1; + } + } + + return z; +} + + +int main() +{ + int x, y, z; + x = 536870912; /* 2^29 */ + y = 2; + z = bar(x, y); + if (z != 1) + abort (); + return 0; +}
pr26180.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pr19055-2.c =================================================================== --- pr19055-2.c (nonexistent) +++ pr19055-2.c (revision 816) @@ -0,0 +1,27 @@ +/* { dg-do compile } */ +/* { dg-options "-fdump-tree-gimple" } */ +int f1(int a,int b,int c,int d) +{ + return ((a&d)|(b&c)) ^ (b&c); +} + +int f2(int a,int b,int c,int d) +{ + return (b&c) ^ ((a&d)|(b&c)); +} + +int f3(int a,int b,int c,int d) +{ + return ((b&c)|(a&d)) ^ (b&c); +} + +int f4(int a,int b,int c,int d) +{ + return (b&c) ^ ((b&c)|(a&d)); +} + +/* There should be no ^, 4 ~ and 12 &. */ +/* { dg-final { scan-tree-dump-times "\\^" 0 "gimple"} } */ +/* { dg-final { scan-tree-dump-times "~" 4 "gimple"} } */ +/* { dg-final { scan-tree-dump-times "&" 12 "gimple"} } */ +/* { dg-final { cleanup-tree-dump "gimple" } } */
pr19055-2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pr23294.c =================================================================== --- pr23294.c (nonexistent) +++ pr23294.c (revision 816) @@ -0,0 +1,38 @@ +/* { dg-do compile } */ +/* { dg-options "-O -fdump-tree-optimized" } */ + +int f1(int a) +{ + return a*6-a; +} + +int f2(int a) +{ + return a*4+a; +} + +int f3(int a) +{ + return 2*a + 3*a; +} + +int f4(int a, int b) +{ + return 2*a + 6*b; +} + +int f5(int a, int b) +{ + return 2*a - 6*b; +} + +int f6(int a, int b) +{ + return 6*a - 2*b; +} + +/* { dg-final { scan-tree-dump-times "a \\\* 5" 3 "optimized" } } */ +/* { dg-final { scan-tree-dump "\\\(b \\\* 3 \\\+ a\\\) \\\* 2" "optimized" } } */ +/* { dg-final { scan-tree-dump "\\\(a - b \\\* 3\\\) \\\* 2" "optimized" } } */ +/* { dg-final { scan-tree-dump "\\\(a \\\* 3 - b\\\) \\\* 2" "optimized" } } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */
pr23294.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pr15791-1.c =================================================================== --- pr15791-1.c (nonexistent) +++ pr15791-1.c (revision 816) @@ -0,0 +1,25 @@ +/* { dg-do link } */ + +void link_error (); + +int main () +{ + struct { int b[2]; } x; + int b[2]; + if (&b[1] != &b[1]) + link_error (); + if (&b[0] != b) + link_error (); + if (b == &b[2]) + link_error (); + if (b != b) + link_error (); + if (&x.b[1] == &x.b[0]) + link_error (); + if (x.b != &x.b[0]) + link_error (); + if (&x.b[1] == x.b) + link_error (); + return 0; +} +
pr15791-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pr21559.c =================================================================== --- pr21559.c (nonexistent) +++ pr21559.c (revision 816) @@ -0,0 +1,45 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-vrp1-details" } */ + +static int blocksize = 4096; + +int bar (int); + +void foo (void) +{ + int toread; + int bytes; + static char eof_reached = 0; + + toread = blocksize; + bytes = 1; + + while (toread != 0) + { + bytes = bar (toread); + if (bytes <= 0) + { + if (bytes < 0) + continue; + break; + } + toread -= bytes; + } + + if (bytes == 0) + eof_reached = 1; +} + + +/* First, we should simplify the bits < 0 test within the loop. */ +/* { dg-final { scan-tree-dump-times "Simplified relational" 1 "vrp1" } } */ + +/* Second, we should thread the edge out of the loop via the break + statement. */ +/* { dg-final { scan-tree-dump-times "Threaded jump" 1 "vrp1" } } */ + +/* Now if we were really good, we'd realize that the final bytes == 0 + test is totally useless. That's not likely to happen anytime soon. */ + +/* { dg-final { cleanup-tree-dump "vrp1" } } */ +
pr21559.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20040211-1.c =================================================================== --- 20040211-1.c (nonexistent) +++ 20040211-1.c (revision 816) @@ -0,0 +1,41 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-cddce" } */ + + + + +struct rtx_def; +typedef struct rtx_def *rtx; +extern const char rtx_class[]; +union rtunion_def +{ + rtx rtx; +}; +typedef union rtunion_def rtunion; +struct rtx_def +{ + int code; + rtunion fld[1]; +}; +static int +can_move_up (rtx insn, int n_insns) +{ + while (n_insns > 0) + { + insn = (((insn)->fld[1]).rtx); + if (((rtx_class[(int) (((insn)->code))]) == 'i')) + n_insns--; + } + return n_insns <= 0; +} +int +com (rtx insn, int blah) +{ + if (!can_move_up (insn, blah)) + foo (); +} + +/* Cddce cannot remove possibly infinite loops and there is no way how to + determine whether the loop in can_move_up ends. */ +/* { dg-final { scan-tree-dump "if " "cddce"} } */ +/* { dg-final { cleanup-tree-dump "cddce" } } */
20040211-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: alias-3.c =================================================================== --- alias-3.c (nonexistent) +++ alias-3.c (revision 816) @@ -0,0 +1,20 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-optimized" } */ + +struct { + int i; + int j; + int x[2]; +} a; + +int foo(void) +{ + a.i = 1; + a.j = 0; + a.x[0] = 0; + return a.i + a.j; +} + +/* { dg-final { scan-tree-dump "return 1;" "optimized" } } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */ +
alias-3.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: loadpre21.c =================================================================== --- loadpre21.c (nonexistent) +++ loadpre21.c (revision 816) @@ -0,0 +1,19 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-pre-stats" } */ +typedef int type[2]; +int main(type *a, int argc) +{ + int b; + int i; + int d, e; + + /* Should be able to hoist this out of the loop. */ + for (i = 0; i < argc; i++) + { + e = (*a)[0]; + } + return d + e; +} + +/* { dg-final { scan-tree-dump-times "Eliminated: 1" 1 "pre"} } */ +/* { dg-final { cleanup-tree-dump "pre" } } */
loadpre21.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20030611-1.c =================================================================== --- 20030611-1.c (nonexistent) +++ 20030611-1.c (revision 816) @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-dom3" } */ + +extern int square (int) __attribute__ ((__const__)); +shit(int a) +{ + return square (a) + square (a); + +} + +/* There should be precisely one call to square. If there is more than one, + then the dominator optimizations failed to remove the redundant call. */ +/* { dg-final { scan-tree-dump-times "square" 1 "dom3"} } */ +/* { dg-final { cleanup-tree-dump "dom3" } } */
20030611-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: gen-vect-32.c =================================================================== --- gen-vect-32.c (nonexistent) +++ gen-vect-32.c (revision 816) @@ -0,0 +1,33 @@ +/* { dg-do run { target vect_cmdline_needed } } */ +/* { dg-options "-O2 -ftree-vectorize -ftree-vectorizer-verbose=3 -fdump-tree-vect-stats" } */ + +#include + +#define N 16 + +int main () +{ + struct { + char ca[N]; + } s; + int i; + + for (i = 0; i < N; i++) + { + s.ca[i] = 5; + } + + /* check results: */ + for (i = 0; i < N; i++) + { + if (s.ca[i] != 5) + abort (); + } + + return 0; +} + + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */ +/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" } } */ +/* { dg-final { cleanup-tree-dump "vect" } } */
gen-vect-32.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pr21959.c =================================================================== --- pr21959.c (nonexistent) +++ pr21959.c (revision 816) @@ -0,0 +1,20 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-vrp1" } */ + +unsigned char c[0xFF]; +void f(void) +{ + unsigned char i; + c[128] = 128; + i = 0; + while (1) + { + /* This predicate should not be folded out. */ + if (((signed char) i) < 0) break; + c[i] = ' '; + i++; + } +} + +/* { dg-final { scan-tree-dump-times "Folding predicate " 0 "vrp1" } } */ +/* { dg-final { cleanup-tree-dump "vrp1" } } */
pr21959.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: tree-ssa.exp =================================================================== --- tree-ssa.exp (nonexistent) +++ tree-ssa.exp (revision 816) @@ -0,0 +1,36 @@ +# Copyright (C) 1997,2002,2003, 2007 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GCC; see the file COPYING3. If not see +# . + +# GCC testsuite that uses the `dg.exp' driver. + +# Load support procs. +load_lib gcc-dg.exp + +# If a testcase doesn't have special options, use these. +global DEFAULT_CFLAGS +if ![info exists DEFAULT_CFLAGS] then { + set DEFAULT_CFLAGS " -ansi -pedantic-errors" +} + +# Initialize `dg'. +dg-init + +# Main loop. +dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] \ + "" $DEFAULT_CFLAGS + +# All done. +dg-finish Index: 20030731-1.c =================================================================== --- 20030731-1.c (nonexistent) +++ 20030731-1.c (revision 816) @@ -0,0 +1,67 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-dom3" } */ + +extern void abort (void); + +struct rtx_def; +typedef struct rtx_def *rtx; +struct rtvec_def; +typedef struct rtvec_def *rtvec; +union tree_node; +typedef union tree_node *tree; +struct rtx_def +{ + int code; + int mode; + unsigned int in_struct:1; +}; +struct tree_common +{ + int code; +}; +struct tree_decl +{ + rtx rtl; +}; +union tree_node +{ + struct tree_common common; + struct tree_decl decl; +}; +rtx +store_expr (exp, target, want_value) + tree exp; + rtx target; + int want_value; +{ + if (exp->common.code == 42) + abort (); + else if (queued_subexp_p (target)) + { + blah (target->mode); + if (target->code) + abort (); + } + else + { + if (target->code && (__extension__({target;})->in_struct)); + } + + if ((target != (exp->decl.rtl + ? (exp->decl.rtl + ? exp->decl.rtl + : (make_decl_rtl (exp, 0), exp->decl.rtl)) + : 0)) + && expr_size (exp)) + ; +} + +/* All paths to the test "target != 0" occuring in the final IF statement + dereference target. Thus target can not have the value zero at that + point and the test should have been eliminated. */ +/* ??? The dominator walker (A) doesn't merge this data at joins and + (B) only looks at immediate dominators, and only queued_subexp_p + immediately dominates the comparison in question. We need something + stronger. */ +/* { dg-final { scan-tree-dump-times "target.*!= 0" 0 "dom3" { xfail *-*-* } } } */ +/* { dg-final { cleanup-tree-dump "dom3" } } */
20030731-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20040514-2.c =================================================================== --- 20040514-2.c (nonexistent) +++ 20040514-2.c (revision 816) @@ -0,0 +1,18 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-phiopt1" } */ +int +foo2 (distance, i, j) + int distance; + int i, j; +{ + int t = distance; + if (t <= 0) + t = ((t) >= 0 ? (t) : -(t)); + return t; +} + +/* There should be one ABS_EXPR and no conditionals. */ +/* { dg-final { scan-tree-dump-times "ABS_EXPR " 1 "phiopt1"} } */ +/* { dg-final { scan-tree-dump-times "if " 0 "phiopt1"} } */ +/* { dg-final { cleanup-tree-dump "phiopt1" } } */ +
20040514-2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20031106-5.c =================================================================== --- 20031106-5.c (nonexistent) +++ 20031106-5.c (revision 816) @@ -0,0 +1,29 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-optimized" } */ + +extern void link_error (void); + +/* Check for cprop on different fields of same type structs. */ + +struct s +{ + char d; + int a, b; + double m; +}; + +void foo2 (struct s* r, struct s* p) +{ + r->a = 0; + p->b = 1; + r->a++; + p->b++; + if (r->a != 1) + link_error (); + if (p->b != 2) + link_error (); +} + +/* There should be no link_error calls. */ +/* { dg-final { scan-tree-dump-times "link_error" 0 "optimized" { xfail *-*-* } } } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */
20031106-5.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: scev-2.c =================================================================== --- scev-2.c (nonexistent) +++ scev-2.c (revision 816) @@ -0,0 +1,20 @@ +/* PR tree-optimization/19899 */ +/* Decrementing a floating-point variable in a loop caused an ICE. */ + +/* { dg-do run } */ +/* { dg-options "-O -ftree-vectorize" } */ + +extern void abort (void); + +int main() +{ + double a = 20; + int i; + + for (i = 0; i < 10; ++i) + a -= 2; + + if (a) + abort(); + return 0; +}
scev-2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ssa-fre-3.c =================================================================== --- ssa-fre-3.c (nonexistent) +++ ssa-fre-3.c (revision 816) @@ -0,0 +1,15 @@ +/* { dg-do compile } */ +/* { dg-options "-O -fwrapv -fdump-tree-fre-details" } */ + +/* From PR14844. */ + +int +foo (int a, int b) +{ + long long aa = a; + long long bb = b; + return aa + bb; +} + +/* { dg-final { scan-tree-dump "Replaced \\\(int\\\) aa_.*with a_" "fre" } } */ +/* { dg-final { cleanup-tree-dump "fre" } } */
ssa-fre-3.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: andor-2.c =================================================================== --- andor-2.c (nonexistent) +++ andor-2.c (revision 816) @@ -0,0 +1,52 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-original" } */ + +int test1(int a, int b) +{ + return (a & b) | b; +} + +int test2(int c, int d) +{ + return (c & d) | c; +} + +int test3(int e, int f) +{ + return e | (e & f); +} + +int test4(int g, int h) +{ + return g | (h & g); +} + +int test5(int i, int j) +{ + return (i | j) & j; +} + +int test6(int k, int l) +{ + return (k | l) & k; +} + +int test7(int m, int n) +{ + return m & (m | n); +} + +int test8(int o, int p) +{ + return o & (p | o); +} + +/* { dg-final { scan-tree-dump-times "return b;" 1 "original" } } */ +/* { dg-final { scan-tree-dump-times "return c;" 1 "original" } } */ +/* { dg-final { scan-tree-dump-times "return e;" 1 "original" } } */ +/* { dg-final { scan-tree-dump-times "return g;" 1 "original" } } */ +/* { dg-final { scan-tree-dump-times "return j;" 1 "original" } } */ +/* { dg-final { scan-tree-dump-times "return k;" 1 "original" } } */ +/* { dg-final { scan-tree-dump-times "return m;" 1 "original" } } */ +/* { dg-final { scan-tree-dump-times "return o;" 1 "original" } } */ +/* { dg-final { cleanup-tree-dump "original" } } */
andor-2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20040518-2.c =================================================================== --- 20040518-2.c (nonexistent) +++ 20040518-2.c (revision 816) @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-phiopt1-details" } */ + +int t( int i) +{ + int j; + if(i>=0) + j = i; + else + j = -i; + return j; +} + +/* We should convert one COND_EXPRs into straightline code with ABS. */ +/* { dg-final { scan-tree-dump-times "straightline" 1 "phiopt1"} } */ +/* { dg-final { scan-tree-dump-times "ABS_EXPR" 1 "phiopt1"} } */ +/* { dg-final { cleanup-tree-dump "phiopt1" } } */
20040518-2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: divide-1.c =================================================================== --- divide-1.c (nonexistent) +++ divide-1.c (revision 816) @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fstrict-overflow -fdump-tree-optimized" } */ + +int f(int a) +{ + return (-a)/10; +} + + +/* { dg-final { scan-tree-dump-times "-a / 10" 0 "optimized"} } */ +/* { dg-final { scan-tree-dump-times "a / -10" 1 "optimized"} } */ + +/* { dg-final { cleanup-tree-dump "optimized" } } */ +
divide-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20030814-5.c =================================================================== --- 20030814-5.c (nonexistent) +++ 20030814-5.c (revision 816) @@ -0,0 +1,43 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-dom3 -fdump-tree-optimized" } */ + +extern void abort (void); +union tree_node; +typedef union tree_node *tree; +extern const char tree_code_type[]; +struct tree_common +{ + int code; +}; +struct tree_decl +{ + long pointer_alias_set; +}; +union tree_node +{ + struct tree_common common; + struct tree_decl decl; +}; +long +blah (decl, set) + tree decl; + long set; +{ + decl->decl.pointer_alias_set = oof(); + if (tree_code_type[decl->common.code] != 'd') + abort (); + record_alias_subset (decl->decl.pointer_alias_set); + if (set != -1) + set = 0; + return set; +} + +/* There should be precisely one reference to pointer_alias_set. If there is + more than one, then the dominator optimizations failed. */ +/* { dg-final { scan-tree-dump-times "pointer_alias_set" 1 "dom3"} } */ +/* { dg-final { cleanup-tree-dump "dom3" } } */ + +/* The assignment set = -1 in the ELSE clause of the last IF + statement should be removed by the final cleanup phase. */ +/* { dg-final { scan-tree-dump-times "set = -1" 0 "optimized"} } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */
20030814-5.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: complex-2.c =================================================================== --- complex-2.c (nonexistent) +++ complex-2.c (revision 816) @@ -0,0 +1,13 @@ +/* Verify that we don't libcall for complex / real. */ +/* { dg-do compile } */ +/* { dg-options "-std=c99 -O -fdump-tree-optimized" } */ + +typedef _Complex float C; + +C foo(C x, float y) +{ + return x / y; +} + +/* { dg-final { scan-tree-dump-times "__div" 0 "optimized" } } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */
complex-2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: vrp21.c =================================================================== --- vrp21.c (nonexistent) +++ vrp21.c (revision 816) @@ -0,0 +1,27 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -ftree-vrp -fdump-tree-vrp1" } */ +/* { dg-require-effective-target int32plus } */ + +extern void link_error (); + +void test01(unsigned int a, unsigned int b) +{ + unsigned int x = 0x80000000; + if (a < x) + if (b < x) + if (a > 5) + if (a + b == 0U) + link_error (); +} + +void test02(unsigned int a, unsigned int b) +{ + unsigned int x = 0x80000000; + if (a > x) + if (b < x) + if (a - b == 1U) + link_error (); +} + +/* { dg-final { scan-tree-dump-times "link_error" 0 "vrp1" } } */ +/* { dg-final { cleanup-tree-dump "vrp1" } } */
vrp21.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pr22230.c =================================================================== --- pr22230.c (nonexistent) +++ pr22230.c (revision 816) @@ -0,0 +1,21 @@ +/* { dg-do run } */ +/* { dg-options "-O1 -ftree-vrp" } */ + +/* PR tree-optimization/22230 + + The meet of the ranges in "i*i" was not computed correctly, leading + gcc to believe that a was equal to 0 after the loop. */ + +extern void abort (void) __attribute__((noreturn)); + +int main (void) +{ + long a, i; + + for (i = 0; i < 5; i++) + a = i * i; + if (a != 16) + abort (); + return 0; +} +
pr22230.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: vrp04.c =================================================================== --- vrp04.c (nonexistent) +++ vrp04.c (revision 816) @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-vrp1" } */ + +foo (int a, int b) +{ + if (a == b) + /* This should be folded to if (1) */ + if (a == b) + return a + b; +} + +/* { dg-final { scan-tree-dump-times "Folding predicate a_.*to 1" 1 "vrp1" } } */ +/* { dg-final { cleanup-tree-dump "vrp1" } } */
vrp04.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ssa-pre-5.c =================================================================== --- ssa-pre-5.c (nonexistent) +++ ssa-pre-5.c (revision 816) @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-pre-stats" } */ +int +foo (int i) +{ + int a, b; + if (i) + a = 3, b = 2; + else + a = 2, b = 3; + return a + b; +} +/* We should detect that a+b is the same along both edges, and replace it with + 5 */ +/* { dg-final { scan-tree-dump-times "Constified: 1" 1 "pre"} } */ +/* { dg-final { cleanup-tree-dump "pre" } } */
ssa-pre-5.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pr17141-1.c =================================================================== --- pr17141-1.c (nonexistent) +++ pr17141-1.c (revision 816) @@ -0,0 +1,18 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-forwprop2" } */ + + +struct A { int i; }; +int +foo(struct A *locp, int str) +{ + int T355, *T356; + T356 = &locp->i; + *T356 = str; + return locp->i; +} + +/* { dg-final { scan-tree-dump-times "&" 0 "forwprop2" } } */ +/* { dg-final { cleanup-tree-dump "forwprop2" } } */ + +
pr17141-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pr28410.c =================================================================== --- pr28410.c (nonexistent) +++ pr28410.c (revision 816) @@ -0,0 +1,26 @@ +/* { dg-do run } */ +/* { dg-options "-O2 --param global-var-threshold=1" } */ + +extern void abort(void); +struct Bar { int p; }; +struct Foo { struct Bar *p; }; +struct Bar p0 = { 0 }; +struct Bar p1 = { 1 }; +void bar(struct Foo *f) +{ + f->p = &p0; +} +int foo(struct Foo *f) +{ + f->p->p = 1; + bar(f); + return f->p->p; +} +int main() +{ + struct Foo f; + f.p = &p1; + if (foo(&f) != 0) + abort (); + return 0; +}
pr28410.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pr20490.c =================================================================== --- pr20490.c (nonexistent) +++ pr20490.c (revision 816) @@ -0,0 +1,20 @@ +/* { dg-do compile } */ +/* { dg-options "-O -ftree-pre" } */ +static int a; +static int b; + +typedef int gint; + +int blah () +{ + gint x = a; + gint y = b; + + x *= (x < 0) ? -1 : 0; + y *= (y < 0) ? -1 : 0; + + return (y * x); + +} + +
pr20490.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: vrp29.c =================================================================== --- vrp29.c (nonexistent) +++ vrp29.c (revision 816) @@ -0,0 +1,20 @@ +/* { dg-do run } */ +/* { dg-options "-O2" } */ + +extern void abort(void); + +void decCompareOp (int result) +{ + if (result != (int)0x80000000) + { + result = -result; + if (result != (int)0x80000001) + abort (); + } +} + +int main() +{ + decCompareOp (0x7fffffff); + return 0; +}
vrp29.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pr23048.c =================================================================== --- pr23048.c (nonexistent) +++ pr23048.c (revision 816) @@ -0,0 +1,11 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -ftree-vectorize" } */ + +void f(unsigned char *mem) +{ + int i; + + for(i=0;i<4;i++) { + while(mem[i]==0) ; + } +}
pr23048.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: tailcall-1.c =================================================================== --- tailcall-1.c (nonexistent) +++ tailcall-1.c (revision 816) @@ -0,0 +1,20 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-tailc-details" } */ +extern void *alloca (__SIZE_TYPE__); +int q(int a); +int *v; +int +t(int a) +{ + int r,r1; + if (a) + r1=r = q(a-1); + else + return 0; + /* Dead alloca should not disturb us. */ + if (r!=r1) + v=alloca(r); + return r; +} +/* { dg-final { scan-tree-dump-times "Found tail call" 1 "tailc"} } */ +/* { dg-final { cleanup-tree-dump "tailc" } } */
tailcall-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pr22591.c =================================================================== --- pr22591.c (nonexistent) +++ pr22591.c (revision 816) @@ -0,0 +1,56 @@ +/* { dg-do run } */ +/* { dg-options "-O2" } */ + +void abort (); + +typedef struct _Node +{ + struct _Node *next, *prev; +} Node; + +void __attribute__ ((noinline)) append (Node * q, Node * p) +{ + p->next = q; + p->prev = q; + q->next = p; + q->prev = p; +} + +inline void +swap (Node ** a, Node ** b) +{ + Node *tmp = *a; + *a = *b; + *b = tmp; +} + +/* Miscompilation seems to happen here. If one removes the if condition + (which should be true) the program works fine. */ +void +ListSwap (Node * x, Node * y) +{ + Node *tmp; + if (x->next) + { + swap (&x->next, &y->next); + swap (&x->prev, &y->prev); + x->next->prev = x->prev->next = x; + y->next->prev = y->prev->next = y; + } +} + +int +main () +{ + Node A, A1, B, B1; + + append (&A, &A1); + append (&B, &B1); + + ListSwap (&A, &B); + + if (&A != A.next->prev) + abort (); + + return 0; +}
pr22591.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pr23546.c =================================================================== --- pr23546.c (nonexistent) +++ pr23546.c (revision 816) @@ -0,0 +1,10 @@ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ +typedef int m64 __attribute__ ((__vector_size__ (8))); + +void mmxCombineMaskU (m64 * mask, int width) +{ + while (--width >= 0) + *mask++ = (m64) 0LL; +} +
pr23546.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ssa-sink-2.c =================================================================== --- ssa-sink-2.c (nonexistent) +++ ssa-sink-2.c (revision 816) @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-sink-stats" } */ +int +bar (int a, int b, int c) +{ + int y = a * b; + if (c) + y = 12; + return y; +} +/* We should sink the x = a * b calculation into the else branch */ +/* { dg-final { scan-tree-dump-times "Sunk statements:1" 1 "sink" } } */ +/* { dg-final { cleanup-tree-dump "sink" } } */
ssa-sink-2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20031113-1.c =================================================================== --- 20031113-1.c (nonexistent) +++ 20031113-1.c (revision 816) @@ -0,0 +1,32 @@ +/* PR optimization/12640 + + We used to get into an infinite loop while trying to + figure out `strlen (resultString)'. This showed up as + a stack overflow while compiling tk. */ + +/* { dg-do compile } */ +/* { dg-options "-O1" } */ + +extern __SIZE_TYPE__ strlen (const char *); + +int i; + +static void +SendEventProc (char *resultString) +{ + char *p; + + resultString = ""; + while (*p == '-') + { + if (p[2] == ' ') + { + resultString = p + 3; + } + } + for (;;) + { + i = strlen (resultString) + 1; + } +} +
20031113-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pr25485.c =================================================================== --- pr25485.c (nonexistent) +++ pr25485.c (revision 816) @@ -0,0 +1,17 @@ +/* PR tree-optimization/25485 + VRP did not fold TRUTH_AND_EXPR. Make sure it does now. */ + +/* { dg-options "-O2 -fdump-tree-vrp1" } */ + +int +foo (int a, int b) +{ + if (a > 50) + return 19; + if (a > 63 && b < 50) + return 17; + return 31; +} + +/* { dg-final { scan-tree-dump-times "if" 1 "vrp1"} } */ +/* { dg-final { cleanup-tree-dump "vrp1" } } */
pr25485.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pr21985.c =================================================================== --- pr21985.c (nonexistent) +++ pr21985.c (revision 816) @@ -0,0 +1,34 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-optimized" } */ + +struct +{ + struct + { + int a; + int b; + } a[100]; +} a; + +typedef __SIZE_TYPE__ size_t; +void foo(size_t); +size_t *bar (void); + +int +main (void) +{ + size_t *b = bar (); + + /* This should be folded. */ + foo (&a.a[50].a - &a.a[33].b); + foo ((size_t) &a.a[50].b - (size_t) &a); + + /* And this should not. */ + foo ((size_t) &b - (size_t) b); + return 0; +} + +/* Two of the calls to foo should be folded to just foo(constant). */ + +/* { dg-final { scan-tree-dump-times "foo \\(\[0-9\]*\\)" 2 "optimized" } } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */
pr21985.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: loadpre13.c =================================================================== --- loadpre13.c (nonexistent) +++ loadpre13.c (revision 816) @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-pre-stats" } */ +int t[2]; +int g(int); +int f(int tt) +{ + if (t[0]) + t[0] = 2; + return g(t[0]); +} + +/* { dg-final { scan-tree-dump-times "Eliminated: 1" 1 "pre"} } */ +/* { dg-final { cleanup-tree-dump "pre" } } */
loadpre13.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20040305-1.c =================================================================== --- 20040305-1.c (nonexistent) +++ 20040305-1.c (revision 816) @@ -0,0 +1,32 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-cddce -fdump-tree-forwprop1-details" } */ + +int abarney[2]; +int afred[1]; + +void foo(int edx, int eax) +{ + if (eax == 100) + { + if (edx == 1) + { + abarney[0] = 5; + abarney[1] = 6; + } + } + if (eax == 100) + { + if (-- edx == 0) + afred[0] = 2; + } +} + + +/* Verify that we did a forward propagation. */ +/* { dg-final { scan-tree-dump-times "Replaced" 1 "forwprop1"} } */ +/* { dg-final { cleanup-tree-dump "forwprop1" } } */ + +/* After cddce we should have two IF statements remaining as the other + two tests can be threaded. */ +/* { dg-final { scan-tree-dump-times "if " 2 "cddce"} } */ +/* { dg-final { cleanup-tree-dump "cddce" } } */
20040305-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: loop-14.c =================================================================== --- loop-14.c (nonexistent) +++ loop-14.c (revision 816) @@ -0,0 +1,19 @@ +/* A test for final value replacement. */ + +/* { dg-options "-O2 -fdump-tree-optimized" } */ + +int foo(void); + +int bla(void) +{ + int i, j = foo (); + + for (i = 0; i < 100; i++, j++) + foo (); + + /* Should be replaced with return j0 + 100; */ + return j; +} + +/* { dg-final { scan-tree-dump-times "\\+ 100" 1 "optimized" } } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */
loop-14.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20040703-1.c =================================================================== --- 20040703-1.c (nonexistent) +++ 20040703-1.c (revision 816) @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-dom2" } */ + +float foo(float x) +{ + x += 1; + x -= 1; + return x; +} + +/* We should *not* fold the arithmetic. */ +/* { dg-final { scan-tree-dump-times "0\\.0" 0 "dom2"} } */ +/* { dg-final { cleanup-tree-dump "dom2" } } */
20040703-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20030821-1.c =================================================================== --- 20030821-1.c (nonexistent) +++ 20030821-1.c (revision 816) @@ -0,0 +1,28 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-dom1 -fdump-tree-optimized" } */ + +void foo(int k) +{ + int i = 1; + void *label; + + label = k ? &&x : &&y; + + if (k == 1) + goto *label; + + i = 0; + goto z; +z: +x: + if (i) + dont_remove (); +y: ; +} + +/* { dg-final { scan-tree-dump-times "dont_remove \\(\\)" 1 "optimized"} } */ + +/* We should have folded away the goto &x */ +/* { dg-final { scan-tree-dump-times "goto &x" 0 "optimized"} } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */ +/* { dg-final { cleanup-tree-dump "dom1" } } */
20030821-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: bool-5.c =================================================================== --- bool-5.c (nonexistent) +++ bool-5.c (revision 816) @@ -0,0 +1,19 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-optimized" } */ + +int f(_Bool x) +{ + if (x == 1) + return 1; + return 0; +} + +/* There should be no == 1 which is produced by the front-end as + bool_var == 1 is the same as bool_var. */ +/* { dg-final { scan-tree-dump-times "== 1" 0 "optimized"} } */ + +/* There should be no adde for powerpc. Check if we actually optimized + away the comparison. */ +/* { dg-final { scan-assembler-times "adde" 0 { target powerpc*-*-* } } } */ + +/* { dg-final { cleanup-tree-dump "optimized" } } */
bool-5.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: foldcast-1.c =================================================================== --- foldcast-1.c (nonexistent) +++ foldcast-1.c (revision 816) @@ -0,0 +1,16 @@ +/* { dg-do "compile" } */ +/* { dg-options "-fdump-tree-original" } */ + +typedef int ssize_t __attribute__((mode(pointer))); +ssize_t foo (ssize_t x) +{ + return (ssize_t)(char *)x; +} + +char *bar (char *x) +{ + return (char *)(ssize_t)x; +} + +/* { dg-final { scan-tree-dump-times "return x;" 2 "original" } } */ +/* { dg-final { cleanup-tree-dump "original" } } */
foldcast-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20040326-2.c =================================================================== --- 20040326-2.c (nonexistent) +++ 20040326-2.c (revision 816) @@ -0,0 +1,64 @@ +/* { dg-options "-O2 -fno-inline-functions" } */ +/* { dg-do run } */ + +/* Gimplification problem exposed by zsh. All the side-effects in + function arguments and in the called expression should happen + before the actual function call. */ +extern void abort (void); +int A; + +typedef void (*fnptr) (void); +fnptr *F; + +void +foo (int x) +{ + if (A == x) + abort (); +} + +void +bar (int x, int y) +{ + if (x == 5 || y != 3) + abort (); +} + +void +boz (void) +{ + abort (); +} + +void +baz (void) +{ + if (*F != boz) + abort (); +} + +fnptr B[2] = { baz, boz }; + +main () +{ + int b, c; + + /* The gimplifier was emitting A++ after the call to foo. */ + A = 5; + foo (A++); + + /* The increment to 'b' and 'c' must happen before the call. However, + the first argument to bar() must be the original value of 'b', while + the second argument must be the new value of 'c'. */ + b = 4; + c = 2; + bar (b++, ++c); + + /* This call via function pointer *F should go to baz, but F should + be incremented before the actual call (i.e., right before the + call F should be pointing to boz). */ + F = &B[0]; + (*F++) (); + + return 0; +}
20040326-2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20030825-1.c =================================================================== --- 20030825-1.c (nonexistent) +++ 20030825-1.c (revision 816) @@ -0,0 +1,29 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-optimized" } */ + +void bla(void); + +void +foo(int c, int d) +{ + goto skip; + +ebef: + goto xxx; + +skip: + + if (c) + { +xxx:; + if (!c) + bla (); + } + + if (d) + goto ebef; +} + +/* Bla should not be optimized away. */ +/* { dg-final { scan-tree-dump-times "bla" 1 "optimized"} } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */
20030825-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ifc-20040816-1.c =================================================================== --- ifc-20040816-1.c (nonexistent) +++ ifc-20040816-1.c (revision 816) @@ -0,0 +1,37 @@ +/* { dg-do compile } */ +/* { dg-options "-c -O2 -ftree-vectorize -fdump-tree-ifcvt-stats" { target *-*-* } } */ + +#include +#include + +#define N 16 +#define MAX 42 + +extern void abort(void); + +int main1 () +{ + int A[N] = {36,39,42,45,43,32,21,12,23,34,45,56,67,78,89,11}; + + int i, j; + + for (i = 0; i < N; i++) + { + j = A[i]; + A[i] = ( j >= MAX ? MAX : 0); + } + + /* check results: */ + for (i = 0; i < N; i++) + { + if (A[i] > MAX) + abort (); + } + + return 0; +} + + + +/* { dg-final { scan-tree-dump-times "Applying if-conversion" 1 "ifcvt" } } */ +/* { dg-final { cleanup-tree-dump "ifcvt" } } */
ifc-20040816-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: reassoc-6.c =================================================================== --- reassoc-6.c (nonexistent) +++ reassoc-6.c (revision 816) @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-reassoc1" } */ +int main(int a, int b, int c, int d) +{ + /* Should be transformed into a + c + 8 */ + int e = a + 3; + int f = c + 5; + int g = e + f; + return g; +} + +/* { dg-final { scan-tree-dump-times "\\\+ 8" 1 "reassoc1"} } */ +/* { dg-final { cleanup-tree-dump "reassoc1" } } */
reassoc-6.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20030807-2.c =================================================================== --- 20030807-2.c (nonexistent) +++ 20030807-2.c (revision 816) @@ -0,0 +1,28 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -ftree-vrp -fdump-tree-dom3" } */ + +extern void abort (void); + +oof () +{ + int live_head; + int * live = &live_head; + + if (live) + bitmap_clear (live); +} + +foo(int n) +{ + int *space = (int *)__builtin_alloca (n); + + if (space == 0) + abort (); + else + bar (space); +} + + +/* There should be no IF conditionals. */ +/* { dg-final { scan-tree-dump-times "if " 0 "dom3" } } */ +/* { dg-final { cleanup-tree-dump "dom3" } } */
20030807-2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20030709-1.c =================================================================== --- 20030709-1.c (nonexistent) +++ 20030709-1.c (revision 816) @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-optimized" } */ + +static int copying_arguments; + +int +foo () +{ + unsigned int regno; + if (regno < 53 && copying_arguments) + if (regno >= 53) + return 1; +} + +/* There should be no IF conditionals. */ +/* { dg-final { scan-tree-dump-times "if " 0 "optimized"} } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */
20030709-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ltrans-2.c =================================================================== --- ltrans-2.c (nonexistent) +++ ltrans-2.c (revision 816) @@ -0,0 +1,26 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -ftree-loop-linear -fdump-tree-ltrans-all" } */ +/* { dg-require-effective-target size32plus } */ + +double u[1782225]; +int foo(int N, int *res) +{ + unsigned int i, j; + double sum = 0; + + /* This loop should be converted to a perfect nest and + interchanged. */ + for (i = 0; i < N; i++) + { + for (j = 0; j < N; j++) + { + sum = sum + u[i + 1335 * j]; + if (j == N - 1) + u[1336 * i] *= 2; + } + } + *res = sum + N; +} +/* { dg-final { scan-tree-dump-times "transformed loop" 1 "ltrans"} { + xfail *-*-*} } */ +/* { dg-final { cleanup-tree-dump "ltrans" } } */
ltrans-2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ssa-dse-7.c =================================================================== --- ssa-dse-7.c (nonexistent) +++ ssa-dse-7.c (revision 816) @@ -0,0 +1,23 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-dse1" } */ + +int glob1, glob2; + +int foo1 (void) +{ + glob1 = 0; + glob2 = 1; + glob1 = 2; + glob2 = 3; + return glob1 + glob2; +} + + + +/* There should only be one assignment to glob1 and glob2, the final + return statement should just return a constant. */ +/* { dg-final { scan-tree-dump-times "glob1 = " 1 "dse1"} } */ +/* { dg-final { scan-tree-dump-times "glob2 = " 1 "dse1"} } */ +/* { dg-final { scan-tree-dump-times "return 5" 1 "dse1"} } */ + +/* { dg-final { cleanup-tree-dump "dse1" } } */
ssa-dse-7.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: recip-4.c =================================================================== --- recip-4.c (nonexistent) +++ recip-4.c (revision 816) @@ -0,0 +1,45 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fno-trapping-math -funsafe-math-optimizations -fdump-tree-recip" } */ + +/* based on the test case in pr23109 */ + +double F[2] = { 0., 0. }, e = 0.; + +/* Nope, we cannot prove the optimization is worthwhile in this case. */ +void f () +{ + int i; + double E, W, P, d; + + W = 1.; + d = 2.*e; + E = 1. - d; + + if( d > 0.01 ) + { + P = ( W < E ) ? (W - E)/d : (E - W)/d; + F[i] += P; + } +} + +/* We also cannot prove the optimization is worthwhile in this case. */ +float g () +{ + int i; + double E, W, P, d; + + W = 1.; + d = 2.*e; + E = 1. - d; + + if( d > 0.01 ) + { + P = ( W < E ) ? (W - E)/d : (E - W)/d; + F[i] += P; + } + + return 1.0 / d; +} + +/* { dg-final { scan-tree-dump-not "reciptmp" "recip" } } */ +/* { dg-final { cleanup-tree-dump "recip" } } */
recip-4.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: loadpre1.c =================================================================== --- loadpre1.c (nonexistent) +++ loadpre1.c (revision 816) @@ -0,0 +1,18 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-pre-stats" } */ +int main(int *a, int argc) +{ + int c; + int d, e; + + /* Should be able to eliminate the second load of *a along the main path. */ + d = *a; + if (argc) + { + a = &c; + } + e = *a; + return d + e; +} +/* { dg-final { scan-tree-dump-times "Eliminated: 1" 1 "pre" { xfail *-*-* } } } */ +/* { dg-final { cleanup-tree-dump "pre" } } */
loadpre1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: loop-2.c =================================================================== --- loop-2.c (nonexistent) +++ loop-2.c (revision 816) @@ -0,0 +1,44 @@ +/* A test for strength reduction and induction variable elimination. */ + +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-optimized" } */ +/* { dg-require-effective-target size32plus } */ + +/* Size of this structure should be sufficiently weird so that no memory + addressing mode applies. */ + +struct bla +{ + char x[187]; + int y; + char z[253]; +} arr_base[100]; + +void xxx(void) +{ + int iter; + + for (iter = 0; iter < 100; iter++) + arr_base[iter].y = 17 * iter; +} + +/* Access to arr_base[iter].y should be strength reduced, i.e., there should + be no multiplication. */ + +/* { dg-final { scan-tree-dump-times " \\* \[^\\n\\r\]*=" 0 "optimized" } } */ +/* { dg-final { scan-tree-dump-times "\[^\\n\\r\]*= \\* " 0 "optimized" } } */ +/* { dg-final { scan-tree-dump-times "MEM" 1 "optimized" } } */ + +/* 17 * iter should be strength reduced. */ + +/* { dg-final { scan-tree-dump-times " \\* 17" 0 "optimized" } } */ +/* { dg-final { scan-tree-dump-times " \\+ 17" 1 "optimized" } } */ + +/* The induction variable comparison with 99 should be eliminated + and replaced by comparison of one of the newly created ivs. */ + +/* { dg-final { scan-tree-dump-times "iter" 0 "optimized" } } */ +/* { dg-final { scan-tree-dump-times "99" 0 "optimized" } } */ +/* { dg-final { scan-tree-dump-times "100" 0 "optimized" } } */ + +/* { dg-final { cleanup-tree-dump "optimized" } } */
loop-2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: vrp13.c =================================================================== --- vrp13.c (nonexistent) +++ vrp13.c (revision 816) @@ -0,0 +1,258 @@ +/* { dg-do run } */ +/* { dg-options -O2 } */ + +extern void abort (void); + +foo_div (int i, int j) +{ + int k; + + /* [-INF, -1] / [1, +INF] should not give [-1, -1]. */ + if (i <= -1) + if (j >= 1) + { + k = i / j; + if (k == -1) + abort (); + + return k; + } + + /* [-20, -10] / [2, 10] should give [-10, -1]. */ + if (i >= -20) + if (i <= -10) + if (j >= 2) + if (j <= 10) + { + k = i / j; + if (k < -10) + link_error (); + if (k > -1) + link_error (); + + return k; + } + + /* [-20, -10] / [-10, -2] should give [1, 10]. */ + if (i >= -20) + if (i <= -10) + if (j >= -10) + if (j <= -2) + { + k = i / j; + if (k < 1) + link_error (); + if (k > 10) + link_error (); + + return k; + } + + /* [-20, 10] / [2, 10] should give [-10, 5]. */ + if (i >= -20) + if (i <= 10) + if (j >= 2) + if (j <= 10) + { + k = i / j; + if (k < -10) + link_error (); + if (k > 5) + link_error (); + + return k; + } + + /* [-20, 10] / [-10, -2] should give [-5, 10]. */ + if (i >= -20) + if (i <= 10) + if (j >= -10) + if (j <= -2) + { + k = i / j; + if (k < -5) + link_error (); + if (k > 10) + link_error (); + + return k; + } + + /* [10, 20] / [2, 10] should give [1, 10]. */ + if (i >= 10) + if (i <= 20) + if (j >= 2) + if (j <= 10) + { + k = i / j; + if (k < 1) + link_error (); + if (k > 10) + link_error (); + + return k; + } + + /* [10, 20] / [-10, -2] should give [-10, -1]. */ + if (i >= 10) + if (i <= 20) + if (j >= -10) + if (j <= -2) + { + k = i / j; + if (k > -1) + link_error (); + if (k < -10) + link_error (); + + return k; + } + + abort (); +} + + +foo_mult (int i, int j) +{ + int k; + + /* [-20, -10] * [2, 10] should give [-200, -20]. */ + if (i >= -20) + if (i <= -10) + if (j >= 2) + if (j <= 10) + { + k = i * j; + if (k < -200) + link_error (); + if (k > -20) + link_error (); + + return k; + } + + /* [-20, -10] * [-10, -2] should give [20, 200]. */ + if (i >= -20) + if (i <= -10) + if (j >= -10) + if (j <= -2) + { + k = i * j; + if (k < 20) + link_error (); + if (k > 200) + link_error (); + + return k; + } + + /* [-20, 10] * [2, 10] should give [-200, 100]. */ + if (i >= -20) + if (i <= 10) + if (j >= 2) + if (j <= 10) + { + k = i * j; + if (k < -200) + link_error (); + if (k > 100) + link_error (); + + return k; + } + + /* [-20, 10] * [-10, -2] should give [-100, 200]. */ + if (i >= -20) + if (i <= 10) + if (j >= -10) + if (j <= -2) + { + k = i * j; + if (k < -100) + link_error (); + if (k > 200) + link_error (); + + return k; + } + + /* [10, 20] * [2, 10] should give [20, 200]. */ + if (i >= 10) + if (i <= 20) + if (j >= 2) + if (j <= 10) + { + k = i * j; + if (k < 20) + link_error (); + if (k > 200) + link_error (); + + return k; + } + + /* [10, 20] * [-10, -2] should give [-200, -20]. */ + if (i >= 10) + if (i <= 20) + if (j >= -10) + if (j <= -2) + { + k = i * j; + if (k < -200) + link_error (); + if (k > -20) + link_error (); + + return k; + } + + abort (); +} + + +main() +{ + if (foo_div (-10, 5) != -2) + abort (); + + if (foo_div (-16, 4) != -4) + abort (); + + if (foo_div (-15, -5) != 3) + abort (); + + if (foo_div (8, 2) != 4) + abort (); + + if (foo_div (10, -2) != -5) + abort (); + + if (foo_div (20, 5) != 4) + abort (); + + if (foo_div (15, -3) != -5) + abort (); + + if (foo_mult (-10, 5) != -50) + abort (); + + if (foo_mult (-16, 4) != -64) + abort (); + + if (foo_mult (-15, -5) != 75) + abort (); + + if (foo_mult (8, 2) != 16) + abort (); + + if (foo_mult (10, -2) != -20) + abort (); + + if (foo_mult (20, 5) != 100) + abort (); + + if (foo_mult (15, -3) != -45) + abort (); + + return 0; +}
vrp13.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: inline-1.c =================================================================== --- inline-1.c (nonexistent) +++ inline-1.c (revision 816) @@ -0,0 +1,25 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-final_cleanup" } */ + + +typedef struct { + double min; + double max; +} interval; +inline interval add(interval x, interval y) __attribute__((always_inline)); +inline interval add(interval x, interval y) +{ + interval r; + r.min = x.min + y.min; + r.max = x.max + y.max; + return r; +} +interval foo (interval a, interval b, interval c) +{ + return add (a, add (b, c)); +} + + +/* { dg-final { scan-tree-dump-times "\\(struct interval\\)" 0 "final_cleanup"} } */ +/* { dg-final { cleanup-tree-dump "final_cleanup" } } */ +
inline-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pr19210-1.c =================================================================== --- pr19210-1.c (nonexistent) +++ pr19210-1.c (revision 816) @@ -0,0 +1,29 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -Wunsafe-loop-optimizations" } */ +extern void g(void); + +void +f (unsigned n) +{ + unsigned k; + for(k = 0;k <= n;k++) /* { dg-warning "cannot optimize.*infinite loops" } */ + g(); + + for(k = 0;k <= n;k += 4) /* { dg-warning "cannot optimize.*overflow" } */ + g(); + + /* We used to get warning for this loop. However, since then # of iterations + analysis improved, and we can now prove that this loop does not verflow. + This is because the only case when it would overflow is if n = ~0 (since + ~0 is divisible by 5), and this cannot be the case, since when we got + here, the previous loop exited, thus there exists k > n. */ + for(k = 5;k <= n;k += 5) + g(); + + /* So we need the following loop, instead. */ + for(k = 4;k <= n;k += 5) /* { dg-warning "cannot optimize.*overflow" } */ + g(); + + for(k = 15;k >= n;k--) /* { dg-warning "cannot optimize.*infinite" } */ + g(); +}
pr19210-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pr22026.c =================================================================== --- pr22026.c (nonexistent) +++ pr22026.c (revision 816) @@ -0,0 +1,49 @@ +/* PR tree-optimization/22026 + VRP used think that ~[0,0] + ~[0,0] = ~[0,0], which is wrong. The + same applies to subtraction and unsigned multiplication. */ + +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-vrp1" } */ + +int +plus (int x, int y) +{ + if (x != 0) + if (y != 0) + { + int z = x + y; + if (z != 0) + return 1; + } + return 0; +} + +int +minus (int x, int y) +{ + if (x != 0) + if (y != 0) + { + int z = x - y; + if (z != 0) + return 1; + } + return 0; +} + +int +mult (unsigned x, unsigned y) +{ + if (x != 0) + if (y != 0) + { + unsigned z = x * y; + if (z != 0) + return 1; + } + return 0; +} + +/* None of the predicates can be folded in these functions. */ +/* { dg-final { scan-tree-dump-times "Folding predicate" 0 "vrp1" } } */ +/* { dg-final { cleanup-tree-dump "vrp1" } } */
pr22026.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: foldaddr-1.c =================================================================== --- foldaddr-1.c (nonexistent) +++ foldaddr-1.c (revision 816) @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-original" } */ + + +char *a; +int foo(char *b) +{ + return a+5+(long)b == (long)b+a; +} + +/* Folding should have determined that the two addresses were + not identical and thus collapsed the function into a trivial + "return 0". */ +/* { dg-final { scan-tree-dump-times "return 0" 1 "original"} } */ +/* { dg-final { cleanup-tree-dump "original" } } */ +
foldaddr-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pr16721.c =================================================================== --- pr16721.c (nonexistent) +++ pr16721.c (revision 816) @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fno-strict-aliasing -fdump-tree-optimized" } */ + +struct data { + volatile unsigned long *addr; +} *p; + +int test() +{ + *p->addr; + return 0; +} + +/* The load from p->addr should not disappear. */ +/* { dg-final { scan-tree-dump-times "\->addr" 1 "optimized"} } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */
pr16721.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: stdarg-2.c =================================================================== --- stdarg-2.c (nonexistent) +++ stdarg-2.c (revision 816) @@ -0,0 +1,298 @@ +/* First dg-final line after each function is for architectures that use + a struct {...} va_list[1] with separate GPR and FPR counters in the + structure. Second dg-final line is for architectures that use void * + or char * va_list. */ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-stdarg" } */ + +#include + +extern void foo (int, va_list); +extern void bar (int); +long x; +double d; +va_list gap; +va_list *pap; + +void +f1 (int i, ...) +{ + va_list ap; + va_start (ap, i); + va_end (ap); +} +/* { dg-final { scan-tree-dump "f1: va_list escapes 0, needs to save 0 GPR units and 0 FPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && lp64 } } } } */ +/* { dg-final { scan-tree-dump "f1: va_list escapes 0, needs to save 0 GPR units and 0 FPR units" "stdarg" { target { powerpc*-*-linux* && ilp32 } } } } */ +/* { dg-final { scan-tree-dump "f1: va_list escapes 0, needs to save 0 GPR units and 0 FPR units" "stdarg" { target alpha*-*-linux* } } } */ +/* { dg-final { scan-tree-dump "f1: va_list escapes 0, needs to save 0 GPR units and 0 FPR units" "stdarg" { target s390*-*-linux* } } } */ +/* { dg-final { scan-tree-dump "f1: va_list escapes 0, needs to save 0 GPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } } */ +/* { dg-final { scan-tree-dump "f1: va_list escapes 0, needs to save 0 GPR units" "stdarg" { target ia64-*-* } } } */ +/* { dg-final { scan-tree-dump "f1: va_list escapes 0, needs to save 0 GPR units" "stdarg" { target { powerpc*-*-* && lp64 } } } } */ + +void +f2 (int i, ...) +{ + va_list ap; + va_start (ap, i); + bar (d); + x = va_arg (ap, long); + bar (x); + va_end (ap); +} +/* Assume the counters can be number of registers or bytes on 32-bit + architecture or bytes on 64-bit architecture. */ +/* { dg-final { scan-tree-dump "f2: va_list escapes 0, needs to save \[148\] GPR units and 0 FPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && lp64 } } } } */ +/* { dg-final { scan-tree-dump "f2: va_list escapes 0, needs to save \[148\] GPR units and 0 FPR units" "stdarg" { target { powerpc*-*-linux* && ilp32 } } } } */ +/* { dg-final { scan-tree-dump "f2: va_list escapes 0, needs to save 8 GPR units and 1" "stdarg" { target alpha*-*-linux* } } } */ +/* { dg-final { scan-tree-dump "f2: va_list escapes 0, needs to save 1 GPR units and 0 FPR units" "stdarg" { target s390*-*-linux* } } } */ +/* { dg-final { scan-tree-dump "f2: va_list escapes 0, needs to save \[148\] GPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } } */ +/* { dg-final { scan-tree-dump "f2: va_list escapes 0, needs to save \[148\] GPR units" "stdarg" { target ia64-*-* } } } */ +/* { dg-final { scan-tree-dump "f2: va_list escapes 0, needs to save \[148\] GPR units" "stdarg" { target { powerpc*-*-* && lp64 } } } } */ + +void +f3 (int i, ...) +{ + va_list ap; + va_start (ap, i); + d = va_arg (ap, double); + va_end (ap); +} +/* { dg-final { scan-tree-dump "f3: va_list escapes 0, needs to save 0 GPR units and \[1-9\]\[0-9\]* FPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && lp64 } } } } */ +/* { dg-final { scan-tree-dump "f3: va_list escapes 0, needs to save 0 GPR units and \[1-9\]\[0-9\]* FPR units" "stdarg" { target { powerpc*-*-linux* && { powerpc_fprs && ilp32 } } } } } */ +/* { dg-final { scan-tree-dump "f3: va_list escapes 0, needs to save 0 GPR units and 1 FPR units" "stdarg" { target s390*-*-linux* } } } */ +/* { dg-final { scan-tree-dump "f3: va_list escapes 0, needs to save 8 GPR units and 2" "stdarg" { target alpha*-*-linux* } } } */ +/* { dg-final { scan-tree-dump "f3: va_list escapes 0, needs to save \[1-9\]\[0-9\]* GPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } } */ +/* { dg-final { scan-tree-dump "f3: va_list escapes 0, needs to save \[1-9\]\[0-9\]* GPR units" "stdarg" { target ia64-*-* } } } */ +/* { dg-final { scan-tree-dump "f3: va_list escapes 0, needs to save \[1-9\]\[0-9\]* GPR units" "stdarg" { target { powerpc*-*-* && lp64 } } } } */ + +void +f4 (int i, ...) +{ + va_list ap; + va_start (ap, i); + x = va_arg (ap, double); + foo (i, ap); + va_end (ap); +} +/* { dg-final { scan-tree-dump "f4: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && lp64 } } } } */ +/* { dg-final { scan-tree-dump "f4: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target { powerpc*-*-linux* && ilp32 } } } } */ +/* { dg-final { scan-tree-dump "f4: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target alpha*-*-linux* } } } */ +/* { dg-final { scan-tree-dump "f4: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target s390*-*-linux* } } } */ +/* { dg-final { scan-tree-dump "f4: va_list escapes 1, needs to save all GPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } } */ +/* { dg-final { scan-tree-dump "f4: va_list escapes 1, needs to save all GPR units" "stdarg" { target ia64-*-* } } } */ +/* { dg-final { scan-tree-dump "f4: va_list escapes 1, needs to save all GPR units" "stdarg" { target { powerpc*-*-* && lp64 } } } } */ + +void +f5 (int i, ...) +{ + va_list ap; + va_start (ap, i); + va_copy (gap, ap); + bar (i); + va_end (ap); + va_end (gap); +} +/* { dg-final { scan-tree-dump "f5: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && lp64 } } } } */ +/* { dg-final { scan-tree-dump "f5: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target { powerpc*-*-linux* && ilp32 } } } } */ +/* { dg-final { scan-tree-dump "f5: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target alpha*-*-linux* } } } */ +/* { dg-final { scan-tree-dump "f5: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target s390*-*-linux* } } } */ +/* { dg-final { scan-tree-dump "f5: va_list escapes 1, needs to save all GPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } } */ +/* { dg-final { scan-tree-dump "f5: va_list escapes 1, needs to save all GPR units" "stdarg" { target ia64-*-* } } } */ +/* { dg-final { scan-tree-dump "f5: va_list escapes 1, needs to save all GPR units" "stdarg" { target { powerpc*-*-* && lp64 } } } } */ + +void +f6 (int i, ...) +{ + va_list ap; + va_start (ap, i); + bar (d); + va_arg (ap, long); + va_arg (ap, long); + x = va_arg (ap, long); + bar (x); + va_end (ap); +} +/* { dg-final { scan-tree-dump "f6: va_list escapes 0, needs to save (3|12|24) GPR units and 0 FPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && lp64 } } } } */ +/* { dg-final { scan-tree-dump "f6: va_list escapes 0, needs to save (3|12|24) GPR units and 0 FPR units" "stdarg" { target { powerpc*-*-linux* && ilp32 } } } } */ +/* { dg-final { scan-tree-dump "f6: va_list escapes 0, needs to save 24 GPR units and 1" "stdarg" { target alpha*-*-linux* } } } */ +/* { dg-final { scan-tree-dump "f6: va_list escapes 0, needs to save 3 GPR units and 0 FPR units" "stdarg" { target s390*-*-linux* } } } */ +/* { dg-final { scan-tree-dump "f6: va_list escapes 0, needs to save (3|12|24) GPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } } */ +/* { dg-final { scan-tree-dump "f6: va_list escapes 0, needs to save (3|12|24) GPR units" "stdarg" { target ia64-*-* } } } */ +/* { dg-final { scan-tree-dump "f6: va_list escapes 0, needs to save (3|12|24) GPR units" "stdarg" { target { powerpc*-*-* && lp64 } } } } */ + +void +f7 (int i, ...) +{ + va_list ap; + va_start (ap, i); + pap = ≈ + bar (6); + va_end (ap); +} +/* { dg-final { scan-tree-dump "f7: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && lp64 } } } } */ +/* { dg-final { scan-tree-dump "f7: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target { powerpc*-*-linux* && ilp32 } } } } */ +/* { dg-final { scan-tree-dump "f7: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target alpha*-*-linux* } } } */ +/* { dg-final { scan-tree-dump "f7: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target s390*-*-linux* } } } */ +/* { dg-final { scan-tree-dump "f7: va_list escapes 1, needs to save all GPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } } */ +/* { dg-final { scan-tree-dump "f7: va_list escapes 1, needs to save all GPR units" "stdarg" { target ia64-*-* } } } */ +/* { dg-final { scan-tree-dump "f7: va_list escapes 1, needs to save all GPR units" "stdarg" { target { powerpc*-*-* && lp64 } } } } */ + +void +f8 (int i, ...) +{ + va_list ap; + va_start (ap, i); + pap = ≈ + bar (d); + x = va_arg (ap, long); + bar (x); + va_end (ap); +} +/* { dg-final { scan-tree-dump "f8: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && lp64 } } } } */ +/* { dg-final { scan-tree-dump "f8: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target { powerpc*-*-linux* && ilp32 } } } } */ +/* { dg-final { scan-tree-dump "f8: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target alpha*-*-linux* } } } */ +/* { dg-final { scan-tree-dump "f8: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target s390*-*-linux* } } } */ +/* { dg-final { scan-tree-dump "f8: va_list escapes 1, needs to save all GPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } } */ +/* { dg-final { scan-tree-dump "f8: va_list escapes 1, needs to save all GPR units" "stdarg" { target ia64-*-* } } } */ +/* { dg-final { scan-tree-dump "f8: va_list escapes 1, needs to save all GPR units" "stdarg" { target { powerpc*-*-* && lp64 } } } } */ + +void +f9 (int i, ...) +{ + va_list ap; + va_start (ap, i); + __asm __volatile ("" : "=r" (pap) : "0" (&ap)); + bar (6); + va_end (ap); +} +/* { dg-final { scan-tree-dump "f9: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && lp64 } } } } */ +/* { dg-final { scan-tree-dump "f9: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target { powerpc*-*-linux* && ilp32 } } } } */ +/* { dg-final { scan-tree-dump "f9: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target alpha*-*-linux* } } } */ +/* { dg-final { scan-tree-dump "f9: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target s390*-*-linux* } } } */ +/* { dg-final { scan-tree-dump "f9: va_list escapes 1, needs to save all GPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } } */ +/* { dg-final { scan-tree-dump "f9: va_list escapes 1, needs to save all GPR units" "stdarg" { target ia64-*-* } } } */ +/* { dg-final { scan-tree-dump "f9: va_list escapes 1, needs to save all GPR units" "stdarg" { target { powerpc*-*-* && lp64 } } } } */ + +void +f10 (int i, ...) +{ + va_list ap; + va_start (ap, i); + __asm __volatile ("" : "=r" (pap) : "0" (&ap)); + bar (d); + x = va_arg (ap, long); + bar (x); + va_end (ap); +} +/* { dg-final { scan-tree-dump "f10: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && lp64 } } } } */ +/* { dg-final { scan-tree-dump "f10: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target { powerpc*-*-linux* && ilp32 } } } } */ +/* { dg-final { scan-tree-dump "f10: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target alpha*-*-linux* } } } */ +/* { dg-final { scan-tree-dump "f10: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target s390*-*-linux* } } } */ +/* { dg-final { scan-tree-dump "f10: va_list escapes 1, needs to save all GPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } } */ +/* { dg-final { scan-tree-dump "f10: va_list escapes 1, needs to save all GPR units" "stdarg" { target ia64-*-* } } } */ +/* { dg-final { scan-tree-dump "f10: va_list escapes 1, needs to save all GPR units" "stdarg" { target { powerpc*-*-* && lp64 } } } } */ + +void +f11 (int i, ...) +{ + va_list ap; + va_start (ap, i); + bar (d); + x = va_arg (ap, long); + x += va_arg (ap, long); + x += va_arg (ap, long); + bar (x); + va_end (ap); +} +/* { dg-final { scan-tree-dump "f11: va_list escapes 0, needs to save (3|12|24) GPR units and 0 FPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && lp64 } } } } */ +/* { dg-final { scan-tree-dump "f11: va_list escapes 0, needs to save (3|12|24) GPR units and 0 FPR units" "stdarg" { target { powerpc*-*-linux* && ilp32 } } } } */ +/* { dg-final { scan-tree-dump "f11: va_list escapes 0, needs to save 24 GPR units and 1" "stdarg" { target alpha*-*-linux* } } } */ +/* { dg-final { scan-tree-dump "f11: va_list escapes 0, needs to save 3 GPR units and 0 FPR units" "stdarg" { target s390*-*-linux* } } } */ +/* { dg-final { scan-tree-dump "f11: va_list escapes 0, needs to save (3|12|24) GPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } } */ +/* { dg-final { scan-tree-dump "f11: va_list escapes 0, needs to save (3|12|24) GPR units" "stdarg" { target ia64-*-* } } } */ +/* { dg-final { scan-tree-dump "f11: va_list escapes 0, needs to save (3|12|24) GPR units" "stdarg" { target { powerpc*-*-* && lp64 } } } } */ + +void +f12 (int i, ...) +{ + va_list ap; + va_start (ap, i); + bar (d); + va_arg (ap, double); + va_arg (ap, double); + x = va_arg (ap, double); + bar (x); + va_end (ap); +} +/* { dg-final { scan-tree-dump "f12: va_list escapes 0, needs to save 0 GPR units and \[1-9\]\[0-9\]* FPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && lp64 } } } } */ +/* { dg-final { scan-tree-dump "f12: va_list escapes 0, needs to save 0 GPR units and \[1-9\]\[0-9\]* FPR units" "stdarg" { target { powerpc*-*-linux* && { powerpc_fprs && ilp32 } } } } } */ +/* { dg-final { scan-tree-dump "f12: va_list escapes 0, needs to save 24 GPR units and 2" "stdarg" { target alpha*-*-linux* } } } */ +/* { dg-final { scan-tree-dump "f12: va_list escapes 0, needs to save 0 GPR units and 3 FPR units" "stdarg" { target s390*-*-linux* } } } */ +/* { dg-final { scan-tree-dump "f12: va_list escapes 0, needs to save \[1-9]\[0-9\]* GPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } } */ +/* { dg-final { scan-tree-dump "f12: va_list escapes 0, needs to save \[1-9]\[0-9\]* GPR units" "stdarg" { target ia64-*-* } } } */ +/* { dg-final { scan-tree-dump "f12: va_list escapes 0, needs to save \[1-9]\[0-9\]* GPR units" "stdarg" { target { powerpc*-*-* && lp64 } } } } */ + +void +f13 (int i, ...) +{ + va_list ap; + va_start (ap, i); + bar (d); + x = va_arg (ap, double); + x += va_arg (ap, double); + x += va_arg (ap, double); + bar (x); + va_end (ap); +} +/* { dg-final { scan-tree-dump "f13: va_list escapes 0, needs to save 0 GPR units and \[1-9\]\[0-9\]* FPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && lp64 } } } } */ +/* { dg-final { scan-tree-dump "f13: va_list escapes 0, needs to save 0 GPR units and \[1-9\]\[0-9\]* FPR units" "stdarg" { target { powerpc*-*-linux* && { powerpc_fprs && ilp32 } } } } } */ +/* { dg-final { scan-tree-dump "f13: va_list escapes 0, needs to save 24 GPR units and 2" "stdarg" { target alpha*-*-linux* } } } */ +/* { dg-final { scan-tree-dump "f13: va_list escapes 0, needs to save 0 GPR units and 3 FPR units" "stdarg" { target s390*-*-linux* } } } */ +/* { dg-final { scan-tree-dump "f13: va_list escapes 0, needs to save \[1-9]\[0-9\]* GPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } } */ +/* { dg-final { scan-tree-dump "f13: va_list escapes 0, needs to save \[1-9]\[0-9\]* GPR units" "stdarg" { target ia64-*-* } } } */ +/* { dg-final { scan-tree-dump "f13: va_list escapes 0, needs to save \[1-9]\[0-9\]* GPR units" "stdarg" { target { powerpc*-*-* && lp64 } } } } */ + +void +f14 (int i, ...) +{ + va_list ap; + va_start (ap, i); + bar (d); + x = va_arg (ap, double); + x += va_arg (ap, long); + x += va_arg (ap, double); + bar (x); + va_end (ap); +} +/* { dg-final { scan-tree-dump "f14: va_list escapes 0, needs to save \[148\] GPR units and \[1-9\]\[0-9\]* FPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && lp64 } } } } */ +/* { dg-final { scan-tree-dump "f14: va_list escapes 0, needs to save \[148\] GPR units and \[1-9\]\[0-9\]* FPR units" "stdarg" { target { powerpc*-*-linux* && { powerpc_fprs && ilp32 } } } } } */ +/* { dg-final { scan-tree-dump "f14: va_list escapes 0, needs to save 24 GPR units and 3" "stdarg" { target alpha*-*-linux* } } } */ +/* { dg-final { scan-tree-dump "f14: va_list escapes 0, needs to save 1 GPR units and 2 FPR units" "stdarg" { target s390*-*-linux* } } } */ +/* { dg-final { scan-tree-dump "f14: va_list escapes 0, needs to save \[1-9]\[0-9\]* GPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } } */ +/* { dg-final { scan-tree-dump "f14: va_list escapes 0, needs to save \[1-9]\[0-9\]* GPR units" "stdarg" { target ia64-*-* } } } */ +/* { dg-final { scan-tree-dump "f14: va_list escapes 0, needs to save \[1-9]\[0-9\]* GPR units" "stdarg" { target { powerpc*-*-* && lp64 } } } } */ + +inline void __attribute__((always_inline)) +f15_1 (va_list ap) +{ + x = va_arg (ap, double); + x += va_arg (ap, long); + x += va_arg (ap, double); +} + +void +f15 (int i, ...) +{ + va_list ap; + va_start (ap, i); + f15_1 (ap); + va_end (ap); +} +/* { dg-final { scan-tree-dump "f15: va_list escapes 0, needs to save \[148\] GPR units and \[1-9\]\[0-9\]* FPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && lp64 } } } } */ +/* { dg-final { scan-tree-dump "f15: va_list escapes 0, needs to save \[148\] GPR units and \[1-9\]\[0-9\]* FPR units" "stdarg" { target { powerpc*-*-linux* && { powerpc_fprs && ilp32 } } } } } */ +/* { dg-final { scan-tree-dump "f15: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target alpha*-*-linux* } } } */ +/* { dg-final { scan-tree-dump "f15: va_list escapes 0, needs to save 1 GPR units and 2 FPR units" "stdarg" { target s390*-*-linux* } } } */ +/* { dg-final { scan-tree-dump-not "f15: va_list escapes 0, needs to save 0 GPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } } */ +/* { dg-final { scan-tree-dump-not "f15: va_list escapes 0, needs to save 0 GPR units" "stdarg" { target ia64-*-* } } } */ +/* { dg-final { scan-tree-dump-not "f15: va_list escapes 0, needs to save 0 GPR units" "stdarg" { target { powerpc*-*-* && lp64 } } } } */ +/* { dg-final { cleanup-tree-dump "stdarg" } } */
stdarg-2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pr14841.c =================================================================== --- pr14841.c (nonexistent) +++ pr14841.c (revision 816) @@ -0,0 +1,29 @@ +/* PR tree-optimization/14841 + Make sure that we can fold a possible nested reference into a + constant aggregate. */ + +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-store_ccp-details" } */ + +struct car { + int speed; + int tire_pressure[4]; +}; + +static const struct car cars[] = { + { 75, { 10, 20, 30, 40 } }, + { 35, { 12, 34, 56, 78 } }, + { 40, { 19, 28, 37, 46 } } +}; + +extern void link_error (void); + +void +foo (void) +{ + if (cars[1].tire_pressure[2] != 56) + link_error (); +} + +/* { dg-final { scan-tree-dump-times "Folded statement: if " 1 "store_ccp"} } */ +/* { dg-final { cleanup-tree-dump "store_ccp" } } */
pr14841.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pta-fp.c =================================================================== --- pta-fp.c (nonexistent) +++ pta-fp.c (revision 816) @@ -0,0 +1,26 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-alias1" } */ +extern double cos (double); +extern double sin (double); +double f(double a) +{ + double b; + double c,d; + double (*fp) (double); + if (a < 2.0) + { + fp = sin; + c = fp (a); + } + else + { + c = 1.0; + fp = cos; + } + d = fp (a); + return d + c; +} +/* The points-to set of the final function pointer should be "sin cos" */ + +/* { dg-final { scan-tree-dump-times "{ sin cos }" 1 "alias1"} } */ +/* { dg-final { cleanup-tree-dump "alias1" } } */
pta-fp.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pr21658.c =================================================================== --- pr21658.c (nonexistent) +++ pr21658.c (revision 816) @@ -0,0 +1,21 @@ +/* PR tree-optimization/21658 + CCP did not propagate an ADDR_EXPR far enough, preventing the "if" + statement below from being folded. */ + +/* { dg-do compile } */ +/* { dg-options "-O2 -fno-tree-dominator-opts -fdump-tree-ccp-details" } */ + +void link_error (void); + +void +f (void) +{ + int a[10]; + int *p = &a[5]; + int *q = p - 1; + if (q != &a[4]) + link_error (); +} + +/* { dg-final { scan-tree-dump-times "Folded statement: if " 1 "ccp"} } */ +/* { dg-final { cleanup-tree-dump "ccp" } } */
pr21658.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pr15791-2.c =================================================================== --- pr15791-2.c (nonexistent) +++ pr15791-2.c (revision 816) @@ -0,0 +1,13 @@ +/* { dg-do link } */ +/* { dg-options "" } */ + +void link_error (); +struct a {}; +int main () +{ + struct a b[2]; + if (&b[0] != &b[1]) + link_error (); + return 0; +} +
pr15791-2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: alias-4.c =================================================================== --- alias-4.c (nonexistent) +++ alias-4.c (revision 816) @@ -0,0 +1,21 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-optimized" } */ + +struct { + int i; + struct { + int x[2]; + } b; +} a; + +int foo(void) +{ + a.i = 1; + a.b.x[0] = 0; + a.b.x[1] = 1; + return a.i + a.b.x[0]; +} + +/* { dg-final { scan-tree-dump "return 1;" "optimized" } } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */ +
alias-4.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20040430-1.c =================================================================== --- 20040430-1.c (nonexistent) +++ 20040430-1.c (revision 816) @@ -0,0 +1,26 @@ +/* PR middle-end/14470. Similar to + gcc.c-torture/execute/20040313-1.c, but with a compile time test to + make sure the second if() is removed. */ +/* Update: We now remove both ifs. Whee. */ + +/* { dg-do run } */ +/* { dg-options "-O2 -fdump-tree-optimized" } */ + + +extern void abort(void); + +int main() +{ + int t[1025] = { 1024 }, d; + + d = 0; + d = t[d]++; + if (t[0] != 1025) + abort(); + if (d != 1024) + abort(); + return 0; +} + +/* { dg-final { scan-tree-dump-times "if " 0 "optimized"} } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */
20040430-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20030710-1.c =================================================================== --- 20030710-1.c (nonexistent) +++ 20030710-1.c (revision 816) @@ -0,0 +1,55 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-dom3" } */ + +extern void abort (void); +union tree_node; +typedef union tree_node *tree; +struct tree_vec +{ + int length; + tree a[1]; +}; +struct tree_type +{ + tree binfo; +}; +union tree_node +{ + struct tree_type type; + struct tree_vec vec; +}; +void +record_component_aliases (type) + tree type; +{ + if (type->type.binfo->vec.length) + abort (); + for (; (( + { + const tree __z = type->type.binfo; + if (type->type.binfo->vec.length) + abort (); + type->type.binfo->vec.a[4];} + )->vec.length);) + { + if (4 >= type->type.binfo->vec.length) + abort (); + blah (); + } +} + +/* The call to blah should have been eliminated. If the call is not + eliminated, then dominator optimizations failed and it'll be + impossible to delete other unnecessary code. */ +/* { dg-final { scan-tree-dump-not "blah \\(\\)" "dom3" } } */ + +/* There should be two IF conditionals. */ +/* { dg-final { scan-tree-dump-times "if " 2 "dom3"} } */ + +/* There should be a single load of type.binfo. */ +/* { dg-final { scan-tree-dump-times "type\\.binfo" 1 "dom3"} } */ + +/* There should be two loads of vec.length. */ +/* { dg-final { scan-tree-dump-times "vec.length" 2 "dom3"} } */ + +/* { dg-final { cleanup-tree-dump "dom3" } } */
20030710-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: loadpre22.c =================================================================== --- loadpre22.c (nonexistent) +++ loadpre22.c (revision 816) @@ -0,0 +1,19 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-pre-stats" } */ +typedef int type[2]; +int main(type *a, int argc) +{ + int b; + int i; + int d, e; + + /* Should be able to hoist this out of the loop. */ + for (i = 0; i < argc; i++) + { + e = (*a)[argc]; + } + return d + e; +} + +/* { dg-final { scan-tree-dump-times "Eliminated: 1" 1 "pre"} } */ +/* { dg-final { cleanup-tree-dump "pre" } } */
loadpre22.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20030530-2.c =================================================================== --- 20030530-2.c (nonexistent) +++ 20030530-2.c (revision 816) @@ -0,0 +1,27 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-dom3" } */ + + +typedef struct rs6000_stack { + int first_gp_reg_save; +} rs6000_stack_t; +extern char regs_ever_live[113]; +extern rs6000_stack_t *rs6000_stack_info (void); +void +rs6000_emit_prologue (int i, rs6000_stack_t *info) +{ + if (regs_ever_live[info->first_gp_reg_save + i] || i+info->first_gp_reg_save) + gen_rtx_REG (info->first_gp_reg_save + i); +} + +/* There should be precisely one load of first_gp_reg_save. If there is + more than one, then the dominator optimizations failed. */ +/* { dg-final { scan-tree-dump-times "first_gp_reg_save" 1 "dom3"} } */ + +/* There should be precisely one addition. If there is more than one, then + the dominator optimizations failed, most likely due to not handling + commutative operands correctly. */ +/* { dg-final { scan-tree-dump-times "\\+" 1 "dom3"} } */ + +/* { dg-final { cleanup-tree-dump "dom3" } } */ +
20030530-2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: gen-vect-33.c =================================================================== --- gen-vect-33.c (nonexistent) +++ gen-vect-33.c (revision 816) @@ -0,0 +1,14 @@ +/* Compiler generates 64-bit stores of zero for this on some targets. + Check there is no problem for such case. */ +/* { dg-do compile } */ +/* { dg-options "-O2 -ftree-vectorize" } */ + +void +foo (float *dest, int xcount, int ycount) +{ + int x, y; + + for (y = 0; y < ycount; y++) + for (x = 0; x < xcount; x++) + dest[x + y] = (float) 0; +}
gen-vect-33.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20041008-1.c =================================================================== --- 20041008-1.c (nonexistent) +++ 20041008-1.c (revision 816) @@ -0,0 +1,38 @@ +/* { dg-do run } */ +/* { dg-options "-O2" } */ + +struct A { + int x; + int y; +}; + +baz (struct A *a) +{ + a->x = 3; + a->y = 2; +} + +foo (int i) +{ + struct A a; + + /* Make sure we can't scalarize 'a'. */ + baz (&a); + + if (i > 10) + a.x = i; + else + a.x = i; + + /* Copy propagation should prove that this predicate is always false. */ + if (a.x != i) + link_error (); + + return a.x; +} + +main () +{ + foo (30); + return 0; +}
20041008-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20030731-2.c =================================================================== --- 20030731-2.c (nonexistent) +++ 20030731-2.c (revision 816) @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-store_ccp" } */ + + +bar (int i, int partial, int args_addr) +{ + int offset = 0; + if (args_addr == 0) + offset = 0; + if (i >= offset) + foo (); +} + +/* There should be only one IF conditional since the first does nothing + useful. */ +/* { dg-final { scan-tree-dump-times "if " 1 "store_ccp"} } */ +/* { dg-final { cleanup-tree-dump "store_ccp" } } */
20030731-2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20030714-1.c =================================================================== --- 20030714-1.c (nonexistent) +++ 20030714-1.c (revision 816) @@ -0,0 +1,46 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-dom3" } */ + +struct rtx_def; +typedef struct rtx_def *rtx; +enum rtx_code +{ + REG, + LAST_AND_UNUSED_RTX_CODE = 256 +}; +typedef union rtunion_def rtunion; +struct rtx_def +{ + enum rtx_code code:16; + unsigned frame_related:1; +}; + +rtx +find_base_value (src) + rtx src; +{ + rtx temp; + rtx src_0, src_2; + rtx src_1, src_3; + + if ((src_0->code == REG) && (({src_2;})->frame_related)) + return find_base_value (src_0); + if ((src_1->code == REG) && (({ src_3;})->frame_related)) + return find_base_value (src_1); + if (src_0->code == REG) + find_base_value (src_0); + if (src_1->code == REG) + find_base_value (src_1); +} + + +/* There should be four IF conditionals. */ +/* { dg-final { scan-tree-dump-times "if " 4 "dom3"} } */ + +/* There should be no casts to short unsigned int. */ +/* { dg-final { scan-tree-dump-times "\\(short unsigned int\\)" 0 "dom3"} } */ + +/* There should be two loads of ->code. */ +/* { dg-final { scan-tree-dump-times "->code" 2 "dom3"} } */ + +/* { dg-final { cleanup-tree-dump "dom3" } } */
20030714-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20031106-6.c =================================================================== --- 20031106-6.c (nonexistent) +++ 20031106-6.c (revision 816) @@ -0,0 +1,29 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fno-tree-sra -fdump-tree-optimized" } */ + +extern void link_error (void); + +/* Check for copyprop on structs. */ + +struct s +{ + char d; + int a, b; + double m; +}; + +struct s foo (struct s r) +{ + struct s temp_struct1; + struct s temp_struct2; + struct s temp_struct3; + temp_struct1 = r; + temp_struct2 = temp_struct1; + temp_struct3 = temp_struct2; + return temp_struct3; +} + +/* There should be no references to any of "temp_struct*" + temporaries. */ +/* { dg-final { scan-tree-dump-times "temp_struct" 0 "optimized" { xfail *-*-* } } } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */
20031106-6.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pr17598.c =================================================================== --- pr17598.c (nonexistent) +++ pr17598.c (revision 816) @@ -0,0 +1,42 @@ +/* { dg-do compile } */ +/* { dg-options "-fdump-tree-gimple" } */ + +struct f +{ + int i; + int j; +}; + +struct g +{ + int i; + struct f j; + struct f *k; +}; + +int foo(struct f *x, struct f *y) +{ + return &x->j == &y->j; /* x == y */ +} + +struct f y; +int bar(struct f *x) +{ + return &x->j == &y.j; /* x == &y */ +} + +struct g yy; +int foobar(struct g *x) +{ + return &x->j.i == &yy.j.i; /* x == &yy */ +} +int foobar2(struct g *x) +{ + return &x->k->i == &yy.k->i; /* x->k == yy.k */ +} + +/* { dg-final { scan-tree-dump-times "x == y" 1 "gimple" } } */ +/* { dg-final { scan-tree-dump-times "x == &y" 2 "gimple" } } */ +/* { dg-final { scan-tree-dump "x->k" "gimple" } } */ +/* { dg-final { scan-tree-dump "yy.k" "gimple" } } */ +/* { dg-final { cleanup-tree-dump "gimple" } } */
pr17598.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ssa-fre-4.c =================================================================== --- ssa-fre-4.c (nonexistent) +++ ssa-fre-4.c (revision 816) @@ -0,0 +1,15 @@ +/* { dg-do compile } */ +/* { dg-options "-O -fdump-tree-fre-details" } */ + +/* From PR21608. */ + +#define bool _Bool +static inline bool wrap(bool f) { return f; } +bool bar(bool f) +{ + return wrap(f); +} + +/* { dg-final { scan-tree-dump "Replaced \\\(_Bool\\\) .*with " "fre" } } */ +/* { dg-final { scan-tree-dump "Replaced \\\(int\\\) .*with " "fre" } } */ +/* { dg-final { cleanup-tree-dump "fre" } } */
ssa-fre-4.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: divide-2.c =================================================================== --- divide-2.c (nonexistent) +++ divide-2.c (revision 816) @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fstrict-overflow -fdump-tree-optimized" } */ + +int f(int a) +{ + return 10/-a; +} + + +/* { dg-final { scan-tree-dump-times "10 / -a" 0 "optimized"} } */ +/* { dg-final { scan-tree-dump-times "-10 / a" 1 "optimized"} } */ + +/* { dg-final { cleanup-tree-dump "optimized" } } */ +
divide-2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20030814-6.c =================================================================== --- 20030814-6.c (nonexistent) +++ 20030814-6.c (revision 816) @@ -0,0 +1,45 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-dom3" } */ + +extern void abort (void); +union tree_node; +typedef union tree_node *tree; +enum tree_code +{ + LAST_AND_UNUSED_TREE_CODE +}; +extern const char tree_code_type[]; +struct tree_common +{ + enum tree_code code:8; +}; +struct tree_type +{ + double alias_set; +}; +union tree_node +{ + struct tree_common common; + struct tree_type type; +}; +long +foo (t, set) + tree t; + double set; +{ + if (tree_code_type[t->common.code] != 't') + abort (); + + t->type.alias_set = set; + + if (t->common.code == 42) + return 1; + else + return 0; +} +/* There should be precisely one load of common.code. If there is + more than one, then the dominator optimizations failed. */ +/* ??? Will fail until we properly distinguish member stores. At + present the write to type.alias_set kills the previous load. */ +/* { dg-final { scan-tree-dump-times "common.code" 1 "dom3" { xfail *-*-* } } } */ +/* { dg-final { cleanup-tree-dump "dom3" } } */
20030814-6.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: builtin-printf-1.c =================================================================== --- builtin-printf-1.c (nonexistent) +++ builtin-printf-1.c (revision 816) @@ -0,0 +1,42 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-fab" } */ + +extern int printf (const char *, ...); +volatile int vi0, vi1, vi2, vi3, vi4, vi5, vi6, vi7, vi8, vi9, via; + +void test (void) +{ + vi0 = 0; + printf ("hello"); + vi1 = 0; + printf ("hello\n"); + vi2 = 0; + printf ("a"); + vi3 = 0; + printf (""); + vi4 = 0; + printf ("%s", "hello"); + vi5 = 0; + printf ("%s", "hello\n"); + vi6 = 0; + printf ("%s", "a"); + vi7 = 0; + printf ("%s", ""); + vi8 = 0; + printf ("%c", 'x'); + vi9 = 0; + printf ("%s\n", "hello\n"); + via = 0; +} + +/* { dg-final { scan-tree-dump "vi0.*printf.*\"hello\".*vi1" "fab"} } */ +/* { dg-final { scan-tree-dump "vi1.*puts.*\"hello\".*vi2" "fab"} } */ +/* { dg-final { scan-tree-dump "vi2.*putchar.*vi3" "fab"} } */ +/* { dg-final { scan-tree-dump "vi3 = 0\[^\(\)\]*vi4 = 0" "fab"} } */ +/* { dg-final { scan-tree-dump "vi4.*printf.*\"hello\".*vi5" "fab"} } */ +/* { dg-final { scan-tree-dump "vi5.*puts.*\"hello\".*vi6" "fab"} } */ +/* { dg-final { scan-tree-dump "vi6.*putchar.*vi7" "fab"} } */ +/* { dg-final { scan-tree-dump "vi7 = 0\[^\(\)\]*vi8 = 0" "fab"} } */ +/* { dg-final { scan-tree-dump "vi8.*putchar.*vi9" "fab"} } */ +/* { dg-final { scan-tree-dump "vi9.*puts.*\"hello\\\\n\".*via" "fab"} } */ +/* { dg-final { cleanup-tree-dump "fab" } } */
builtin-printf-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: complex-3.c =================================================================== --- complex-3.c (nonexistent) +++ complex-3.c (revision 816) @@ -0,0 +1,27 @@ +/* { dg-do compile } */ +/* { dg-options "-O -fdump-tree-optimized" } */ + +typedef _Complex float COMPLEX_FLOAT; +float real_part(COMPLEX_FLOAT a) +{ + return *(float*)(&a); +} + +float real_part_2(COMPLEX_FLOAT a) +{ + return ((float*)(&a))[0]; +} + + +float imag_part(COMPLEX_FLOAT a) +{ + return ((float*)(&a))[1]; +} + +/* Test that the above gets optimized to REALPART_EXPR and IMAGPART_EXPR + respectively. */ + +/* { dg-final { scan-tree-dump-times "REALPART_EXPR" 2 "optimized" } } */ +/* { dg-final { scan-tree-dump-times "IMAGPART_EXPR" 1 "optimized" } } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */ +
complex-3.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: vrp22.c =================================================================== --- vrp22.c (nonexistent) +++ vrp22.c (revision 816) @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -ftree-vrp -fdump-tree-vrp1" } */ +/* { dg-require-effective-target int32plus } */ + +extern void link_error (); + +void test02(unsigned int a, unsigned int b) +{ + unsigned int x = 0x80000000; + if (a > x) + if (b < x) + if (a == b) + link_error (); +} + +/* { dg-final { scan-tree-dump-times "link_error" 0 "vrp1" } } */ +/* { dg-final { cleanup-tree-dump "vrp1" } } */
vrp22.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: vrp05.c =================================================================== --- vrp05.c (nonexistent) +++ vrp05.c (revision 816) @@ -0,0 +1,20 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-vrp1" } */ + +foo (int k, int j) +{ + if (k >= 10) + { + if (j > k) + { + /* We should fold this to if (1). */ + if (j > 0) + return j; + } + } + + return j; +} + +/* { dg-final { scan-tree-dump-times "Folding predicate j_.*to 1" 1 "vrp1" } } */ +/* { dg-final { cleanup-tree-dump "vrp1" } } */
vrp05.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ssa-pre-6.c =================================================================== --- ssa-pre-6.c (nonexistent) +++ ssa-pre-6.c (revision 816) @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-pre-stats" } */ +int main(int x) +{ + int c, y; + if (c) + x = 2; + y = x + 1; + return y; +} +/* We should eliminate one evaluation of x + 1 along the x = 2 path, + causing one elimination. */ +/* { dg-final { scan-tree-dump-times "Eliminated: 1" 1 "pre"} } */ +/* { dg-final { cleanup-tree-dump "pre" } } */
ssa-pre-6.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pr22018.c =================================================================== --- pr22018.c (nonexistent) +++ pr22018.c (revision 816) @@ -0,0 +1,32 @@ +/* { dg-do run } */ +/* { dg-options -O2 } */ + +void abort (void); +void g(int); +void f(int l) +{ + unsigned i; + for (i = 0; i < l; i++) + { + int y = i; + /* VRP was wrongfully computing z's range to be [0, 0] instead + of [-INF, 0]. */ + int z = y*-32; + g(z); + } +} + +void g(int i) +{ + static int x = 0; + if (i == 0) + x ++; + if (x > 1) + abort (); +} + +int main(void) +{ + f(3); + return 0; +}
pr22018.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pr17141-2.c =================================================================== --- pr17141-2.c (nonexistent) +++ pr17141-2.c (revision 816) @@ -0,0 +1,30 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-optimized" } */ + + + +void abort (void); +struct a +{ + int i; +} *a; +int f(void) +{ + int *ii = &a->i; + void *l; + a->i = 1; + if (*ii) + l = &&l1; + else + l = &&l2; + goto *l; +l1: + return 0; +l2: + abort (); +} + + +/* { dg-final { scan-tree-dump-times "&" 0 "optimized" } } */ +/* { dg-final { scan-tree-dump-times "abort" 0 "optimized" } } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */
pr17141-2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pr21029.c =================================================================== --- pr21029.c (nonexistent) +++ pr21029.c (revision 816) @@ -0,0 +1,118 @@ +/* { dg-do run } */ +/* { dg-options "-O2 -fwrapv" } */ + +/* PR tree-optimization/21029 + + f() used to get optimized to an infinite loop by tree-vrp, because + j is assumed to be non-negative. Even though the conversion from + unsigned to signed has unspecified results if the expression value + is not representable in the signed type, the compiler itself (e.g., + the Ada front end) depends on wrap-around behavior. */ + +unsigned int f(void) { + unsigned char i = 123; + signed char j; + + do + if ((j = (signed char) i) < 0) + break; + else + i++; + while (1); + + return i; +} + +/* Now let's torture it a bit further. Narrowing conversions need + similar treatment. */ + +unsigned int f1 (void) { + unsigned short i = 123; + signed char j; + + do + if ((j = (signed char) i) < 0) + break; + else + i++; + while (1); + + return i; +} + +/* And so do widening conversions. */ + +unsigned int f2 (void) { + unsigned char i = 123; + signed short j; + + do + if ((j = (signed short) (signed char) i) < 0) + break; + else + i++; + while (1); + + return i; +} + +/* Check same-sign truncations with an increment that turns into + decrements. */ + +unsigned int f3 (void) { + signed short i = 5; + signed char j; + + do + if ((j = (signed char) i) < 0) + break; + else + i += 255; + while (1); + + return i; +} + +/* Check that the truncation above doesn't confuse the result of the + test after a widening conversion. */ + +unsigned int f4 (void) { + signed short i = -123; + signed int j; + + do + if ((j = (signed int) (signed char) i) > 0) + break; + else + i += 255; + while (1); + + return i; +} + +/* Even if we omit the widening truncation, the narrowing truncation + is implementation-defined. */ + +unsigned int f5 (void) { + signed long i = -123; + signed char j; + + do + if ((j = (signed char) i) > 0) + break; + else + i += 255; + while (1); + + return i; +} + +int main (void) { + f (); + f1 (); + f2 (); + f3 (); + f4 (); + f5 (); + return 0; +}
pr21029.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pr20913.c =================================================================== --- pr20913.c (nonexistent) +++ pr20913.c (revision 816) @@ -0,0 +1,34 @@ +/* PR tree-optimization/20913 + COPY-PROP did not fold COND_EXPR, blocking some copy propagation + opportunities. */ + +/* { dg-do link } */ +/* { dg-options "-O2 -fno-tree-dominator-opts" } */ + +int +foo (int a, int b, int c, int d) +{ + int x, y; + + b = a; + if (a == b) + x = c; + else + { + link_error (); + x = d; + } + + if (x == c) + return a; + else + { + link_error (); + return b; + } +} + +main() +{ + foo (1, 2, 3, 4); +}
pr20913.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: useless-1.c =================================================================== --- useless-1.c (nonexistent) +++ useless-1.c (revision 816) @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-useless" } */ + +void +foo (void) +{ + int i, a; + for (i = 0; i < 10; i++) + { a = i; } +} + +/* There should be three gotos in the dump. If one was removed + in the loop exit condition, it would be re-introduced during + GIMPLE lowering, at the cost of an extra statement, label, + and basic block. */ +/* { dg-final { scan-tree-dump-times "goto" 3 "useless"} } */ +/* { dg-final { cleanup-tree-dump "useless" } } */
useless-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20030807-10.c =================================================================== --- 20030807-10.c (nonexistent) +++ 20030807-10.c (revision 816) @@ -0,0 +1,26 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-vrp1" } */ + + +extern const unsigned char mode_size[]; +unsigned int +subreg_highpart_offset (outermode, innermode) + int outermode, innermode; +{ + unsigned int offset = 0; + int difference = (mode_size[innermode] - mode_size[outermode]); + if (difference > 0) + { + offset += difference % (0 ? 8 : 4); + offset += difference / 4 * 4; + } + return offset; +} + +/* There should be one mask with the value 3. */ +/* { dg-final { scan-tree-dump-times " \& 3" 1 "vrp1"} } */ + +/* There should be one right shift by 2 places. */ +/* { dg-final { scan-tree-dump-times " >> 2" 1 "vrp1"} } */ + +/* { dg-final { cleanup-tree-dump "vrp1" } } */
20030807-10.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pr14490-1.c =================================================================== --- pr14490-1.c (nonexistent) +++ pr14490-1.c (revision 816) @@ -0,0 +1,11 @@ +/* { dg-do compile } */ +/* { dg-options "-fstrict-overflow -fdump-tree-gimple" } */ +int g(int x) +{ + return (x - 10) < 0; +} +/* There should be only x <= 9 and no x - 10. */ +/* { dg-final { scan-tree-dump-times "<= 9" 1 "gimple"} } */ +/* { dg-final { scan-tree-dump-times "\\+ -10" 0 "gimple"} } */ +/* { dg-final { cleanup-tree-dump "gimple" } } */ +
pr14490-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: sra-1.c =================================================================== --- sra-1.c (nonexistent) +++ sra-1.c (revision 816) @@ -0,0 +1,73 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-optimized --param sra-max-structure-size=32" } */ + +/* Tests for SRA. */ + +typedef struct teststruct +{ + double d; + char f1; +} teststruct; + +void +copystruct1 (teststruct param) +{ + teststruct local; + param.f1 = 0; + local = param; + if (local.f1 != 0) + link_error (); +} + +void +copystruct11 (teststruct *param) +{ + teststruct local; + param->f1 = 0; + local = *param; + if (local.f1 != 0) + link_error (); +} + +void +copystruct111 (teststruct param) +{ + teststruct *local = ¶m; + param.f1 = 0; + if (local->f1 != 0) + link_error (); +} + +teststruct globf; +void +copystruct1111 (void) +{ + teststruct local; + globf.f1 = 0; + local = globf; + if (local.f1 != 0) + link_error (); +} + +void +copystruct11111 (void) +{ + teststruct *local = &globf; + globf.f1 = 0; + if (local->f1 != 0) + link_error (); +} + +void +copystruct111111 (teststruct param) +{ + static teststruct local; + param.f1 = 0; + local = param; + if (local.f1 != 0) + link_error (); +} + +/* There should be no referenc to link_error. */ +/* { dg-final { scan-tree-dump-times "link_error" 0 "optimized"} } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */
sra-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: tailcall-2.c =================================================================== --- tailcall-2.c (nonexistent) +++ tailcall-2.c (revision 816) @@ -0,0 +1,24 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-tailc-details" } */ +/* Test provided by Richard Earnshaw in PR 14312. */ + +void bar (int i); +void baz (int *); + +void +foo (int *x) +{ + if (*x < 0) + { + baz (x); + return; + } + bar (*x); +} + +/* The test has no local call-clobbered variables. Only the memory + tag for 'x' is call-clobbered. And since tags are not real + variables, they ought to be ignored. There should be two tail + calls here. */ +/* { dg-final { scan-tree-dump-times "Found tail call" 2 "tailc"} } */ +/* { dg-final { cleanup-tree-dump "tailc" } } */
tailcall-2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pr21829.c =================================================================== --- pr21829.c (nonexistent) +++ pr21829.c (revision 816) @@ -0,0 +1,21 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-phicprop-details" } */ + +int test(int v) +{ + int x = 0; + int u; + for (u=0;u<2;u++) + { + if (u>v) + { + if (u%2==1) + x++; + } + } + return x; +} + +/* { dg-final { scan-tree-dump-times "Original statement:.*% 2\[ \t\n]*Updated statement.*=1" 0 "phicprop3" } } */ +/* { dg-final { cleanup-tree-dump "phicprop3" } } */ +
pr21829.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pr15349.c =================================================================== --- pr15349.c (nonexistent) +++ pr15349.c (revision 816) @@ -0,0 +1,26 @@ +/* PR 15349. Merge two PHI nodes. */ +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-mergephi" } */ + +int +foo (int a, int b) +{ + int t; + + if (b) + { + if (a) + t = 3; + else + t = 5; + + a = 0; + } + else + t = 7; + + return t; +} + +/* { dg-final { scan-tree-dump-times "PHI" 1 "mergephi"} } */ +/* { dg-final { cleanup-tree-dump "mergephi" } } */
pr15349.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ssa-sink-3.c =================================================================== --- ssa-sink-3.c (nonexistent) +++ ssa-sink-3.c (revision 816) @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-sink-stats" } */ +extern void foo(int a); +int +main (int argc) +{ + int a; + a = argc + 1; + if (argc + 3) + { + foo (a); + } +} +/* We should sink the a = argc + 1 calculation into the if branch */ +/* { dg-final { scan-tree-dump-times "Sunk statements:1" 1 "sink" } } */ +/* { dg-final { cleanup-tree-dump "sink" } } */
ssa-sink-3.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ssa-pre-10.c =================================================================== --- ssa-pre-10.c (nonexistent) +++ ssa-pre-10.c (revision 816) @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fno-tree-dominator-opts -fdump-tree-fre-stats" } */ +double cos (double); +void link_error(); +void f(double a) +{ + double b = cos (a); + double c = cos (a); + if (b != c) + link_error(); +} + +/* { dg-final { scan-tree-dump-times "Eliminated: 1" 1 "fre"} } */ +/* { dg-final { cleanup-tree-dump "fre" } } */
ssa-pre-10.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20031015-1.c =================================================================== --- 20031015-1.c (nonexistent) +++ 20031015-1.c (revision 816) @@ -0,0 +1,18 @@ +/* With tree-ssa, gcc.dg/20000724-1.c failed because we missed + a VOP of x in the asm statement. */ +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-alias1-vops" } */ + +struct s { int a; }; + +int +main(void) +{ + struct s x = { 0 }; + asm volatile ("" : : "r" (&x) : "memory"); + return 0; +} + +/* The V_*_DEF comes from the initial assignment and the asm. */ +/* { dg-final { scan-tree-dump-times "_DEF" 3 "alias1" } } */ +/* { dg-final { cleanup-tree-dump "alias1" } } */
20031015-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pr31966.c =================================================================== --- pr31966.c (nonexistent) +++ pr31966.c (revision 816) @@ -0,0 +1,50 @@ +/* Contributed by Jack Lloyd */ + +/* { dg-options "-O2 -ftree-vectorize" } */ +/* { dg-options "-O2 -ftree-vectorize -march=nocona" { target { i?86-*-* x86_64-*-* } } } */ + +typedef unsigned long long word; + +const unsigned int MP_WORD_BITS = 64; +const word MP_WORD_MASK = ~((word)0); +const word MP_WORD_TOP_BIT = (word)1 << (8*sizeof(word) - 1); + +extern void abort (void); + +word do_div(word n1, word n0, word d) +{ + word high = n1 % d, quotient = 0; + unsigned int j; + + for(j = 0; j != MP_WORD_BITS; ++j) + { + word high_top_bit = (high & MP_WORD_TOP_BIT); + + high <<= 1; + high |= (n0 >> (MP_WORD_BITS-1-j)) & 1; + quotient <<= 1; + + if(high_top_bit || high >= d) + { + high -= d; + quotient |= 1; + } + } + + return quotient; +} + +int main() +{ + word result; + + result = do_div(0x0000000000200000ll, + 0x0000000000000000ll, + 0x86E53497CE000000ll); + + + if (result != 0x3CBA83) + abort (); + + return 0; +}
pr31966.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: loadpre14.c =================================================================== --- loadpre14.c (nonexistent) +++ loadpre14.c (revision 816) @@ -0,0 +1,19 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-pre-stats" } */ +typedef int type[2]; +int main(type *a, int argc) +{ + type c = {0, 1}; + int d, e; + + /* Should be able to eliminate the second load of *a along the main path. */ + d = (*a)[0]; + if (argc) + { + a = &c; + } + e = (*a)[0]; + return d + e; +} +/* { dg-final { scan-tree-dump-times "Eliminated: 1" 1 "pre" { xfail *-*-* } } } */ +/* { dg-final { cleanup-tree-dump "pre" } } */
loadpre14.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20031216-1.c =================================================================== --- 20031216-1.c (nonexistent) +++ 20031216-1.c (revision 816) @@ -0,0 +1,20 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-optimized" } */ + +extern void link_error (void); + +void +foo (int b) +{ + int a; + a = b + 2; + a--; + a--; + if (a != b) + link_error (); +} + +/* The comparison should be eliminated, there should be no reference + to link_error. */ +/* { dg-final { scan-tree-dump-times "link_error" 0 "optimized"} } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */
20031216-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: gen-vect-25.c =================================================================== --- gen-vect-25.c (nonexistent) +++ gen-vect-25.c (revision 816) @@ -0,0 +1,56 @@ +/* { dg-do run { target vect_cmdline_needed } } */ +/* { dg-options "-O2 -ftree-vectorize -ftree-vectorizer-verbose=3 -fdump-tree-vect-stats" } */ + +#include + +#define N 128 + +#if __LONG_MAX__ == 2147483647 +typedef short half_word; +#else +typedef int half_word; +#endif + +int main_1 (int n, int *p) +{ + int i; + half_word ib[N]; + half_word ia[N]; + int k; + + for (i = 0; i < N; i++) + { + ia[i] = n; + } + + /* check results: */ + for (i = 0; i < N; i++) + { + if (ia[i] != n) + abort (); + } + + k = *p; + for (i = 0; i < N; i++) + { + ib[i] = k; + } + + /* check results: */ + for (i = 0; i < N; i++) + { + if (ib[i] != k) + abort (); + } + + return 0; +} + +int main (int n) +{ + return main_1 (n + 2, &n); +} + +/* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect" } } */ +/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" } } */ +/* { dg-final { cleanup-tree-dump "vect" } } */
gen-vect-25.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: loop-15.c =================================================================== --- loop-15.c (nonexistent) +++ loop-15.c (revision 816) @@ -0,0 +1,27 @@ +/* A test for # of iterations analysis (signed counter cannot wrap) and final + value replacement. */ + +/* { dg-options "-O2 -fdump-tree-optimized" } */ + +int foo(void); + +int bla(void) +{ + int i, n = foo (), j; + + j = 0; + /* The loop should be removed completely. */ + for (i = 1; i <= n; i++) + j += n; + + /* Should be replaced with return n * n; */ + return j; +} + +/* Since the loop is removed, there should be no addition. */ +/* { dg-final { scan-tree-dump-times "\\+" 0 "optimized" } } */ +/* { dg-final { scan-tree-dump-times "n \\* n" 1 "optimized" } } */ + +/* The if from the loop header copying remains in the code. */ +/* { dg-final { scan-tree-dump-times "if " 1 "optimized" } } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */
loop-15.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20040721-1.c =================================================================== --- 20040721-1.c (nonexistent) +++ 20040721-1.c (revision 816) @@ -0,0 +1,28 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fno-tree-dominator-opts -fdump-tree-store_ccp-vops" } */ + +/* Test to check whether global variables are being + constant propagated. */ + +int G; + +foo (int i) +{ + if (i > 0) + G = 3; + else + G = 3; + + if (G != 3) + link_error (); +} + +main () +{ + foo (0); + return 0; +} + +/* There should be no G on the RHS of an assignment. */ +/* { dg-final { scan-tree-dump-times "= G;" 0 "store_ccp"} } */ +/* { dg-final { cleanup-tree-dump "store_ccp" } } */
20040721-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20030920-1.c =================================================================== --- 20030920-1.c (nonexistent) +++ 20030920-1.c (revision 816) @@ -0,0 +1,112 @@ +/* Jump threading was creating FALLTHRU edges out of blocks ending in + GOTO_EXPR. */ + +extern int frame_pointer_needed; + +struct value_data_entry +{ + unsigned int mode; + unsigned int oldest_regno; + unsigned int next_regno; +}; + +struct value_data +{ + struct value_data_entry e[53]; + unsigned int max_value_regs; +}; + +struct rtx_def +{ + unsigned int code: 16; + unsigned int mode : 8; + unsigned int jump : 1; + unsigned int call : 1; + unsigned int unchanging : 1; + unsigned int volatil : 1; + unsigned int in_struct : 1; + unsigned int used : 1; + unsigned integrated : 1; + unsigned frame_related : 1; + int fld[1]; +}; + +typedef struct rtx_def *rtx; + +enum machine_mode { VOIDmode, BImode, QImode, HImode, SImode, DImode, + TImode, OImode, PQImode, PHImode, PSImode, PDImode, QFmode, HFmode, + TQFmode, SFmode, DFmode, XFmode, TFmode, QCmode, HCmode, SCmode, + DCmode, XCmode, TCmode, CQImode, CHImode, CSImode, CDImode, CTImode, + COImode, V1DImode, V2QImode, V2HImode, V2SImode, V2DImode, V4QImode, + V4HImode, V4SImode, V4DImode, V8QImode, V8HImode, V8SImode, V8DImode, + V16QImode, V2HFmode, V2SFmode, V2DFmode, V4HFmode, V4SFmode, V4DFmode, + V8HFmode, V8SFmode, V8DFmode, V16SFmode, BLKmode, CCmode, CCGCmode, + CCGOCmode, CCNOmode, CCZmode, CCFPmode, CCFPUmode, MAX_MACHINE_MODE }; + +enum mode_class { MODE_RANDOM, MODE_INT, MODE_FLOAT, MODE_PARTIAL_INT, MODE_CC, + MODE_COMPLEX_INT, MODE_COMPLEX_FLOAT, + MODE_VECTOR_INT, MODE_VECTOR_FLOAT, + MAX_MODE_CLASS}; + +extern const unsigned char mode_size[(int) MAX_MACHINE_MODE]; +extern const enum mode_class mode_class[(int) MAX_MACHINE_MODE]; + +extern int target_flags; + +static void +copy_value (rtx dest, rtx src, struct value_data *vd) +{ + unsigned int dr = (((dest)->fld[0])); + unsigned int sr = (((src)->fld[0])); + unsigned int dn, sn; + unsigned int i; + + + + if (sr == dr) + return; + + + + if (dr == 7) + return; + + + if (frame_pointer_needed && dr == 6) + return; + + + dn = (((dr) >= 8 && (dr) <= (8 + 7)) || (((dr) >= (20 + 1) && (dr) <= ((20 + 1) + 7)) || ((dr) >= (((((((20 + 1) + 7) + 1) + 7) + 1) + 7) + 1) && (dr) <= ((((((((20 + 1) + 7) + 1) + 7) + 1) + 7) + 1) + 7))) || ((dr) >= (((20 + 1) + 7) + 1) && (dr) <= ((((20 + 1) + 7) + 1) + 7)) ? (((mode_class[(int) (((enum machine_mode) (dest)->mode))]) == MODE_COMPLEX_INT || (mode_class[(int) (((enum machine_mode) (dest)->mode))]) == MODE_COMPLEX_FLOAT) ? 2 : 1) : ((((enum machine_mode) (dest)->mode)) == TFmode ? ((target_flags & 0x00100000) ? 2 : 3) : (((enum machine_mode) (dest)->mode)) == TCmode ? ((target_flags & 0x00100000) ? 4 : 6) : (((mode_size[(int) (((enum machine_mode) (dest)->mode))]) + ((target_flags & 0x00100000) ? 8 : 4) - 1) / ((target_flags & 0x00100000) ? 8 : 4)))); + sn = (((sr) >= 8 && (sr) <= (8 + 7)) || (((sr) >= (20 + 1) && (sr) <= ((20 + 1) + 7)) || ((sr) >= (((((((20 + 1) + 7) + 1) + 7) + 1) + 7) + 1) && (sr) <= ((((((((20 + 1) + 7) + 1) + 7) + 1) + 7) + 1) + 7))) || ((sr) >= (((20 + 1) + 7) + 1) && (sr) <= ((((20 + 1) + 7) + 1) + 7)) ? (((mode_class[(int) (((enum machine_mode) (dest)->mode))]) == MODE_COMPLEX_INT || (mode_class[(int) (((enum machine_mode) (dest)->mode))]) == MODE_COMPLEX_FLOAT) ? 2 : 1) : ((((enum machine_mode) (dest)->mode)) == TFmode ? ((target_flags & 0x00100000) ? 2 : 3) : (((enum machine_mode) (dest)->mode)) == TCmode ? ((target_flags & 0x00100000) ? 4 : 6) : (((mode_size[(int) (((enum machine_mode) (dest)->mode))]) + ((target_flags & 0x00100000) ? 8 : 4) - 1) / ((target_flags & 0x00100000) ? 8 : 4)))); + if ((dr > sr && dr < sr + sn) + || (sr > dr && sr < dr + dn)) + return; + + + + + if (vd->e[sr].mode == VOIDmode) + set_value_regno (sr, vd->e[dr].mode, vd); + else if (sn < (unsigned int) (((sr) >= 8 && (sr) <= (8 + 7)) || (((sr) >= (20 + 1) && (sr) <= ((20 + 1) + 7)) || ((sr) >= (((((((20 + 1) + 7) + 1) + 7) + 1) + 7) + 1) && (sr) <= ((((((((20 + 1) + 7) + 1) + 7) + 1) + 7) + 1) + 7))) || ((sr) >= (((20 + 1) + 7) + 1) && (sr) <= ((((20 + 1) + 7) + 1) + 7)) ? (((mode_class[(int) (vd->e[sr].mode)]) == MODE_COMPLEX_INT || (mode_class[(int) (vd->e[sr].mode)]) == MODE_COMPLEX_FLOAT) ? 2 : 1) : ((vd->e[sr].mode) == TFmode ? ((target_flags & 0x00100000) ? 2 : 3) : (vd->e[sr].mode) == TCmode ? ((target_flags & 0x00100000) ? 4 : 6) : (((mode_size[(int) (vd->e[sr].mode)]) + ((target_flags & 0x00100000) ? 8 : 4) - 1) / ((target_flags & 0x00100000) ? 8 : 4)))) + && ((mode_size[(int) (vd->e[sr].mode)]) > ((target_flags & 0x00100000) ? 8 : 4) + ? 0 : 0)) + return; + + + + + else if (sn > (unsigned int) (((sr) >= 8 && (sr) <= (8 + 7)) || (((sr) >= (20 + 1) && (sr) <= ((20 + 1) + 7)) || ((sr) >= (((((((20 + 1) + 7) + 1) + 7) + 1) + 7) + 1) && (sr) <= ((((((((20 + 1) + 7) + 1) + 7) + 1) + 7) + 1) + 7))) || ((sr) >= (((20 + 1) + 7) + 1) && (sr) <= ((((20 + 1) + 7) + 1) + 7)) ? (((mode_class[(int) (vd->e[sr].mode)]) == MODE_COMPLEX_INT || (mode_class[(int) (vd->e[sr].mode)]) == MODE_COMPLEX_FLOAT) ? 2 : 1) : ((vd->e[sr].mode) == TFmode ? ((target_flags & 0x00100000) ? 2 : 3) : (vd->e[sr].mode) == TCmode ? ((target_flags & 0x00100000) ? 4 : 6) : (((mode_size[(int) (vd->e[sr].mode)]) + ((target_flags & 0x00100000) ? 8 : 4) - 1) / ((target_flags & 0x00100000) ? 8 : 4))))) + return; + + + + vd->e[dr].oldest_regno = vd->e[sr].oldest_regno; + + for (i = sr; vd->e[i].next_regno != (~(unsigned int) 0); i = vd->e[i].next_regno) + continue; + vd->e[i].next_regno = dr; + + + validate_value_data (vd); + +}
20030920-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: bool-6.c =================================================================== --- bool-6.c (nonexistent) +++ bool-6.c (revision 816) @@ -0,0 +1,22 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-optimized" } */ + +int f(_Bool x) +{ + int y; + if (x) + y = 1; + else + y = 0; + return y; +} + +/* There should be no == 1 which is produced by the front-end as + bool_var == 1 is the same as bool_var. */ +/* { dg-final { scan-tree-dump-times "== 1" 0 "optimized"} } */ + +/* There should be no adde for powerpc. Check if we actually optimized + away the comparison. */ +/* { dg-final { scan-assembler-times "adde" 0 { target powerpc*-*-* } } } */ + +/* { dg-final { cleanup-tree-dump "optimized" } } */
bool-6.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20050128-1.c =================================================================== --- 20050128-1.c (nonexistent) +++ 20050128-1.c (revision 816) @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-gimple" } */ + +int +foo (int align) +{ + int off = 0 % align; + return off ? align - off : 0; +} + +/* We should have optimized away the mod operator before we gimpleized + the code. */ +/* { dg-final { scan-tree-dump-times "%" 0 "gimple"} } */ +/* { dg-final { cleanup-tree-dump "gimple" } } */
20050128-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20040408-1.c =================================================================== --- 20040408-1.c (nonexistent) +++ 20040408-1.c (revision 816) @@ -0,0 +1,51 @@ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ +/* Make sure that when a variable with an NMT is marked for renaming + that the NMT's aliases are also marked for renaming. */ + +static int eiisnan (short unsigned int *x) +{ + int i; + + if( x[i] != 0 ) + return(1); +} + +static int eiisinf (unsigned short *x) +{ + if (eiisnan (x)) + return (0); + + if ((x[1] & 0x7fff) == 0x7fff) + return (1); +} + +static void toe64(short unsigned int *a, short unsigned int *b) +{ + register unsigned short *p, *q; + unsigned short i; + + q = b + 4; + + if (eiisinf (a)); + + for( i=0; i<4; i++ ) + *q-- = *p++; +} + +static int asctoeg(short unsigned int *y, int oprec) +{ + unsigned short yy[13]; + char *s; + + while( *s == ' ' ) + ++s; + + toe64( yy, y ); +} + +long double _strtold (char *s, char **se) +{ + long double x; + asctoeg( (unsigned short *)&x, 64 ); +}
20040408-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20030808-1.c =================================================================== --- 20030808-1.c (nonexistent) +++ 20030808-1.c (revision 816) @@ -0,0 +1,41 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-cddce" } */ + +extern void abort (void); + +struct rtx_def; +typedef struct rtx_def *rtx; +enum rtx_code +{ + UNKNOWN, + CODE_LABEL, + NOTE, + LAST_AND_UNUSED_RTX_CODE = 256 +}; +typedef union rtunion_def rtunion; +struct rtx_def +{ + enum rtx_code code:16; +}; +void +delete_dead_jumptables () +{ + rtx insn, next; + if (insn->code == CODE_LABEL) + { + rtx const _rtx = insn; + if (_rtx->code != CODE_LABEL && _rtx->code != NOTE) + abort (); + } + ; +} + +/* There should be no loads of ->code. If any exist, then we failed to + optimize away all the IF statements and the statements feeding + their conditions. */ +/* { dg-final { scan-tree-dump-times "->code" 0 "cddce"} } */ + +/* There should be no IF statements. */ +/* { dg-final { scan-tree-dump-times "if " 0 "cddce"} } */ + +/* { dg-final { cleanup-tree-dump "cddce" } } */
20030808-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ifc-20040816-2.c =================================================================== --- ifc-20040816-2.c (nonexistent) +++ ifc-20040816-2.c (revision 816) @@ -0,0 +1,36 @@ +/* { dg-do compile } */ +/* { dg-options "-c -O2 -ftree-vectorize -fdump-tree-ifcvt-stats" { target *-*-* } } */ + +void foo(const int * __restrict__ zr_in, + const int * __restrict__ zi_in, + const int * __restrict__ zk_in, + int * __restrict__ zr_out, + int * __restrict__ zi_out, + int * __restrict__ zk_out, + int cr, int ci) +{ + unsigned int pi; + int tmp_r, tmp_i, tmp_k; + for (pi = 0; pi < (512)*(512); pi++) { + int zr = zr_in[pi]; + int zi = zi_in[pi]; + int zk = zk_in[pi]; + + if (zr*zr + zi*zi >= 4) { + tmp_r = zr; + tmp_i = zi; + tmp_k = zk; + } else { + tmp_r = (zr*zr - zi*zi + cr); + tmp_i = (2 * zr * zi + ci); + tmp_k = zk + 1; + } + zr_out[pi] = tmp_r; + zi_out[pi] = tmp_i; + zk_out[pi] = tmp_k; + } +} + + +/* { dg-final { scan-tree-dump-times "Applying if-conversion" 1 "ifcvt" } } */ +/* { dg-final { cleanup-tree-dump "ifcvt" } } */
ifc-20040816-2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20030807-3.c =================================================================== --- 20030807-3.c (nonexistent) +++ 20030807-3.c (revision 816) @@ -0,0 +1,27 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-dom3" } */ + +typedef unsigned int cppchar_t; +cppchar_t +cpp_parse_escape (pstr, limit, wide) + const unsigned char **pstr; + const unsigned char *limit; + int wide; +{ + cppchar_t i = 0; + int overflow = 0; + cppchar_t mask = ~0; + + while (*pstr < limit) + { + overflow |= i ^ (i << 4 >> 4); + i = oof (); + } + if (overflow | (i != (i & mask))) + foo(); +} + +/* There should be precisely three IF statements. If there is + more than two, then the dominator optimizations failed. */ +/* { dg-final { scan-tree-dump-times "if " 3 "dom3"} } */ +/* { dg-final { cleanup-tree-dump "dom3" } } */
20030807-3.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20030709-2.c =================================================================== --- 20030709-2.c (nonexistent) +++ 20030709-2.c (revision 816) @@ -0,0 +1,54 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-cddce" } */ + +struct rtx_def; +typedef struct rtx_def *rtx; +union tree_node; +typedef union tree_node *tree; +typedef struct mem_attrs +{ + int foo; + +} mem_attrs; +union rtunion_def +{ + mem_attrs *rtmem; +}; +typedef union rtunion_def rtunion; +struct rtx_def +{ + rtunion fld[1]; +}; +struct tree_decl +{ + rtx rtl; +}; +union tree_node +{ + struct tree_decl decl; +}; +void * +get_alias_set (t) + tree t; +{ + long set; + if (t->decl.rtl) + return (t->decl.rtl->fld[1].rtmem + ? 0 + : (((t->decl.rtl ? t->decl.rtl: (make_decl_rtl (t, 0), t->decl.rtl)))->fld[1]).rtmem); + return (void*)-1; +} + +/* There should be precisely one load of ->decl.rtl. If there is + more than, then the dominator optimizations failed. */ +/* { dg-final { scan-tree-dump-times "->decl\\.rtl" 1 "cddce"} } */ + +/* There should be no loads of .rtmem since the complex return statement + is just "return 0". */ +/* { dg-final { scan-tree-dump-times ".rtmem" 0 "cddce"} } */ + +/* There should be one IF statement (the complex return statement should + collapse down to a simple return 0 without any conditionals). */ +/* { dg-final { scan-tree-dump-times "if " 1 "cddce"} } */ + +/* { dg-final { cleanup-tree-dump "cddce" } } */
20030709-2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ltrans-3.c =================================================================== --- ltrans-3.c (nonexistent) +++ ltrans-3.c (revision 816) @@ -0,0 +1,21 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -ftree-loop-linear -fdump-tree-ltrans-all" } */ +/* { dg-require-effective-target size32plus } */ + +double u[1782225]; +int foo(int N, int *res) +{ + unsigned int i, j; + double sum = 0; + for (i = 0; i < N; i++) + { + for (j = 0; j < N; j++) + { + sum = sum + u[i + 1335 * j]; + } + } + *res = sum + N; +} + +/* { dg-final { scan-tree-dump-times "transformed loop" 1 "ltrans"} } */ +/* { dg-final { cleanup-tree-dump "ltrans" } } */
ltrans-3.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: reassoc-7.c =================================================================== --- reassoc-7.c (nonexistent) +++ reassoc-7.c (revision 816) @@ -0,0 +1,12 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-reassoc1" } */ +int main(int a, int b, int c, int d, int e, int f, int g, int h) +{ + /* Should be transformed into a + c + d + e + g + 15 */ + int i = (a + 9) + (c + d); + int j = (e + 4) + (2 + g); + e = i + j; + return e; +} +/* { dg-final { scan-tree-dump-times "\\\+ 15" 1 "reassoc1"} } */ +/* { dg-final { cleanup-tree-dump "reassoc1" } } */
reassoc-7.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: recip-5.c =================================================================== --- recip-5.c (nonexistent) +++ recip-5.c (revision 816) @@ -0,0 +1,31 @@ +/* { dg-options "-O1 -funsafe-math-optimizations -ftrapping-math -fdump-tree-recip -fdump-tree-optimized" } */ +/* { dg-do compile } */ + +/* Test the reciprocal optimizations together with trapping math. */ + +extern int f2(); + +double f1(double y, double z, double w, double j, double k) +{ + double b, c, d, e, f, g; + + if (f2 ()) + /* inserts one division here */ + b = 1 / y, c = z / y, d = j / y; + else + /* one division here */ + b = 3 / y, c = w / y, d = k / y; + + /* and one here, that should be removed afterwards but is not right now */ + e = b / y; + f = c / y; + g = d / y; + + return e + f + g; +} + +/* { dg-final { scan-tree-dump-times " / " 3 "recip" } } */ +/* { dg-final { scan-tree-dump-times " / " 2 "optimized" { xfail *-*-* } } } */ +/* { dg-final { cleanup-tree-dump "recip" } } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */ +
recip-5.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ssa-dse-8.c =================================================================== --- ssa-dse-8.c (nonexistent) +++ ssa-dse-8.c (revision 816) @@ -0,0 +1,26 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fno-tree-dce -fno-tree-ccp -fno-tree-copy-prop -fno-tree-dominator-opts" } */ + +/* This caused the compiler to enter an infinite loop if copies are not + fully propagated. The options are to disable copy propagation and + thus expose the bug. */ + +int foo (void); + +struct A { + struct B { + struct B *n; + } *p; +}; + +static inline void baz (struct A *a) +{ + a->p = a->p->n; +} + +void bar (struct A a) +{ + while (foo ()) + baz (&a); + while (foo ()); +}
ssa-dse-8.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20040729-1.c =================================================================== --- 20040729-1.c (nonexistent) +++ 20040729-1.c (revision 816) @@ -0,0 +1,19 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-dce3" } */ + +foo () +{ + volatile int *p; + volatile int x; + + p = &x; + *p = 3; + return *p + 1; +} + +/* The assignment to 'p' is dead and should be removed. But the + compiler was mistakenly thinking that the statement had volatile + operands. But 'p' itself is not volatile and taking the address of + a volatile does not constitute a volatile operand. */ +/* { dg-final { scan-tree-dump-times "&x" 0 "dce3"} } */ +/* { dg-final { cleanup-tree-dump "dce3" } } */
20040729-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: loadpre2.c =================================================================== --- loadpre2.c (nonexistent) +++ loadpre2.c (revision 816) @@ -0,0 +1,18 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-pre-stats" } */ +int main(int *a, int argc) +{ + int b; + int i; + int d, e; + + /* Should be able to hoist this out of the loop. */ + for (i = 0; i < argc; i++) + { + e = *a; + } + return d + e; +} + +/* { dg-final { scan-tree-dump-times "Eliminated: 1" 1 "pre"} } */ +/* { dg-final { cleanup-tree-dump "pre" } } */
loadpre2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: loop-3.c =================================================================== --- loop-3.c (nonexistent) +++ loop-3.c (revision 816) @@ -0,0 +1,30 @@ +/* A test for strength reduction and induction variable elimination. + Target is restricted to x86 type architectures, so that we may + assume something about memory addressing modes. */ + +/* { dg-do compile { target i?86-*-* x86_64-*-* } } */ +/* { dg-options "-O1 -fdump-tree-optimized" } */ + +int arr_base[100]; + +int foo(int); + +void xxx(void) +{ + long iter; + + for (iter = 0; iter < 100; iter++) + arr_base[iter] = foo (iter); +} + +/* Access to arr_base[iter].y should not be strength reduced, since + we have a memory mode including multiplication by 4. */ + +/* { dg-final { scan-tree-dump-times "MEM" 1 "optimized" } } */ +/* { dg-final { scan-tree-dump-times "step:" 1 "optimized" } } */ + +/* And original induction variable should be preserved. */ + +/* { dg-final { scan-tree-dump-times "int iter" 1 "optimized" } } */ + +/* { dg-final { cleanup-tree-dump "optimized" } } */
loop-3.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pr20701.c =================================================================== --- pr20701.c (nonexistent) +++ pr20701.c (revision 816) @@ -0,0 +1,30 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-vrp1" } */ + +typedef struct { + int code; +} *rtx; + +int +can_combine_p (rtx insn, rtx elt) +{ + rtx set; + + set = 0; + if (insn->code == 3) + set = insn; + else + { + set = elt; + if (set == 0) + return 0; + } + + if (set == 0) + return 1; + + return 0; +} + +/* { dg-final { scan-tree-dump-times "Folding predicate.*to 0" 1 "vrp1" } } */ +/* { dg-final { cleanup-tree-dump "vrp1" } } */
pr20701.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pr22321.c =================================================================== --- pr22321.c (nonexistent) +++ pr22321.c (revision 816) @@ -0,0 +1,20 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fno-tree-vrp -fno-tree-copy-prop -fno-tree-ccp -fdump-tree-optimized" } */ + + +volatile int x; + +int main () +{ + volatile int *vip; + vip = &x; + volatile int *cvip; + cvip = vip; + + if (vip != cvip) return -1; + return 0; +} + +/* { dg-final { scan-tree-dump-times "return 0" 1 "optimized" } } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */ +
pr22321.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pr21332.c =================================================================== --- pr21332.c (nonexistent) +++ pr21332.c (revision 816) @@ -0,0 +1,28 @@ +/* { dg-do run } */ +/* { dg-options "-O2" } */ + +// this testcase fails also on amd64: + +extern void abort (void); + +int f () +{ + return -1; +} + +int main () +{ + int b, c, i; + + b = 0; + c = f (); + if (c <= 0) + { + c = -c; + for (i = 0; i < c; i++) + b = 1; + if (!b) + abort (); + } + return 0; +}
pr21332.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: vrp14.c =================================================================== --- vrp14.c (nonexistent) +++ vrp14.c (revision 816) @@ -0,0 +1,47 @@ +/* { dg-do run } */ +/* { dg-options "-O2" } */ +/* { dg-require-effective-target int32plus } */ + +struct tree_decl +{ + union tree_decl_u1 { + int f; + long i; + struct tree_decl_u1_a { + unsigned int align : 24; + unsigned int off_align : 8; + } a; + } u1; +}; + +extern void abort (void); + +unsigned int +assemble_variable (struct tree_decl decl) +{ + unsigned int align; + + align = decl.u1.a.align; + + if (align > (1 << ((8 * 4) < 64 ? (8 * 4) - 2 : 62))) + align = (1 << ((8 * 4) < 64 ? (8 * 4) - 2 : 62)); + + /* VRP should not be propagating 0 to the RHS of this assignment. + But it was erroneously applying a cast operation between types of + different precision. align is an unsigned int with range [0, + 0x4000000] but the .align field holds only 24 bits. So the cast + was returning a [0, 0] range. */ + decl.u1.a.align = align; + + return decl.u1.a.align; +} + +main () +{ + struct tree_decl decl; + decl.u1.a.align = 13; + unsigned int x = assemble_variable (decl); + if (x == 0) + abort (); + return 0; +}
vrp14.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pr19210-2.c =================================================================== --- pr19210-2.c (nonexistent) +++ pr19210-2.c (revision 816) @@ -0,0 +1,29 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -funsafe-loop-optimizations -Wunsafe-loop-optimizations" } */ +extern void g(void); + +void +f (unsigned n) +{ + unsigned k; + for(k = 0;k <= n;k++) /* { dg-warning "assuming.*not infinite" } */ + g(); + + for(k = 5;k <= n;k += 4) /* { dg-warning "assuming.*not overflow" } */ + g(); + + /* We used to get warning for this loop. However, since then # of iterations + analysis improved, and we can now prove that this loop does not verflow. + This is because the only case when it would overflow is if n = ~0 (since + ~0 is divisible by 5), and this cannot be the case, since when we got + here, the previous loop exited, thus there exists k > n. */ + for(k = 5;k <= n;k += 5) + g(); + + for(k = 4;k <= n;k += 5) /* { dg-warning "assuming.*not overflow" } */ + g(); + + for(k = 15;k >= n;k--) /* { dg-warning "assuming.*not infinite" } */ + g(); + +}
pr19210-2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: phi-opt-1.c =================================================================== --- phi-opt-1.c (nonexistent) +++ phi-opt-1.c (revision 816) @@ -0,0 +1,19 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-optimized" } */ + +int f(int a, int b, int c) +{ + if (c == 0) goto temp; + if (a == 0) + return 0; +temp: + if (a == b) + return a; + return a; +} + +/* There should be no ifs as the PHI arguments, we did not + optimize this before because PHI-OPT did not look at + PHIs which have more than two arguments. */ +/* { dg-final { scan-tree-dump-times "if" 0 "optimized"} } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */
phi-opt-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pr23433.c =================================================================== --- pr23433.c (nonexistent) +++ pr23433.c (revision 816) @@ -0,0 +1,12 @@ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +double transport_sumexp(int numexp) +{ + int k,j; + double xk1 = 1.0; + for(k=1; k<=numexp;k++) + for(j=1;j<=3;j++) + xk1 += 1.0; + return xk1; +}
pr23433.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: stdarg-3.c =================================================================== --- stdarg-3.c (nonexistent) +++ stdarg-3.c (revision 816) @@ -0,0 +1,193 @@ +/* First dg-final line after each function is for architectures that use + a struct {...} va_list[1] with separate GPR and FPR counters in the + structure. Second dg-final line is for architectures that use void * + or char * va_list. */ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-stdarg" } */ + +#include + +extern void foo (int, va_list); +extern void bar (int); +long x; +va_list gap; + +/* If va_list is not local variable, it escapes the function. */ +void +f1 (int i, ...) +{ + va_start (gap, i); + x = va_arg (gap, long); + va_end (gap); +} +/* { dg-final { scan-tree-dump "f1: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && lp64 } } } } */ +/* { dg-final { scan-tree-dump "f1: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target { powerpc*-*-linux* && ilp32 } } } } */ +/* { dg-final { scan-tree-dump "f1: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target alpha*-*-linux* } } } */ +/* { dg-final { scan-tree-dump "f1: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target s390*-*-linux* } } } */ +/* { dg-final { scan-tree-dump "f1: va_list escapes 1, needs to save all GPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } } */ +/* { dg-final { scan-tree-dump "f1: va_list escapes 1, needs to save all GPR units" "stdarg" { target ia64-*-* } } } */ +/* { dg-final { scan-tree-dump "f1: va_list escapes 1, needs to save all GPR units" "stdarg" { target { powerpc*-*-* && lp64 } } } } */ + +void +f2 (int i, ...) +{ + va_start (gap, i); + bar (i); + va_end (gap); +} +/* { dg-final { scan-tree-dump "f2: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && lp64 } } } } */ +/* { dg-final { scan-tree-dump "f2: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target { powerpc*-*-linux* && ilp32 } } } } */ +/* { dg-final { scan-tree-dump "f2: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target alpha*-*-linux* } } } */ +/* { dg-final { scan-tree-dump "f2: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target s390*-*-linux* } } } */ +/* { dg-final { scan-tree-dump "f2: va_list escapes 1, needs to save all GPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } } */ +/* { dg-final { scan-tree-dump "f2: va_list escapes 1, needs to save all GPR units" "stdarg" { target ia64-*-* } } } */ +/* { dg-final { scan-tree-dump "f2: va_list escapes 1, needs to save all GPR units" "stdarg" { target { powerpc*-*-* && lp64 } } } } */ + +/* tree-stdarg.c only handles va_list variables, not arrays of them or + va_list fields embedded in structures. */ +void +f3 (int i, ...) +{ + va_list aps[10]; + va_start (aps[4], i); + x = va_arg (aps[4], long); + va_end (aps[4]); +} +/* { dg-final { scan-tree-dump "f3: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && lp64 } } } } */ +/* { dg-final { scan-tree-dump "f3: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target { powerpc*-*-linux* && ilp32 } } } } */ +/* { dg-final { scan-tree-dump "f3: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target alpha*-*-linux* } } } */ +/* { dg-final { scan-tree-dump "f3: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target s390*-*-linux* } } } */ +/* { dg-final { scan-tree-dump "f3: va_list escapes 1, needs to save all GPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } } */ +/* { dg-final { scan-tree-dump "f3: va_list escapes 1, needs to save all GPR units" "stdarg" { target ia64-*-* } } } */ +/* { dg-final { scan-tree-dump "f3: va_list escapes 1, needs to save all GPR units" "stdarg" { target { powerpc*-*-* && lp64 } } } } */ + +void +f4 (int i, ...) +{ + va_list aps[10]; + va_start (aps[4], i); + bar (i); + va_end (aps[4]); +} +/* { dg-final { scan-tree-dump "f4: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && lp64 } } } } */ +/* { dg-final { scan-tree-dump "f4: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target { powerpc*-*-linux* && ilp32 } } } } */ +/* { dg-final { scan-tree-dump "f4: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target alpha*-*-linux* } } } */ +/* { dg-final { scan-tree-dump "f4: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target s390*-*-linux* } } } */ +/* { dg-final { scan-tree-dump "f4: va_list escapes 1, needs to save all GPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } } */ +/* { dg-final { scan-tree-dump "f4: va_list escapes 1, needs to save all GPR units" "stdarg" { target ia64-*-* } } } */ +/* { dg-final { scan-tree-dump "f4: va_list escapes 1, needs to save all GPR units" "stdarg" { target { powerpc*-*-* && lp64 } } } } */ + +void +f5 (int i, ...) +{ + va_list aps[10]; + va_start (aps[4], i); + foo (i, aps[4]); + va_end (aps[4]); +} +/* { dg-final { scan-tree-dump "f5: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && lp64 } } } } */ +/* { dg-final { scan-tree-dump "f5: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target { powerpc*-*-linux* && ilp32 } } } } */ +/* { dg-final { scan-tree-dump "f5: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target alpha*-*-linux* } } } */ +/* { dg-final { scan-tree-dump "f5: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target s390*-*-linux* } } } */ +/* { dg-final { scan-tree-dump "f5: va_list escapes 1, needs to save all GPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } } */ +/* { dg-final { scan-tree-dump "f5: va_list escapes 1, needs to save all GPR units" "stdarg" { target ia64-*-* } } } */ +/* { dg-final { scan-tree-dump "f5: va_list escapes 1, needs to save all GPR units" "stdarg" { target { powerpc*-*-* && lp64 } } } } */ + +struct A { int i; va_list g; va_list h[2]; }; + +void +f6 (int i, ...) +{ + struct A a; + va_start (a.g, i); + x = va_arg (a.g, long); + va_end (a.g); +} +/* { dg-final { scan-tree-dump "f6: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && lp64 } } } } */ +/* { dg-final { scan-tree-dump "f6: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target { powerpc*-*-linux* && ilp32 } } } } */ +/* { dg-final { scan-tree-dump "f6: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target alpha*-*-linux* } } } */ +/* { dg-final { scan-tree-dump "f6: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target s390*-*-linux* } } } */ +/* { dg-final { scan-tree-dump "f6: va_list escapes 1, needs to save all GPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } } */ +/* { dg-final { scan-tree-dump "f6: va_list escapes 1, needs to save all GPR units" "stdarg" { target ia64-*-* } } } */ +/* { dg-final { scan-tree-dump "f6: va_list escapes 1, needs to save all GPR units" "stdarg" { target { powerpc*-*-* && lp64 } } } } */ + +void +f7 (int i, ...) +{ + struct A a; + va_start (a.g, i); + bar (i); + va_end (a.g); +} +/* { dg-final { scan-tree-dump "f7: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && lp64 } } } } */ +/* { dg-final { scan-tree-dump "f7: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target { powerpc*-*-linux* && ilp32 } } } } */ +/* { dg-final { scan-tree-dump "f7: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target alpha*-*-linux* } } } */ +/* { dg-final { scan-tree-dump "f7: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target s390*-*-linux* } } } */ +/* { dg-final { scan-tree-dump "f7: va_list escapes 1, needs to save all GPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } } */ +/* { dg-final { scan-tree-dump "f7: va_list escapes 1, needs to save all GPR units" "stdarg" { target ia64-*-* } } } */ +/* { dg-final { scan-tree-dump "f7: va_list escapes 1, needs to save all GPR units" "stdarg" { target { powerpc*-*-* && lp64 } } } } */ + +void +f8 (int i, ...) +{ + struct A a; + va_start (a.g, i); + foo (i, a.g); + va_end (a.g); +} +/* { dg-final { scan-tree-dump "f8: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && lp64 } } } } */ +/* { dg-final { scan-tree-dump "f8: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target { powerpc*-*-linux* && ilp32 } } } } */ +/* { dg-final { scan-tree-dump "f8: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target alpha*-*-linux* } } } */ +/* { dg-final { scan-tree-dump "f8: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target s390*-*-linux* } } } */ +/* { dg-final { scan-tree-dump "f8: va_list escapes 1, needs to save all GPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } } */ +/* { dg-final { scan-tree-dump "f8: va_list escapes 1, needs to save all GPR units" "stdarg" { target ia64-*-* } } } */ +/* { dg-final { scan-tree-dump "f8: va_list escapes 1, needs to save all GPR units" "stdarg" { target { powerpc*-*-* && lp64 } } } } */ + +void +f10 (int i, ...) +{ + struct A a; + va_start (a.h[1], i); + x = va_arg (a.h[1], long); + va_end (a.h[1]); +} +/* { dg-final { scan-tree-dump "f10: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && lp64 } } } } */ +/* { dg-final { scan-tree-dump "f10: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target { powerpc*-*-linux* && ilp32 } } } } */ +/* { dg-final { scan-tree-dump "f10: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target alpha*-*-linux* } } } */ +/* { dg-final { scan-tree-dump "f10: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target s390*-*-linux* } } } */ +/* { dg-final { scan-tree-dump "f10: va_list escapes 1, needs to save all GPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } } */ +/* { dg-final { scan-tree-dump "f10: va_list escapes 1, needs to save all GPR units" "stdarg" { target ia64-*-* } } } */ +/* { dg-final { scan-tree-dump "f10: va_list escapes 1, needs to save all GPR units" "stdarg" { target { powerpc*-*-* && lp64 } } } } */ + +void +f11 (int i, ...) +{ + struct A a; + va_start (a.h[1], i); + bar (i); + va_end (a.h[1]); +} +/* { dg-final { scan-tree-dump "f11: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && lp64 } } } } */ +/* { dg-final { scan-tree-dump "f11: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target { powerpc*-*-linux* && ilp32 } } } } */ +/* { dg-final { scan-tree-dump "f11: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target alpha*-*-linux* } } } */ +/* { dg-final { scan-tree-dump "f11: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target s390*-*-linux* } } } */ +/* { dg-final { scan-tree-dump "f11: va_list escapes 1, needs to save all GPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } } */ +/* { dg-final { scan-tree-dump "f11: va_list escapes 1, needs to save all GPR units" "stdarg" { target ia64-*-* } } } */ +/* { dg-final { scan-tree-dump "f11: va_list escapes 1, needs to save all GPR units" "stdarg" { target { powerpc*-*-* && lp64 } } } } */ + +void +f12 (int i, ...) +{ + struct A a; + va_start (a.h[1], i); + foo (i, a.h[1]); + va_end (a.h[1]); +} +/* { dg-final { scan-tree-dump "f12: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && lp64 } } } } */ +/* { dg-final { scan-tree-dump "f12: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target { powerpc*-*-linux* && ilp32 } } } } */ +/* { dg-final { scan-tree-dump "f12: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target alpha*-*-linux* } } } */ +/* { dg-final { scan-tree-dump "f12: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target s390*-*-linux* } } } */ +/* { dg-final { scan-tree-dump "f12: va_list escapes 1, needs to save all GPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } } */ +/* { dg-final { scan-tree-dump "f12: va_list escapes 1, needs to save all GPR units" "stdarg" { target ia64-*-* } } } */ +/* { dg-final { scan-tree-dump "f12: va_list escapes 1, needs to save all GPR units" "stdarg" { target { powerpc*-*-* && lp64 } } } } */ +/* { dg-final { cleanup-tree-dump "stdarg" } } */
stdarg-3.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pr19633.c =================================================================== --- pr19633.c (nonexistent) +++ pr19633.c (revision 816) @@ -0,0 +1,26 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-ssa-vops" } */ +struct S +{ + int w, x, y, z; +}; +struct T +{ + int r; + struct S s; +}; +void bar (struct S, int); +void +foo (int a, struct T b) +{ + struct S x; + struct S *c = &x; + if (a) + c = &b.s; + bar (*c, a); +} + +/* Make sure that .GLOBAL_VAR is not created when there are no + clobbering calls. */ +/* { dg-final { scan-tree-dump-times "GLOBAL_VAR" 0 "ssa"} } */ +/* { dg-final { cleanup-tree-dump "ssa" } } */
pr19633.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pr15791-3.c =================================================================== --- pr15791-3.c (nonexistent) +++ pr15791-3.c (revision 816) @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-options "-fdump-tree-gimple" } */ + +int f(int i, unsigned j) +{ + int b[2]; + if (&b[i] == &b[j]) + return 1; + return 0; +} + +/* { dg-final { scan-tree-dump-times "i == j" 0 "gimple" } } */ +/* { dg-final { cleanup-tree-dump "gimple" } } */
pr15791-3.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: alias-5.c =================================================================== --- alias-5.c (nonexistent) +++ alias-5.c (revision 816) @@ -0,0 +1,23 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-optimized" } */ + +struct { + int i; + struct { + struct { + int i; + } x[2]; + } b; +} a; + +int foo(void) +{ + a.i = 1; + a.b.x[0].i = 0; + a.b.x[1].i = 1; + return a.i + a.b.x[0].i; +} + +/* { dg-final { scan-tree-dump "return 1;" "optimized" } } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */ +
alias-5.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20040216-1.c =================================================================== --- 20040216-1.c (nonexistent) +++ 20040216-1.c (revision 816) @@ -0,0 +1,18 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-dse1-details" } */ + +foo(int *z, int *y, int xx) +{ + *z = 1; + if (xx) + xx = 20; + else + xx = 30; + *z = 2; + *z = 3; + return xx; +} + +/* We should convert two COND_EXPRs into straightline code. */ +/* { dg-final { scan-tree-dump-times "Deleted dead store" 2 "dse1"} } */ +/* { dg-final { cleanup-tree-dump "dse1" } } */
20040216-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: upcast-1.c =================================================================== --- upcast-1.c (nonexistent) +++ upcast-1.c (revision 816) @@ -0,0 +1,12 @@ +/* { do-go compile } */ +/* { dg-options "-fdump-tree-gimple" } */ + +typedef struct { int i; } Foo; +Foo foo; +Foo *bar(void) +{ + return (Foo *)&foo.i; +} + +/* { dg-final { scan-tree-dump "&foo;" "gimple" } } */ +/* { dg-final { cleanup-tree-dump "gimple" } } */
upcast-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20030714-2.c =================================================================== --- 20030714-2.c (nonexistent) +++ 20030714-2.c (revision 816) @@ -0,0 +1,39 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-dom3" } */ + + +union tree_node; +typedef union tree_node *tree; +extern const char tree_code_type[]; +struct tree_common +{ + int code; + tree type; +}; +struct tree_exp +{ + tree operands[1]; +}; +union tree_node +{ + struct tree_common common; + struct tree_exp exp; +}; +long +get_alias_set (t) + tree t; +{ + if (tree_code_type[t->common.code] != 't' && t->common.type == 0) + return 0; + if (tree_code_type[t->common.code] != 't') + { + while (t->exp.operands[0]) + t = t->exp.operands[0]; + } +} + +/* There should be exactly three IF conditionals if we thread jumps + properly. */ +/* { dg-final { scan-tree-dump-times "if " 3 "dom3"} } */ + +/* { dg-final { cleanup-tree-dump "dom3" } } */
20030714-2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pr27498.c =================================================================== --- pr27498.c (nonexistent) +++ pr27498.c (revision 816) @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-options "-O -fdump-tree-optimized" } */ + +void zconfdump(void) +{ + char *p, *p2; + for (p2 = p; p2; ) + { + char __a0, __a1, __a2; + __a0 = ((__const char *) ("\"\\"))[0]; + if (__a0) + return; + } +} + +/* { dg-final { scan-tree-dump-not "goto" "optimized" } } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */
pr27498.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ssa-fre-5.c =================================================================== --- ssa-fre-5.c (nonexistent) +++ ssa-fre-5.c (revision 816) @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-options "-O -fdump-tree-fre-details" } */ + +/* From PR19792. */ + +int +bar (unsigned int t) +{ + int a = t; + return a == t; +} + +/* { dg-final { scan-tree-dump "Replaced \\\(unsigned int\\\) a_.*with t_" "fre" } } */ +/* { dg-final { cleanup-tree-dump "fre" } } */
ssa-fre-5.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: divide-3.c =================================================================== --- divide-3.c (nonexistent) +++ divide-3.c (revision 816) @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fstrict-overflow -fdump-tree-optimized" } */ + +int f(int a) +{ + return -(a/10); +} + +/* { dg-final { scan-tree-dump-times "a / 10" 0 "optimized"} } */ +/* { dg-final { scan-tree-dump-times "a / -10" 1 "optimized"} } */ + +/* { dg-final { cleanup-tree-dump "optimized" } } */ + +
divide-3.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: wholeprogram-1.c =================================================================== --- wholeprogram-1.c (nonexistent) +++ wholeprogram-1.c (revision 816) @@ -0,0 +1,23 @@ +/* { dg-options "-O2 -fdump-tree-optimized -fwhole-program" } */ +int b[100]; +void abort (void); + +void +large_function () +{ + int i; + for (i = 0; i < 99; i++) + if (b[i] / (b[i+1] + 1)) + abort (); +} + +main () +{ + large_function (); +} + +/* Function should be inlined as called once. */ +/* { dg-final { scan-tree-dump-not "large_function" "optimized"} } */ + +/* { dg-final { cleanup-tree-dump "optimized" } } */ +
wholeprogram-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20030814-7.c =================================================================== --- 20030814-7.c (nonexistent) +++ 20030814-7.c (revision 816) @@ -0,0 +1,42 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-dom3" } */ + +extern void abort (void); +struct rtx_def; +typedef struct rtx_def *rtx; +struct rtvec_def; +typedef struct rtvec_def *rtvec; +union tree_node; +typedef union tree_node *tree; +struct tree_common +{ + int code; +}; +union tree_node +{ + struct tree_common common; +}; +extern tree current_function_decl; +struct cgraph_rtl_info +{ + _Bool pure_function; +}; +struct cgraph_rtl_info *cgraph_rtl_info (tree); +void +mark_constant_function (void) +{ + rtx insn; + int nonlocal_memory_referenced; + + if (current_function_decl->common.code != 42) + abort (); + + cgraph_rtl_info (current_function_decl)->pure_function = 1; +} + +/* current_function_decl should be loaded once into a temporary + and the temporary used as the argument to cgraph_rtl_info. + This if we find current_function_decl used as an argument, then + we have failed. */ +/* { dg-final { scan-tree-dump-times "\\(current_function_decl\\)" 0 "dom3"} } */ +/* { dg-final { cleanup-tree-dump "dom3" } } */
20030814-7.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ssa-ccp-10.c =================================================================== --- ssa-ccp-10.c (nonexistent) +++ ssa-ccp-10.c (revision 816) @@ -0,0 +1,34 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-fab" } */ + +/* Check that we fold strlen of equally long strings, and that we do not + fail to terminate when there is a nontrivial cycle in the corresponding + ssa graph. */ + +extern __SIZE_TYPE__ strlen (const char *); + +void foo(int i) +{ + char *s = "abcde"; + + if (i) + { + s = "defgh"; + goto middle; + } + +start: + + bla (); + +middle: + + if (bla ()) + goto start; + + bar (strlen (s)); +} + +/* There should be no calls to strlen. */ +/* { dg-final { scan-tree-dump-times "strlen" 0 "fab"} } */ +/* { dg-final { cleanup-tree-dump "fab" } } */
ssa-ccp-10.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: complex-4.c =================================================================== --- complex-4.c (nonexistent) +++ complex-4.c (revision 816) @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-optimized" } */ +int g(_Complex int*); +int f(void) +{ + _Complex int t = 0; + int i, j; + __real__ t += 2; + __imag__ t += 2; + return g(&t); +} + +/* { dg-final { scan-tree-dump-times "__complex__" 0 "optimized" } } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */
complex-4.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: bool-10.c =================================================================== --- bool-10.c (nonexistent) +++ bool-10.c (revision 816) @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-optimized" } */ + +int f(_Bool x) +{ + return (x != 1); +} + +/* There should be no != 1 which is produced by the front-end as + bool_var != 1 is the same as !bool_var. */ +/* { dg-final { scan-tree-dump-times "!= 1" 0 "optimized"} } */ +/* { dg-final { scan-tree-dump-times "!x" 1 "optimized"} } */ + +/* { dg-final { cleanup-tree-dump "optimized" } } */
bool-10.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pr22051-1.c =================================================================== --- pr22051-1.c (nonexistent) +++ pr22051-1.c (revision 816) @@ -0,0 +1,23 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-optimized" } */ + + +void *arf (); +int +foo() +{ + void *p = arf (); + + if ((void (*)(void))p != 0) + return 1; + else + return 2; +} + +/* The cast to a function pointer type must remain after all optimizations + are complete so that function pointer canonicalization works on those + targets which require it. */ +/* { dg-final { scan-tree-dump-times "if \\(\\(void \\(\\*<.*>\\) \\(void\\)\\) p" 1 "optimized" } } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */ + +
pr22051-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: vrp23.c =================================================================== --- vrp23.c (nonexistent) +++ vrp23.c (revision 816) @@ -0,0 +1,45 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-vrp1-details" } */ + +blah (int code1, int code2) +{ + int i; + int n_sets; + + n_sets = (int) (code1 == 32); + if (code2 == 64) goto L2; else goto L3; + +L2: + aa (); + +L3: + if (n_sets > 1) goto L4; else goto L10; + +L4: + aos (); + i = 0; + goto L24; + +L10: + if (n_sets > 0) goto L25; else goto L8; + +L25: + i = 0; + +L24: + aob (); + i = i + 1; + if (i < n_sets) goto L24; else goto L8; + +L8: + return; +} + + + +/* The n_sets > 0 test can be simplified into n_sets == 1 since the + only way to reach the test is when n_sets <= 1, and the only value + which satisfies both conditions is n_sets == 1. */ +/* { dg-final { scan-tree-dump-times "Simplified relational" 1 "vrp1" } } */ +/* { dg-final { cleanup-tree-dump "vrp1" } } */ +
vrp23.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ssa-dce-1.c =================================================================== --- ssa-dce-1.c (nonexistent) +++ ssa-dce-1.c (revision 816) @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-dce3" } */ + +int t() __attribute__ ((const)); +q() +{ + int i = t(); + if (!i) + i = t(); +} +/* There should be no IF conditionals. */ +/* { dg-final { scan-tree-dump-times "if " 0 "dce3"} } */ +/* { dg-final { cleanup-tree-dump "dce3" } } */
ssa-dce-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: vrp06.c =================================================================== --- vrp06.c (nonexistent) +++ vrp06.c (revision 816) @@ -0,0 +1,31 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-vrp1" } */ + +foo (int i, int j, int a) +{ + if (i >= 10) + if (i <= 30) + if (i == j) + { + a--; + + /* This should fold to 'if (0)'. */ + if (i < 0) + i = baz (); + + /* This should fold to 'if (1)'. */ + if (j > 0) + a--; + + /* This should fold to 'if (0)'. */ + if (i != j) + return 0; + } + + return i + a + j; +} + +/* { dg-final { scan-tree-dump-times "Folding predicate i_.*to 0" 1 "vrp1" } } */ +/* { dg-final { scan-tree-dump-times "Folding predicate j_.*to 1" 1 "vrp1" } } */ +/* { dg-final { scan-tree-dump-times "Folding predicate i_.*to 0" 1 "vrp1" } } */ +/* { dg-final { cleanup-tree-dump "vrp1" } } */
vrp06.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pr22117.c =================================================================== --- pr22117.c (nonexistent) +++ pr22117.c (revision 816) @@ -0,0 +1,23 @@ +/* PR tree-optimization/22117 + VRP used think that &p[q] is nonzero even though p and q are both + known to be zero after entering the first two "if" statements. */ + +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-vrp1" } */ + +void +foo (int *p, int q) +{ + if (p == 0) + { + if (q == 0) + { + int *r = &p[q]; + if (r != 0) + link_error (); + } + } +} + +/* { dg-final { scan-tree-dump-times "Folding predicate r_.* != 0B to 0" 1 "vrp1" } } */ +/* { dg-final { cleanup-tree-dump "vrp1" } } */
pr22117.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pr25501.c =================================================================== --- pr25501.c (nonexistent) +++ pr25501.c (revision 816) @@ -0,0 +1,36 @@ +/* PR tree-optimization/25501 + The PHI merge pass used to try to merge PHI nodes that cannot + actually merged, causing a segfault later. Make sure that does not + happen any more. */ + +/* { dg-options "-O1 -fdump-tree-mergephi" } */ + +int +foo (int a) +{ + int b; + int c; + int d; + + if (a == 2) + b = 3; + else + b = 5; + + c = 7; + + d = 11; + + for (;;) + { + if (d == 5) + break; + + d = b; + } + + return 13; +} + +/* { dg-final { scan-tree-dump-times "Removing basic block" 0 "mergephi"} } */ +/* { dg-final { cleanup-tree-dump "mergephi" } } */
pr25501.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ssa-pre-7.c =================================================================== --- ssa-pre-7.c (nonexistent) +++ ssa-pre-7.c (revision 816) @@ -0,0 +1,12 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fno-tree-dominator-opts -fdump-tree-fre-stats" } */ +int +foo (int *array) +{ + if (array[1] != 0) + return array[1]; + return 0; +} +/* We should eliminate one address calculation, and one load. */ +/* { dg-final { scan-tree-dump-times "Eliminated: 2" 1 "fre"} } */ +/* { dg-final { cleanup-tree-dump "fre" } } */
ssa-pre-7.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pr20139.c =================================================================== --- pr20139.c (nonexistent) +++ pr20139.c (revision 816) @@ -0,0 +1,23 @@ +/* PR tree-optimization/20139 + This testcase is derived from gcc.dg/20020720-1.c. Here we check + that the optimization happens at tree level. */ + +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-final_cleanup" } */ + +extern double fabs (double); +extern void link_error (void); + +void +foo (double x) +{ + double p, q; + + p = fabs (x); + q = 0.0; + if (p < q) + link_error (); +} + +/* { dg-final { scan-tree-dump-times "link_error" 0 "final_cleanup" } } */ +/* { dg-final { cleanup-tree-dump "final_cleanup" } } */
pr20139.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pr14490-2.c =================================================================== --- pr14490-2.c (nonexistent) +++ pr14490-2.c (revision 816) @@ -0,0 +1,10 @@ +/* { dg-do compile } */ +/* { dg-options "-fdump-tree-gimple -fwrapv" } */ +int g(int x) +{ + return (x - 10) < 0; +} +/* There should be no x >= 9 and one x - 10. */ +/* { dg-final { scan-tree-dump-times "<= 9" 0 "gimple"} } */ +/* { dg-final { scan-tree-dump-times "\\+ -10" 1 "gimple"} } */ +/* { dg-final { cleanup-tree-dump "gimple" } } */
pr14490-2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20030807-11.c =================================================================== --- 20030807-11.c (nonexistent) +++ 20030807-11.c (revision 816) @@ -0,0 +1,21 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-dom3" } */ + +extern void abort (void); +struct rtx_def; +typedef struct rtx_def *rtx; +struct rtx_def +{ + int code; +}; +foo (reg) + rtx reg; +{ + reg->code = 42; + if (reg->code != 42) + abort (); +} + +/* There should be no IF conditionals. */ +/* { dg-final { scan-tree-dump-times "if " 0 "dom3"} } */ +/* { dg-final { cleanup-tree-dump "dom3" } } */
20030807-11.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: sra-2.c =================================================================== --- sra-2.c (nonexistent) +++ sra-2.c (revision 816) @@ -0,0 +1,26 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-optimized --param sra-max-structure-size=32" } */ + +/* Test for SRA. */ + +typedef struct teststruct +{ + double d; + char f1; +} teststruct; + + +void +copystruct11 (teststruct *param) +{ + static teststruct local; + param->f1 = 0; + local = *param; + if (local.f1 != 0) + link_error (); +} + + +/* There should be no reference to link_error. */ +/* { dg-final { scan-tree-dump-times "link_error" 0 "optimized" { xfail *-*-* } } } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */
sra-2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pr23386.c =================================================================== --- pr23386.c (nonexistent) +++ pr23386.c (revision 816) @@ -0,0 +1,24 @@ +/* { dg-do run } */ +/* { dg-options "-O2" } */ + +int f[100]; +int g[100]; +unsigned char +f1 (int a, int b) +{ + __SIZE_TYPE__ ix; + if (a) + return 1; + for (ix = 4; ix--;) + if (f[ix] != g[ix]) + return 0; + return 1; +} + +int main(void) +{ + if (!f1 (0, 2)) + __builtin_abort(); + return 0; +} +
pr23386.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: gen-vect-11a.c =================================================================== --- gen-vect-11a.c (nonexistent) +++ gen-vect-11a.c (revision 816) @@ -0,0 +1,38 @@ +/* { dg-do run { target vect_cmdline_needed } } */ +/* { dg-options "-O2 -ftree-vectorize -ftree-vectorizer-verbose=3 -fdump-tree-vect-stats" } */ + +#include + +#define N 16 + +#if __LONG_MAX__ == 2147483647 +typedef short half_word; +#else +typedef int half_word; +#endif + +int main () +{ + int i; + half_word ia[N]; + half_word ic[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; + half_word ib[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; + + for (i = 0; i < N; i++) + { + ia[i] = ib[i] & ic[i]; + } + + /* check results: */ + for (i = 0; i < N; i++) + { + if (ia[i] != ib[i] & ic[i]) + abort (); + } + + return 0; +} + + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */ +/* { dg-final { cleanup-tree-dump "vect" } } */
gen-vect-11a.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20040302-1.c =================================================================== --- 20040302-1.c (nonexistent) +++ 20040302-1.c (revision 816) @@ -0,0 +1,8 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 --param global-var-threshold=0" } */ + +/* Test for .GLOBAL_VAR not being renamed into SSA after alias analysis. + provided by Dale Johannesen in PR 14266. */ + +void foo() { bar (); } +main () { foo (); }
20040302-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ssa-pre-11.c =================================================================== --- ssa-pre-11.c (nonexistent) +++ ssa-pre-11.c (revision 816) @@ -0,0 +1,21 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-pre-stats" } */ +double cos (double); +double f(double a) +{ + double b; + double c,d; + if (a < 2.0) + { + c = cos (a); + } + else + { + c = 1.0; + } + d = cos (a); + return d + c; +} + +/* { dg-final { scan-tree-dump-times "Eliminated: 1" 1 "pre"} } */ +/* { dg-final { cleanup-tree-dump "pre" } } */
ssa-pre-11.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ssa-sink-4.c =================================================================== --- ssa-sink-4.c (nonexistent) +++ ssa-sink-4.c (revision 816) @@ -0,0 +1,21 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-sink-stats" } */ +extern int foo (int *, int *); +extern int foo2 (int); +int +main (int argc) +{ + int a, b, c; + b = argc + 1; + c = argc + 2; + a = b + c; + if (argc) + { + foo (&b, &c); + a = b + c; + } + foo2 (a); +} +/* We should sink the first a = b + c calculation into the else branch */ +/* { dg-final { scan-tree-dump-times "Sunk statements:1" 1 "sink" } } */ +/* { dg-final { cleanup-tree-dump "sink" } } */
ssa-sink-4.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: flatten-1.c =================================================================== --- flatten-1.c (nonexistent) +++ flatten-1.c (revision 816) @@ -0,0 +1,55 @@ +/* { dg-do compile } */ +/* { dg-options -O2 } */ + +/* Basic tests for flatten attribute, check we end up + with only the flattened function bodies. */ + +static int foobar(int i); +static int bar(int i); + +int __attribute__((flatten)) leaf0a(int i) +{ + return bar(i); +} +int __attribute__((flatten)) leaf0b(int i) +{ + return foobar(i); +} +int __attribute__((flatten)) leaf1(int i) +{ + return bar(foobar(i)); +} +int __attribute__((flatten)) leaf2(int i) +{ + int j; + j = foobar(i); + return bar(j); +} + +static int foobar(int i) +{ + return i-1; +} +static int bar(int i) +{ + return i + foobar(i); +} + + +static int gloobar(int i) +{ + return i*5+1; +} +static int floobar(int i) +{ + return gloobar(i); +} +int __attribute__((flatten)) leaf3(int i) +{ + int j; + j = floobar(i); + j += floobar(i); + return j; +} + +/* { dg-final { scan-assembler-not "bar\[: \t\n\]" } } */
flatten-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: loadpre15.c =================================================================== --- loadpre15.c (nonexistent) +++ loadpre15.c (revision 816) @@ -0,0 +1,19 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-pre-stats" } */ +typedef int type[2]; +int main(type *a, int argc, int t) +{ + type c = {0, 1}; + int d, e; + + /* Should be able to eliminate the second load of *a along the main path. */ + d = (*a)[t]; + if (argc) + { + a = &c; + } + e = (*a)[t]; + return d + e; +} +/* { dg-final { scan-tree-dump-times "Eliminated: 1" 1 "pre" { xfail *-*-* } } } */ +/* { dg-final { cleanup-tree-dump "pre" } } */
loadpre15.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: loop-16.c =================================================================== --- loop-16.c (nonexistent) +++ loop-16.c (revision 816) @@ -0,0 +1,24 @@ +/* A test for # of iterations estimation. We know that the loop is executed + at most 100 times, thus the (32-bit) induction variables do not overflow, + and we may use 64-bit variable to represent them. */ + +/* { dg-options "-O2 -fdump-tree-optimized" } */ +/* { dg-do compile { target x86_64-*-* } } */ + +unsigned a[100]; + +void foo(unsigned n) +{ + unsigned i; + + for (i = 0; i < n; i++) + a[i] = 4 * i; +} + +/* Check that the memory reference was replaced with MEM, and that there is no + multiplication. */ + +/* { dg-final { scan-tree-dump-times "MEM" 1 "optimized" } } */ +/* { dg-final { scan-tree-dump-times "\[^\\n\\r\]*= \\* " 0 "optimized" } } */ + +/* { dg-final { cleanup-tree-dump "optimized" } } */
loop-16.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: gen-vect-26.c =================================================================== --- gen-vect-26.c (nonexistent) +++ gen-vect-26.c (revision 816) @@ -0,0 +1,34 @@ +/* { dg-do run { target vect_cmdline_needed } } */ +/* { dg-options "-O2 -ftree-vectorize -ftree-vectorizer-verbose=3 -fdump-tree-vect-stats" } */ + +#include + +#define N 128 + +/* unaligned store. */ + +int main () +{ + int i; + char ia[N+1]; + + for (i = 1; i <= N; i++) + { + ia[i] = 5; + } + + /* check results: */ + for (i = 1; i <= N; i++) + { + if (ia[i] != 5) + abort (); + } + + return 0; +} + + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */ +/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" } } */ +/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 1 "vect" } } */ +/* { dg-final { cleanup-tree-dump "vect" } } */
gen-vect-26.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ssa-dse-1.c =================================================================== --- ssa-dse-1.c (nonexistent) +++ ssa-dse-1.c (revision 816) @@ -0,0 +1,26 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-dse1" } */ + +int +foo (int a, int b, int c) +{ + int *p; + if (c) + p = &a; + else + p = &b; + + *p = 3; + *p = 4; + return *p; +} + + +/* We should eliminate both assignments to *p. */ +/* { dg-final { scan-tree-dump-times " = 3" 0 "dse1"} } */ +/* { dg-final { scan-tree-dump-times " = 4" 0 "dse1"} } */ + +/* The return *p should be turned into return 4. */ +/* { dg-final { scan-tree-dump-times " return 4" 1 "dse1"} } */ + +/* { dg-final { cleanup-tree-dump "dse1" } } */
ssa-dse-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: bool-7.c =================================================================== --- bool-7.c (nonexistent) +++ bool-7.c (revision 816) @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-optimized" } */ + +int f(_Bool x) +{ + int y; + if (x != 1) + y = 0; + else + y = 1; + return y; +} + +/* There should be no != 1. Fold changes x != 1 to ! x. */ +/* { dg-final { scan-tree-dump-times "!= 1" 0 "optimized" } } */ + +/* { dg-final { cleanup-tree-dump "optimized" } } */
bool-7.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20030907-1.c =================================================================== --- 20030907-1.c (nonexistent) +++ 20030907-1.c (revision 816) @@ -0,0 +1,30 @@ +/* PR optimization/12198 + + This was a miscompilation of a switch expressions because + the "Case Ranges" extension wasn't handled in tree-cfg.c. */ + +/* { dg-do compile } */ +/* { dg-options "-O -fdump-tree-optimized" } */ + +extern void abort (void); +extern void exit (int); + +int main() +{ + int i; + i = 2; + switch (i) + { + case 1 ... 5: + goto L1; + default: + abort (); + goto L1; + } + L1: + exit(0); +} + +/* The abort() call clearly is unreachable. */ +/* { dg-final { scan-tree-dump-times "abort" 0 "optimized"} } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */
20030907-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ltrans-4.c =================================================================== --- ltrans-4.c (nonexistent) +++ ltrans-4.c (revision 816) @@ -0,0 +1,20 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -ftree-loop-linear -fdump-tree-ltrans-all" } */ +/* { dg-require-effective-target size32plus } */ + +double u[1782225]; +int foo(int N, int *res) +{ + int i, j; + double sum = 0; + for (i = 0; i < N; i++) + for (j = 0; j < N; j++) + sum = sum + u[i + 1335 * j]; + + for (i = 0; i < N; i++) + u[1336 * i] *= 2; + *res = sum + N; +} + +/* { dg-final { scan-tree-dump-times "transformed loop" 1 "ltrans"} } */ +/* { dg-final { cleanup-tree-dump "ltrans" } } */
ltrans-4.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20030709-3.c =================================================================== --- 20030709-3.c (nonexistent) +++ 20030709-3.c (revision 816) @@ -0,0 +1,48 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-dom3" } */ + +extern void abort (void); + +union tree_node; +typedef union tree_node *tree; +enum tree_code +{ + TREE_VEC = 20, +}; +struct tree_common +{ + int code; +}; +struct tree_type +{ + tree binfo; +}; +union tree_node +{ + struct tree_common common; + struct tree_type type; +}; +void +record_component_aliases (type) + tree type; +{ + const tree __z = type->type.binfo; + if (type->type.binfo->common.code != TREE_VEC) + abort (); + + if (__z->common.code != TREE_VEC) + abort (); +} + +/* There should be precisely one load of type.binfo. If there is + more than one, then the dominator optimizations failed. */ +/* { dg-final { scan-tree-dump-times "type\\.binfo" 1 "dom3"} } */ + +/* There should be precisely one load of common.code. If there is + more than one, then the dominator optimizations failed. */ +/* { dg-final { scan-tree-dump-times "common\\.code" 1 "dom3"} } */ + +/* There should be one IF conditional. */ +/* { dg-final { scan-tree-dump-times "if " 1 "dom3"} } */ + +/* { dg-final { cleanup-tree-dump "dom3" } } */
20030709-3.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: reassoc-8.c =================================================================== --- reassoc-8.c (nonexistent) +++ reassoc-8.c (revision 816) @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-reassoc1" } */ + +int main(int a, int b, int c, int d, int e, int f, int g, int h) +{ + /* e & ~e -> 0 */ + int i = (a & 9) & (c & d); + int j = (~e & d) & (~c & e); + e = i & j; + return e; +} +/* { dg-final { scan-tree-dump-times "= 0" 1 "reassoc1"} } */ +/* { dg-final { cleanup-tree-dump "reassoc1" } } */
reassoc-8.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: recip-6.c =================================================================== --- recip-6.c (nonexistent) +++ recip-6.c (revision 816) @@ -0,0 +1,26 @@ +/* { dg-options "-O1 -funsafe-math-optimizations -fno-trapping-math -fdump-tree-recip" } */ +/* { dg-do compile } */ + +/* Test inserting in a block that does not contain a division. */ + +extern int f2(); + +double f1(double y, double z, double w) +{ + double b, c, d, e, f; + + if (g ()) + b = 1 / y, c = z / y; + else + b = 3 / y, c = w / y; + + d = b / y; + e = c / y; + f = 1 / y; + + return d + e + f; +} + +/* { dg-final { scan-tree-dump-times " / " 1 "recip" } } */ +/* { dg-final { cleanup-tree-dump "recip" } } */ +
recip-6.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: alias-10.c =================================================================== --- alias-10.c (nonexistent) +++ alias-10.c (revision 816) @@ -0,0 +1,20 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-optimized" } */ + +struct { + int i; + int x[2]; + int j; +} a; + +int foo(int i) +{ + a.i = 1; + a.j = 2; + a.x[i] = 0; + return a.i + a.j; +} + +/* { dg-final { scan-tree-dump "return 3;" "optimized" } } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */ +
alias-10.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pr21031.c =================================================================== --- pr21031.c (nonexistent) +++ pr21031.c (revision 816) @@ -0,0 +1,20 @@ +/* PR tree-optimization/21031 + + Make sure that a != 0 is propagated into the "if" statement. */ + +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-forwprop1-details" } */ + +int +foo (int a) +{ + int b = a != 0; + unsigned char c = b; + if (c) + return 1; + else + return 0; +} + +/* { dg-final { scan-tree-dump-times "Replaced" 2 "forwprop1"} } */ +/* { dg-final { cleanup-tree-dump "forwprop1" } } */
pr21031.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: loadpre3.c =================================================================== --- loadpre3.c (nonexistent) +++ loadpre3.c (revision 816) @@ -0,0 +1,24 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-pre-stats" } */ +int main(int **a,int argc) +{ + int b; + int d, e; + + if (argc) + { + d = *(*a); + } + else + { + + } + /* Should be able to eliminate one of the *(*a)'s along the if path + by pushing it into the else path. We will also eliminate + one of the *a's. */ + e = *(*a); + return d + e; +} + +/* { dg-final { scan-tree-dump-times "Eliminated: 2" 1 "pre"} } */ +/* { dg-final { cleanup-tree-dump "pre" } } */
loadpre3.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: loop-4.c =================================================================== --- loop-4.c (nonexistent) +++ loop-4.c (revision 816) @@ -0,0 +1,46 @@ +/* A test for strength reduction and induction variable elimination. */ + +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-optimized" } */ +/* { dg-require-effective-target size32plus } */ + +/* Size of this structure should be sufficiently weird so that no memory + addressing mode applies. */ + +struct bla +{ + char x[187]; + int y; + char z[253]; +} arr_base[100]; + +int foo(void); + +void xxx(void) +{ + int iter; + + for (iter = 0; iter < 100; iter++) + arr_base[iter].y = foo (); +} + +/* Access to arr_base[iter].y should be strength reduced. Depending on + whether we have an addressing mode of type [base + offset], one of the + following forms might get chosen: + + -- induction variable with base &arr_base[0].y, the memory access of + form *iv = ... + -- induction variable with base 0, the memory access of form + *(iv + &arr_base[0].y) = ... + + In any case, we should not have any multiplication. */ + +/* { dg-final { scan-tree-dump-times " \\* \[^\\n\\r\]*=" 0 "optimized" } } */ +/* { dg-final { scan-tree-dump-times "\[^\\n\\r\]*= \\* " 0 "optimized" } } */ +/* { dg-final { scan-tree-dump-times "MEM" 1 "optimized" } } */ + +/* And the original induction variable should be eliminated. */ + +/* { dg-final { scan-tree-dump-times "iter" 0 "optimized" } } */ + +/* { dg-final { cleanup-tree-dump "optimized" } } */
loop-4.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: builtin-fprintf-1.c =================================================================== --- builtin-fprintf-1.c (nonexistent) +++ builtin-fprintf-1.c (revision 816) @@ -0,0 +1,41 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-fab" } */ + +typedef struct { int i; } FILE; +FILE *fp; +extern int fprintf (FILE *, const char *, ...); +volatile int vi0, vi1, vi2, vi3, vi4, vi5, vi6, vi7, vi8, vi9; + +void test (void) +{ + vi0 = 0; + fprintf (fp, "hello"); + vi1 = 0; + fprintf (fp, "hello\n"); + vi2 = 0; + fprintf (fp, "a"); + vi3 = 0; + fprintf (fp, ""); + vi4 = 0; + fprintf (fp, "%s", "hello"); + vi5 = 0; + fprintf (fp, "%s", "hello\n"); + vi6 = 0; + fprintf (fp, "%s", "a"); + vi7 = 0; + fprintf (fp, "%c", 'x'); + vi8 = 0; + fprintf (fp, "%d%d", vi0, vi1); + vi9 = 0; +} + +/* { dg-final { scan-tree-dump "vi0.*fwrite.*\"hello\".*1, 5, fp.*vi1" "fab"} } */ +/* { dg-final { scan-tree-dump "vi1.*fwrite.*\"hello\\\\n\".*1, 6, fp.*vi2" "fab"} } */ +/* { dg-final { scan-tree-dump "vi2.*fputc.*fp.*vi3" "fab"} } */ +/* { dg-final { scan-tree-dump "vi3 = 0\[^\(\)\]*vi4 = 0" "fab"} } */ +/* { dg-final { scan-tree-dump "vi4.*fwrite.*\"hello\".*1, 5, fp.*vi5" "fab"} } */ +/* { dg-final { scan-tree-dump "vi5.*fwrite.*\"hello\\\\n\".*1, 6, fp.*vi6" "fab"} } */ +/* { dg-final { scan-tree-dump "vi6.*fputc.*fp.*vi7" "fab"} } */ +/* { dg-final { scan-tree-dump "vi7.*fputc.*fp.*vi8" "fab"} } */ +/* { dg-final { scan-tree-dump "vi8.*fprintf.*fp.*\"%d%d\".*vi9" "fab"} } */ +/* { dg-final { cleanup-tree-dump "fab" } } */
builtin-fprintf-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pr20702.c =================================================================== --- pr20702.c (nonexistent) +++ pr20702.c (revision 816) @@ -0,0 +1,29 @@ +/* PR tree-optimization/20702 + VRP did not insert ASSERT_EXPRs into dominator dominator children + of a basic block ending with COND_EXPR unless the children are also + immediate successors of the basic block. */ + +/* { dg-do compile } */ +/* { dg-options "-O2 -fno-tree-dominator-opts -fdump-tree-vrp1-details" } */ + +extern void bar (int); + +int +foo (int *p, int b) +{ + int a; + + if (b) + bar (123); + else + bar (321); + + a = *p; + if (p == 0) + return 0; + + return a; +} + +/* { dg-final { scan-tree-dump-times "Folding predicate" 1 "vrp1"} } */ +/* { dg-final { cleanup-tree-dump "vrp1" } } */
pr20702.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: builtin-fprintf-chk-1.c =================================================================== --- builtin-fprintf-chk-1.c (nonexistent) +++ builtin-fprintf-chk-1.c (revision 816) @@ -0,0 +1,41 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-fab" } */ + +typedef struct { int i; } FILE; +FILE *fp; +extern int __fprintf_chk (FILE *, int, const char *, ...); +volatile int vi0, vi1, vi2, vi3, vi4, vi5, vi6, vi7, vi8, vi9; + +void test (void) +{ + vi0 = 0; + __fprintf_chk (fp, 1, "hello"); + vi1 = 0; + __fprintf_chk (fp, 1, "hello\n"); + vi2 = 0; + __fprintf_chk (fp, 1, "a"); + vi3 = 0; + __fprintf_chk (fp, 1, ""); + vi4 = 0; + __fprintf_chk (fp, 1, "%s", "hello"); + vi5 = 0; + __fprintf_chk (fp, 1, "%s", "hello\n"); + vi6 = 0; + __fprintf_chk (fp, 1, "%s", "a"); + vi7 = 0; + __fprintf_chk (fp, 1, "%c", 'x'); + vi8 = 0; + __fprintf_chk (fp, 1, "%d%d", vi0, vi1); + vi9 = 0; +} + +/* { dg-final { scan-tree-dump "vi0.*fwrite.*\"hello\".*1, 5, fp.*vi1" "fab"} } */ +/* { dg-final { scan-tree-dump "vi1.*fwrite.*\"hello\\\\n\".*1, 6, fp.*vi2" "fab"} } */ +/* { dg-final { scan-tree-dump "vi2.*fputc.*fp.*vi3" "fab"} } */ +/* { dg-final { scan-tree-dump "vi3 = 0\[^\(\)\]*vi4 = 0" "fab"} } */ +/* { dg-final { scan-tree-dump "vi4.*fwrite.*\"hello\".*1, 5, fp.*vi5" "fab"} } */ +/* { dg-final { scan-tree-dump "vi5.*fwrite.*\"hello\\\\n\".*1, 6, fp.*vi6" "fab"} } */ +/* { dg-final { scan-tree-dump "vi6.*fputc.*fp.*vi7" "fab"} } */ +/* { dg-final { scan-tree-dump "vi7.*fputc.*fp.*vi8" "fab"} } */ +/* { dg-final { scan-tree-dump "vi8.*__fprintf_chk.*fp.*1.*\"%d%d\".*vi9" "fab"} } */ +/* { dg-final { cleanup-tree-dump "fab" } } */
builtin-fprintf-chk-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pr21090.c =================================================================== --- pr21090.c (nonexistent) +++ pr21090.c (revision 816) @@ -0,0 +1,23 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-vrp1" } */ + +int g, h; + +int +foo (int a) +{ + int *p; + + if (a) + p = &g; + else + p = &h; + + if (p != 0) + return 1; + else + return 0; +} + +/* { dg-final { scan-tree-dump-times "Folding predicate.*to 1" 1 "vrp1" } } */ +/* { dg-final { cleanup-tree-dump "vrp1" } } */
pr21090.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pr21171.c =================================================================== --- pr21171.c (nonexistent) +++ pr21171.c (revision 816) @@ -0,0 +1,29 @@ +/* PR 21171. Ivopts should not rewrite references to volatile memory. */ +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-optimized" } */ + +typedef unsigned int u_int32_t; +typedef unsigned char u_int8_t; + +#define AIC_VECTORS 32 + +typedef volatile struct AT91RM9200_regs { + u_int32_t SVR[AIC_VECTORS]; +} AT91RM9200_regs_t; + +#define CPUReg ((AT91RM9200_regs_t*)0xFFF00000) + +extern const u_int32_t __IntTable[AIC_VECTORS]; + +int main() +{ + int c; + + for (c = 0; c < AIC_VECTORS; c++) + CPUReg->SVR[c] = __IntTable[c]; + + return 0; +} + +/* { dg-final { scan-tree-dump-times "SVR" 1 "optimized"} } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */
pr21171.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pr23115.c =================================================================== --- pr23115.c (nonexistent) +++ pr23115.c (revision 816) @@ -0,0 +1,29 @@ +/* { dg-do run } */ +/* { dg-options "-O2 -ftree-vectorize" } */ + +extern void abort (void); + +#define MIN2(a,b) (((a)<(b)) ? (a) : (b)) +#define MAX2(a,b) (((a)>(b)) ? (a) : (b)) + +double p[2] = { 4., 5. }; + +int main() +{ + long j; + double R, n, x; + + n = 1.e300; + x = -1.e300; + for( j=0; j < 2; j++ ) + { + x = MAX2(x,p[j]); + n = MIN2(n,p[j]); + } + R = x-n; + + if( R < 0.1 ) + abort (); + + return 0; +}
pr23115.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: vrp15.c =================================================================== --- vrp15.c (nonexistent) +++ vrp15.c (revision 816) @@ -0,0 +1,34 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-vrp1" } */ + + +extern void abort (void) __attribute__ ((__noreturn__)); +union tree_node; +typedef union tree_node *tree; +enum tree_code +{ + ERROR_MARK, + COND_EXPR = 42, +}; +extern const unsigned char tree_code_length[]; +struct tree_common +{ + enum tree_code code:8; +}; +union tree_node +{ + struct tree_common common; +}; +void +blah (tree t) +{ + if (t->common.code != COND_EXPR) + abort (); + if (1 >= tree_code_length[t->common.code]) + abort (); + +} + +/* { dg-final { scan-tree-dump-times "tree_code_length.42." 1 "vrp1" } } */ +/* { dg-final { cleanup-tree-dump "vrp1" } } */ +
vrp15.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: phi-opt-2.c =================================================================== --- phi-opt-2.c (nonexistent) +++ phi-opt-2.c (revision 816) @@ -0,0 +1,22 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-optimized" } */ + +_Bool f1(_Bool a, _Bool b) +{ + if (a) + { + if (b) + return 1; + else + return 0; + } + return 0; +} + + +/* There should be only one if, the outer one; the inner one + should have been changed to straight line code with the + value of b (except that we don't fold ! (b != 0) into b + which can be fixed in a different patch). */ +/* { dg-final { scan-tree-dump-times "if" 1 "optimized"} } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */
phi-opt-2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pr23434.c =================================================================== --- pr23434.c (nonexistent) +++ pr23434.c (revision 816) @@ -0,0 +1,19 @@ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +cblas_csyr2k (int N, void *A, int lda, float *B, int ldb, float *C, int k) +{ + int i, j; + for (;; k ++) + { + for (i = 0; i < N; i ++) + { + float t = ((float * ) A) [i]; + for (j = i; j < N; j ++) + { + C [i + j] = B [ldb] * ((float *) A) [k]; + C [lda] = 0 ; + } + } + } +}
pr23434.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: tailrecursion-1.c =================================================================== --- tailrecursion-1.c (nonexistent) +++ tailrecursion-1.c (revision 816) @@ -0,0 +1,12 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -foptimize-sibling-calls -fdump-tree-tailr-details" } */ +int +t(int a) +{ + if (a) + return t(a-1); + else + return 0; +} +/* { dg-final { scan-tree-dump-times "Eliminated tail recursion" 1 "tailr"} } */ +/* { dg-final { cleanup-tree-dump "tailr" } } */
tailrecursion-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pr21294.c =================================================================== --- pr21294.c (nonexistent) +++ pr21294.c (revision 816) @@ -0,0 +1,23 @@ +/* PR tree-optimization/21294 + VRP did not notice that an address of the form &p->i is nonnull + when p is known to be nonnull. In this testcase, noticing that + allows us to eliminate the second "if" statement. */ + +/* { dg-do compile } */ +/* { dg-options "-O2 -fno-tree-dominator-opts -fdump-tree-vrp1-details" } */ + +struct f { + int i; +}; + +int +foo (struct f *p) +{ + if (p != 0) + if (&p->i != 0) + return 123; + return 0; +} + +/* { dg-final { scan-tree-dump-times "Folding predicate" 1 "vrp1"} } */ +/* { dg-final { cleanup-tree-dump "vrp1" } } */
pr21294.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pr24840.c =================================================================== --- pr24840.c (nonexistent) +++ pr24840.c (revision 816) @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +typedef struct +{ + int tag, y; +} Object; + +void Err_Handler () __attribute__ ((__noreturn__)); + +int +P_Error (int argc, Object * argv) +{ + if (((argv[1]).tag >> 1) != 11) + Wrong_Type (argv[1], 11); + Err_Handler (argv[0], argv[1], argc - 2, argv + 2); +}
pr24840.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pr19055.c =================================================================== --- pr19055.c (nonexistent) +++ pr19055.c (revision 816) @@ -0,0 +1,23 @@ +/* { dg-do compile } */ +/* { dg-options "-fdump-tree-gimple" } */ +int f1(int a,int b) +{ + return (a|b) ^ b; +} +int f2(int a,int b) +{ + return (b|a) ^ b; +} +int f3(int a,int b) +{ + return b^(a|b); +} +int f4(int a,int b) +{ + return b^(b|a); +} +/* There should be no ^, 4 ~ and 4 &. */ +/* { dg-final { scan-tree-dump-times "\\^" 0 "gimple"} } */ +/* { dg-final { scan-tree-dump-times "~" 4 "gimple"} } */ +/* { dg-final { scan-tree-dump-times "&" 4 "gimple"} } */ +/* { dg-final { cleanup-tree-dump "gimple" } } */
pr19055.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pr27236.c =================================================================== --- pr27236.c (nonexistent) +++ pr27236.c (revision 816) @@ -0,0 +1,19 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-optimized" } */ + +static inline int inline_read(volatile int *mem) +{ + return *mem; +} +int foo_read(volatile int *mem) +{ + return inline_read(mem); +} +unsigned int foo(volatile int *mem) +{ + foo_read(mem); + return foo_read(mem); +} + +/* { dg-final { scan-tree-dump-times "foo_read" 5 "optimized" } } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */
pr27236.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: stdarg-4.c =================================================================== --- stdarg-4.c (nonexistent) +++ stdarg-4.c (revision 816) @@ -0,0 +1,94 @@ +/* First dg-final line after each function is for architectures that use + a struct {...} va_list[1] with separate GPR and FPR counters in the + structure. Second dg-final line is for architectures that use void * + or char * va_list. */ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-stdarg" } */ + +#include + +extern void foo (int, va_list); +extern void bar (int); +long x; +double d; + +/* Here va_arg can be executed more than once for one va_start. All GPR + registers needs to be saved. */ +void +f1 (int i, ...) +{ + va_list ap; + va_start (ap, i); + while (i-- > 0) + x = va_arg (ap, long); + va_end (ap); +} +/* { dg-final { scan-tree-dump "f1: va_list escapes 0, needs to save all GPR units and 0 FPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && lp64 } } } } */ +/* { dg-final { scan-tree-dump "f1: va_list escapes 0, needs to save all GPR units and 0 FPR units" "stdarg" { target { powerpc*-*-linux* && ilp32 } } } } */ +/* { dg-final { scan-tree-dump "f1: va_list escapes 0, needs to save all GPR units and 1" "stdarg" { target alpha*-*-linux* } } } */ +/* { dg-final { scan-tree-dump "f1: va_list escapes 0, needs to save all GPR units and 0 FPR units" "stdarg" { target s390*-*-linux* } } } */ +/* { dg-final { scan-tree-dump "f1: va_list escapes \[01\], needs to save all GPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } } */ +/* { dg-final { scan-tree-dump "f1: va_list escapes \[01\], needs to save all GPR units" "stdarg" { target ia64-*-* } } } */ +/* { dg-final { scan-tree-dump "f1: va_list escapes \[01\], needs to save all GPR units" "stdarg" { target { powerpc*-*-* && lp64 } } } } */ + +void +f2 (int i, ...) +{ + va_list ap; + va_start (ap, i); + while (i-- > 0) + d = va_arg (ap, double); + va_end (ap); +} +/* { dg-final { scan-tree-dump "f2: va_list escapes 0, needs to save 0 GPR units and all FPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && lp64 } } } } */ +/* { dg-final { scan-tree-dump "f2: va_list escapes 0, needs to save 0 GPR units and all FPR units" "stdarg" { target { powerpc*-*-linux* && { powerpc_fprs && ilp32 } } } } } */ +/* { dg-final { scan-tree-dump "f2: va_list escapes 0, needs to save all GPR units and 2" "stdarg" { target alpha*-*-linux* } } } */ +/* { dg-final { scan-tree-dump "f2: va_list escapes 0, needs to save 0 GPR units and all FPR units" "stdarg" { target s390*-*-linux* } } } */ +/* { dg-final { scan-tree-dump "f2: va_list escapes \[01\], needs to save all GPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } } */ +/* { dg-final { scan-tree-dump "f2: va_list escapes \[01\], needs to save all GPR units" "stdarg" { target ia64-*-* } } } */ +/* { dg-final { scan-tree-dump "f2: va_list escapes \[01\], needs to save all GPR units" "stdarg" { target { powerpc*-*-* && lp64 } } } } */ + +/* Here va_arg can be executed at most as many times as va_start. + Only one GPR needs to be saved. */ +void +f3 (int i, ...) +{ + va_list ap; + int j = i; + while (j-- > 0) + { + va_start (ap, i); + x = va_arg (ap, long); + va_end (ap); + bar (x); + } +} +/* { dg-final { scan-tree-dump "f3: va_list escapes 0, needs to save \[148\] GPR units and 0 FPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && lp64 } } } } */ +/* { dg-final { scan-tree-dump "f3: va_list escapes 0, needs to save \[148\] GPR units and 0 FPR units" "stdarg" { target { powerpc*-*-linux* && ilp32 } } } } */ +/* { dg-final { scan-tree-dump "f3: va_list escapes 0, needs to save 8 GPR units and 1" "stdarg" { target alpha*-*-linux* } } } */ +/* { dg-final { scan-tree-dump "f3: va_list escapes 0, needs to save 1 GPR units and 0 FPR units" "stdarg" { target s390*-*-linux* } } } */ +/* { dg-final { scan-tree-dump "f3: va_list escapes 0, needs to save \[148\] GPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } } */ +/* { dg-final { scan-tree-dump "f3: va_list escapes 0, needs to save \[148\] GPR units" "stdarg" { target ia64-*-* } } } */ +/* { dg-final { scan-tree-dump "f3: va_list escapes 0, needs to save \[148\] GPR units" "stdarg" { target { powerpc*-*-* && lp64 } } } } */ + +void +f4 (int i, ...) +{ + va_list ap; + int j = i; + while (j-- > 0) + { + va_start (ap, i); + d = va_arg (ap, double); + va_end (ap); + bar (d + 2.5); + } +} +/* { dg-final { scan-tree-dump "f4: va_list escapes 0, needs to save 0 GPR units and \[1-9\]\[0-9\]* FPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && lp64 } } } } */ +/* { dg-final { scan-tree-dump "f4: va_list escapes 0, needs to save 0 GPR units and \[1-9\]\[0-9\]* FPR units" "stdarg" { target { powerpc*-*-linux* && { powerpc_fprs && ilp32 } } } } } */ +/* { dg-final { scan-tree-dump "f4: va_list escapes 0, needs to save 8 GPR units and 2" "stdarg" { target alpha*-*-linux* } } } */ +/* { dg-final { scan-tree-dump "f4: va_list escapes 0, needs to save 0 GPR units and 1 FPR units" "stdarg" { target s390*-*-linux* } } } */ +/* { dg-final { scan-tree-dump "f4: va_list escapes 0, needs to save \[148\] GPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } } */ +/* { dg-final { scan-tree-dump "f4: va_list escapes 0, needs to save \[148\] GPR units" "stdarg" { target ia64-*-* } } } */ +/* { dg-final { scan-tree-dump "f4: va_list escapes 0, needs to save \[148\] GPR units" "stdarg" { target { powerpc*-*-* && lp64 } } } } */ +/* { dg-final { cleanup-tree-dump "stdarg" } } */
stdarg-4.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pr24627.c =================================================================== --- pr24627.c (nonexistent) +++ pr24627.c (revision 816) @@ -0,0 +1,67 @@ +/* { dg-do run } */ +/* { dg-options "-O" } */ +/* { dg-require-effective-target int32plus } */ + +extern void abort (void); +typedef unsigned int u_int32; + +typedef struct { + union {u_int32 Xl_ui;} Ul_i; + union {u_int32 Xl_uf;} Ul_f; +} l_fp; + +void +dolfptoa (short ndec) +{ + l_fp work, ftmp; + + work.Ul_i.Xl_ui = 0; + work.Ul_f.Xl_uf = 0x535f3d8; + + while (ndec > 0) + { + u_int32 lo_tmp; + u_int32 hi_tmp; + + ndec--; + work.Ul_i.Xl_ui = 0; + work.Ul_i.Xl_ui <<= 1; + if ((work.Ul_f.Xl_uf) & 0x80000000) + (work.Ul_i.Xl_ui) |= 0x1; + (work.Ul_f.Xl_uf) <<= 1; + + ftmp = work; + (work.Ul_i.Xl_ui) <<= 1; + if ((work.Ul_f.Xl_uf) & 0x80000000) + (work.Ul_i.Xl_ui) |= 0x1; + (work.Ul_f.Xl_uf) <<= 1; + + (work.Ul_i.Xl_ui) <<= 1; + if ((work.Ul_f.Xl_uf) & 0x80000000) + (work.Ul_i.Xl_ui) |= 0x1; + (work.Ul_f.Xl_uf) <<= 1; + + lo_tmp = ((work.Ul_f.Xl_uf) & 0xffff) + ((ftmp.Ul_f.Xl_uf) & 0xffff); + hi_tmp = (((work.Ul_f.Xl_uf) >> 16) & 0xffff) + + (((ftmp.Ul_f.Xl_uf) >> 16) & 0xffff); + + if (lo_tmp & 0x10000) + hi_tmp++; + + (work.Ul_f.Xl_uf) = ((hi_tmp & 0xffff) << 16) | (lo_tmp & 0xffff); + (work.Ul_i.Xl_ui) += (ftmp.Ul_i.Xl_ui); + + if (hi_tmp & 0x10000) + (work.Ul_i.Xl_ui)++; + + + if (!(work.Ul_i.Xl_ui < 10)) + abort (); + } +} + +int main() +{ + dolfptoa(6); + return 0; +}
pr24627.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: scev-cast.c =================================================================== --- scev-cast.c (nonexistent) +++ scev-cast.c (revision 816) @@ -0,0 +1,26 @@ +/* A test for various conversions of chrecs. */ + +/* { dg-do compile { target i?86-*-* x86_64-*-* } } */ +/* { dg-options "-O2 -fdump-tree-optimized" } */ + +void blas (char xxx); +void blau (unsigned char xxx); + +void tst(void) +{ + unsigned i; + + for (i = 0; i < 128; i++) /* This cast to char has to be preserved. */ + blas ((char) i); + for (i = 0; i < 127; i++) /* And this one does not. */ + blas ((char) i); + for (i = 0; i < 255; i++) /* This cast is not necessary. */ + blau ((unsigned char) i); + for (i = 0; i < 256; i++) + blau ((unsigned char) i); /* This one is necessary. */ +} + +/* { dg-final { scan-tree-dump-times "\\(int\\) \\(unsigned char\\)" 1 "optimized" } } */ +/* { dg-final { scan-tree-dump-times "\\(int\\) \\(char\\)" 1 "optimized" } } */ + +/* { dg-final { cleanup-tree-dump "optimized" } } */
scev-cast.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pr15791-4.c =================================================================== --- pr15791-4.c (nonexistent) +++ pr15791-4.c (revision 816) @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-options "-fdump-tree-gimple" } */ + +int f(int i, int j) +{ + int b[2][2]; + if (&b[1][i] == &b[0][j]) + return 1; + return 0; +} + +/* { dg-final { scan-tree-dump-times "i == j" 0 "gimple" } } */ +/* { dg-final { cleanup-tree-dump "gimple" } } */
pr15791-4.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: builtin-vprintf-1.c =================================================================== --- builtin-vprintf-1.c (nonexistent) +++ builtin-vprintf-1.c (revision 816) @@ -0,0 +1,37 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-fab" } */ + +#include + +extern int vprintf (const char *, va_list); +volatile int vi0, vi1, vi2, vi3, vi4, vi5, vi6, vi7, vi8, vi9, via; + +void +test (va_list ap1, va_list ap2, va_list ap3, va_list ap4, va_list ap5, + va_list ap6, va_list ap7) +{ + vi0 = 0; + vprintf ("hello", ap1); + vi1 = 0; + vprintf ("hello\n", ap2); + vi2 = 0; + vprintf ("a", ap3); + vi3 = 0; + vprintf ("", ap4); + vi4 = 0; + vprintf ("%s", ap5); + vi5 = 0; + vprintf ("%c", ap6); + vi6 = 0; + vprintf ("%s\n", ap7); + vi7 = 0; +} + +/* { dg-final { scan-tree-dump "vi0.*vprintf.*\"hello\".*vi1" "fab"} } */ +/* { dg-final { scan-tree-dump "vi1.*puts.*\"hello\".*vi2" "fab"} } */ +/* { dg-final { scan-tree-dump "vi2.*putchar.*vi3" "fab"} } */ +/* { dg-final { scan-tree-dump "vi3 = 0\[^\(\)\]*vi4 = 0" "fab"} } */ +/* { dg-final { scan-tree-dump "vi4.*vprintf.*\"%s\".*vi5" "fab"} } */ +/* { dg-final { scan-tree-dump "vi5.*vprintf.*\"%c\".*vi6" "fab"} } */ +/* { dg-final { scan-tree-dump "vi6.*vprintf.*\"%s\\\\n\".*vi7" "fab"} } */ +/* { dg-final { cleanup-tree-dump "fab" } } */
builtin-vprintf-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20030711-1.c =================================================================== --- 20030711-1.c (nonexistent) +++ 20030711-1.c (revision 816) @@ -0,0 +1,55 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-dom3" } */ + +extern void abort (void); + +union tree_node; +typedef union tree_node *tree; +struct tree_vec +{ + int length; + tree a[1]; +}; +struct tree_type +{ + tree binfo; +}; +union tree_node +{ + struct tree_type type; + struct tree_vec vec; +}; + +void +record_component_aliases (type) + tree type; +{ + int i; + if (4 >= type->type.binfo->vec.length) + abort (); + for (; i < (( + { + const tree __t = type->type.binfo; + if (4 >= __t->vec.length) + abort (); type->type.binfo->vec.a[4];} + )->vec.length);) + { + if (4 >= type->type.binfo->vec.length) + abort (); + blah (); + } +} + +/* The call to blah can not be eliminated. */ +/* { dg-final { scan-tree-dump-times "blah \\(\\)" 1 "dom3" } } */ + +/* There should be four IF conditionals. */ +/* { dg-final { scan-tree-dump-times "if " 3 "dom3"} } */ + +/* There should be two loads of type.binfo. */ +/* { dg-final { scan-tree-dump-times "type\\.binfo" 2 "dom3"} } */ + +/* There should be four loads of vec.length. */ +/* { dg-final { scan-tree-dump-times "vec.length" 3 "dom3"} } */ + +/* { dg-final { cleanup-tree-dump "dom3" } } */
20030711-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: alias-6.c =================================================================== --- alias-6.c (nonexistent) +++ alias-6.c (revision 816) @@ -0,0 +1,19 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-optimized" } */ + +struct param { int *a; }; +void foo(struct param *p); +int bar(void) +{ + int a[2]; + struct param p; + a[0] = 1; + a[1] = 1; + p.a = &a[0]; + foo(&p); + return a[0] + *p.a; +} + +/* { dg-final { scan-tree-dump "return \\*p\\.a \\\+ a.0.;" "optimized" } } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */ +
alias-6.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: builtin-vprintf-chk-1.c =================================================================== --- builtin-vprintf-chk-1.c (nonexistent) +++ builtin-vprintf-chk-1.c (revision 816) @@ -0,0 +1,37 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-fab" } */ + +#include + +extern int __vprintf_chk (int, const char *, va_list); +volatile int vi0, vi1, vi2, vi3, vi4, vi5, vi6, vi7, vi8, vi9, via; + +void +test (va_list ap1, va_list ap2, va_list ap3, va_list ap4, va_list ap5, + va_list ap6, va_list ap7) +{ + vi0 = 0; + __vprintf_chk (1, "hello", ap1); + vi1 = 0; + __vprintf_chk (1, "hello\n", ap2); + vi2 = 0; + __vprintf_chk (1, "a", ap3); + vi3 = 0; + __vprintf_chk (1, "", ap4); + vi4 = 0; + __vprintf_chk (1, "%s", ap5); + vi5 = 0; + __vprintf_chk (1, "%c", ap6); + vi6 = 0; + __vprintf_chk (1, "%s\n", ap7); + vi7 = 0; +} + +/* { dg-final { scan-tree-dump "vi0.*__vprintf_chk.*1.*\"hello\".*vi1" "fab"} } */ +/* { dg-final { scan-tree-dump "vi1.*puts.*\"hello\".*vi2" "fab"} } */ +/* { dg-final { scan-tree-dump "vi2.*putchar.*vi3" "fab"} } */ +/* { dg-final { scan-tree-dump "vi3 = 0\[^\(\)\]*vi4 = 0" "fab"} } */ +/* { dg-final { scan-tree-dump "vi4.*__vprintf_chk.*1.*\"%s\".*vi5" "fab"} } */ +/* { dg-final { scan-tree-dump "vi5.*__vprintf_chk.*1.*\"%c\".*vi6" "fab"} } */ +/* { dg-final { scan-tree-dump "vi6.*__vprintf_chk.*1.*\"%s\\\\n\".*vi7" "fab"} } */ +/* { dg-final { cleanup-tree-dump "fab" } } */
builtin-vprintf-chk-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ssa-copyprop-1.c =================================================================== --- ssa-copyprop-1.c (nonexistent) +++ ssa-copyprop-1.c (revision 816) @@ -0,0 +1,12 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fno-tree-dominator-opts -fdump-tree-store_copyprop-details" } */ + +typedef struct { int i; int j; } A; +int foo(A *a, int i) +{ + a->i = i; + return a->i; +} + +/* { dg-final { scan-tree-dump "return i" "store_copyprop" } } */ +/* { dg-final { cleanup-tree-dump "store_copyprop" } } */
ssa-copyprop-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20040713-1.c =================================================================== --- 20040713-1.c (nonexistent) +++ 20040713-1.c (revision 816) @@ -0,0 +1,18 @@ +/* { dg-do compile } */ +/* { dg-options "-Os" } */ + +/* Extracted from PR 16443. Contributed by Volker Reichelt. + Scanning of __asm__ operands wasn't considering call-clobbered + variables discovered before the aliasing pass. This was causing a + crash in verify_ssa() because 'p' was not being given an SSA_NAME. */ + +void foo(char *p) +{ + __asm__ ("" ::: "memory"); +} + +void bar() +{ + static char *p; + foo(p); +}
20040713-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20040319-1.c =================================================================== --- 20040319-1.c (nonexistent) +++ 20040319-1.c (revision 816) @@ -0,0 +1,27 @@ +/* { dg-do run } */ +/* { dg-options "-O2" } */ + +/* Test derived from PR 14643. When a function has no addressable + variables but 2 or more pointers have conflicting memory tags, they + were not being processed by the type based alias analyzer, + resulting in optimizations removing a non-redundant load. */ + +extern void abort (void); + +struct bar { int count; int *arr;}; + +void foo (struct bar *b) +{ + b->count = 0; + *(b->arr) = 2; + if (b->count == 0) /* b->count can't be assumed to be 0 here. */ + abort (); +} + +main () +{ + struct bar x; + x.arr = &x.count; + foo (&x); + return 0; +}
20040319-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ifc-3.c =================================================================== --- ifc-3.c (nonexistent) +++ ifc-3.c (revision 816) @@ -0,0 +1,12 @@ +/* PR 20994 */ +/* { dg-do compile } */ +int foo(double* p, double* q) +{ + int i=0; + + for (; q!=p; ++q) + if (*q) + ++i; + + return i; +}
ifc-3.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: divide-4.c =================================================================== --- divide-4.c (nonexistent) +++ divide-4.c (revision 816) @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fstrict-overflow -fdump-tree-optimized" } */ + +int f(int a) +{ + return -(-a/10); +} + +/* { dg-final { scan-tree-dump-times "-a / 10" 0 "optimized"} } */ +/* { dg-final { scan-tree-dump-times "a / 10" 1 "optimized"} } */ + +/* { dg-final { cleanup-tree-dump "optimized" } } */ + +
divide-4.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20050719-1.c =================================================================== --- 20050719-1.c (nonexistent) +++ 20050719-1.c (revision 816) @@ -0,0 +1,38 @@ +/* { dg-do run } */ +/* { dg-options "-O2" } */ + +extern void abort (void) __attribute__ ((__nothrow__)) __attribute__ +((__noreturn__)); +extern void exit (int __status) __attribute__ ((__nothrow__)) +__attribute__ ((__noreturn__)); + +struct bootLoader { + int x; +}; + +void +zap(struct bootLoader *bootLoader) +{ + /* The expression on the RHS of the assignment is *not* a + dereference of pointer 'bootLoader'. It is merely used as an + offset calculation. VRP was erroneously removing the if() + because it thought that 'bootLoader' was always dereferenced. */ + int *boot = &bootLoader->x; + + if (bootLoader) + { + useboot (boot); + } +} + +int +useboot (void *boot) +{ + abort (); +} + +main() +{ + zap (0); + return 0; +}
20050719-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: wholeprogram-2.c =================================================================== --- wholeprogram-2.c (nonexistent) +++ wholeprogram-2.c (revision 816) @@ -0,0 +1,8 @@ +/* { dg-options "-O2 -fdump-tree-optimized -fwhole-program" } */ +__attribute__ ((externally_visible)) +void +externally_visible_function () +{ +} +/* { dg-final { scan-tree-dump "externally_visible_function" "optimized"} } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */
wholeprogram-2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ssa-ccp-11.c =================================================================== --- ssa-ccp-11.c (nonexistent) +++ ssa-ccp-11.c (revision 816) @@ -0,0 +1,42 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-optimized" } */ + +/* Test for CPROP across a DAG. */ + +int test111 (int param) +{ + int a, b, c; + if (param) { + a = 3; + b = 2; + } + else { + a = 2; + b = 3; + } + c = a + b; + if (c != 5) + return 2; + return 0; +} + +int test1111 (int param) +{ + _Bool a, b, c; + if (param) { + a = 1; + b = 0; + } + else { + a = 0; + b = 1; + } + c = a && b; + if (c) + return 2; + return 0; +} + +/* All ifs should be eliminated. */ +/* { dg-final { scan-tree-dump-times "if " 0 "optimized" } } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */
ssa-ccp-11.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: bool-11.c =================================================================== --- bool-11.c (nonexistent) +++ bool-11.c (revision 816) @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-optimized" } */ + +int f(_Bool x) +{ + return (x == 0); +} + +/* There should be no == 0 which is produced by the front-end as + bool_var == 0 is the same as !bool_var. */ +/* { dg-final { scan-tree-dump-times "== 0" 0 "optimized"} } */ +/* { dg-final { scan-tree-dump-times "!x" 1 "optimized"} } */ + +/* { dg-final { cleanup-tree-dump "optimized" } } */
bool-11.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pr22051-2.c =================================================================== --- pr22051-2.c (nonexistent) +++ pr22051-2.c (revision 816) @@ -0,0 +1,25 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-optimized -w" } */ + + + + +void *arf (); +int +foo() +{ + void (*q)(void); + int r = q; + + if (r != 0) + return 1; + else + return 2; +} + +/* The cast to an int type must remain after all optimizations are complete + so that we do not try to canonicalize a function pointer for the + comparison when no such canonicalization is wanted. */ +/* { dg-final { scan-tree-dump-times "if \\(\\(int\\).*q" 1 "optimized" } } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */ +
pr22051-2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: reassoc-10.c =================================================================== --- reassoc-10.c (nonexistent) +++ reassoc-10.c (revision 816) @@ -0,0 +1,11 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-optimized" } */ +int main(int a, int b, int c, int d) +{ + /* Should become just a & b & c & d */ + int e = (a & b) & (c & d); + int f = (c & a) & (b & d); + return e & f; +} +/* { dg-final { scan-tree-dump-times "\\\& " 3 "optimized"} } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */
reassoc-10.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: vrp24.c =================================================================== --- vrp24.c (nonexistent) +++ vrp24.c (revision 816) @@ -0,0 +1,91 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-vrp1-details" } */ + + +struct rtx_def; +typedef struct rtx_def *rtx; +union rtunion_def +{ + rtx rt_rtx; +}; +typedef union rtunion_def rtunion; +struct rtx_def +{ + int code; + union u + { + rtunion fld[1]; + } u; +}; + +sss (rtx insn, int code1, int code2, int code3) +{ + _Bool D1562; + struct rtx_def * body; + int i; + int n_sets; + int D1544; + + body = insn->u.fld[5].rt_rtx; + D1544 = body->code; + n_sets = 1; + if (D1544 == 55) goto L7; else goto L1; + +L1: + n_sets = 0; + if (code3 == 99) goto L2; else goto L11; + +L2: + D1562 = code1 == 10; + n_sets = (int) D1562; + if (n_sets > 0) goto L7; else goto L11; + +L37: + if (code2 == 42) goto L8; else goto L9; + +L8: + arf (); + +L9: + i = i + 1; + if (i < n_sets) goto L37; else goto L32; + +L32: + +L11: + if (n_sets > 1) goto L12; else goto L15; + +L12: + nit (); + +L14: + i = 0; + goto L38; + +L15: + if (n_sets > 0) goto L14; else goto L16; + +L38: + frob (); + i = i + 1; + if (n_sets > i) goto L38; else goto L16; + +L16: + return; + +L7: + i = 0; + goto L37; + +} + +/* The first n_sets > 0 test can be simplfiied into n_sets == 1 since + n_sets can only have the values [0, 1] as it's the result of a + boolean operation. + + The second n_sets > 0 test can also be simplified into n_sets == 1 + as the only way to reach the tests is when n_sets <= 1 and the only + value which satisfies both conditions is n_sets == 1. */ +/* { dg-final { scan-tree-dump-times "Simplified relational" 2 "vrp1" } } */ +/* { dg-final { cleanup-tree-dump "vrp1" } } */ +
vrp24.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ssa-dce-2.c =================================================================== --- ssa-dce-2.c (nonexistent) +++ ssa-dce-2.c (revision 816) @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-dce3" } */ + +/* We should notice constantness of this function. */ +static int __attribute__((noinline)) t(int a) +{ + return a+1; +} +void q(void) +{ + int i = t(1); + if (!i) + i = t(1); +} +/* There should be no IF conditionals. */ +/* { dg-final { scan-tree-dump-times "if " 0 "dce3"} } */ +/* { dg-final { cleanup-tree-dump "dce3" } } */
ssa-dce-2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: vrp07.c =================================================================== --- vrp07.c (nonexistent) +++ vrp07.c (revision 816) @@ -0,0 +1,36 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-vrp1-details" } */ + +foo (int i, int *p) +{ + int j; + + if (i > 10) + { + if (p) + { + j = *p; + /* This should be folded to if (1) because of the parent 'if + (p)'. But the dereference of p above does not need an + assertion. */ + if (p) + return j + 1; + } + } + else + { + j = *p - 3; + /* This should be folded to if (0), because p has just been + dereferenced. But we were not inserting enough ASSERT_EXPRs + to figure it out. */ + if (!p) + return j - 4; + } + + return i; +} + +/* { dg-final { scan-tree-dump-times "Folding predicate p_.*to 1" 1 "vrp1" } } */ +/* { dg-final { scan-tree-dump-times "Folding predicate p_.*to 0" 1 "vrp1" } } */ +/* { dg-final { scan-tree-dump-times "PREDICATE: p_\[0-9\] ne_expr 0B" 2 "vrp1" } } */ +/* { dg-final { cleanup-tree-dump "vrp1" } } */
vrp07.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ssa-pre-8.c =================================================================== --- ssa-pre-8.c (nonexistent) +++ ssa-pre-8.c (revision 816) @@ -0,0 +1,21 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fno-tree-dominator-opts -fdump-tree-fre-stats" } */ +struct s { + int *n; +}; + +int +foo (__SIZE_TYPE__ i, struct s *array) +{ + int *p = array[i].n; + if (p) + { + int *q = array[i].n; + if (p != q) + return 1; + } + return 0; +} +/* We should eliminate two address calculations, one cast, and one load. */ +/* { dg-final { scan-tree-dump-times "Eliminated: 4" 1 "fre"} } */ +/* { dg-final { cleanup-tree-dump "fre" } } */
ssa-pre-8.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pr21563.c =================================================================== --- pr21563.c (nonexistent) +++ pr21563.c (revision 816) @@ -0,0 +1,17 @@ +/* PR tree-optimization/21563 + Make sure VRP folds the second "if" statement. */ + +/* { dg-do compile } */ +/* { dg-options "-O2 -fno-tree-dominator-opts -fdump-tree-vrp1-details" } */ + +int +foo (int a) +{ + if (a > 1) + if (a == 0) + return 1; + return 0; +} + +/* { dg-final { scan-tree-dump-times "Folding predicate" 1 "vrp1"} } */ +/* { dg-final { cleanup-tree-dump "vrp1" } } */
pr21563.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pr14490-3.c =================================================================== --- pr14490-3.c (nonexistent) +++ pr14490-3.c (revision 816) @@ -0,0 +1,10 @@ +/* { dg-do compile } */ +/* { dg-options "-fstrict-overflow -fdump-tree-gimple" } */ +int g(int x) +{ + return (x + 10) < 0; +} +/* There should be only x < -10 and no x + 10. */ +/* { dg-final { scan-tree-dump-times "< -10" 1 "gimple"} } */ +/* { dg-final { scan-tree-dump-times "\\+ 10" 0 "gimple"} } */ +/* { dg-final { cleanup-tree-dump "gimple" } } */
pr14490-3.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pr24670.c =================================================================== --- pr24670.c (nonexistent) +++ pr24670.c (revision 816) @@ -0,0 +1,23 @@ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +__inline__ void +shift128Right (int count, long long int *z1Ptr) +{ + long long int z1; + if (count == 0); + else if (count < 64); + else + z1 = (count < 64) ? count : 0; + *z1Ptr = z1; +} + +float128_rem () +{ + signed int expDiff; + long long int aSig1; + long long int sigMean1; + if (-64 < expDiff) + shift128Right (-expDiff, &aSig1); + add128 (&sigMean1); +}
pr24670.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pr25382.c =================================================================== --- pr25382.c (nonexistent) +++ pr25382.c (revision 816) @@ -0,0 +1,19 @@ +/* PR tree-optimization/25382 + VRP used to ignore BIT_AND_EXPRs for the purpose of distilling ranges. + Check that VRP now gets ranges from BIT_AND_EXPRs. */ + +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-vrp1" } */ + +int +foo (int a) +{ + int b = a & 0xff; + if (b > 300) + return 2; + else + return 1; +} + +/* { dg-final { scan-tree-dump-times "Folding predicate b_.* > 300 to 0" 1 "vrp1" } } */ +/* { dg-final { cleanup-tree-dump "vrp1" } } */
pr25382.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pr26435.c =================================================================== --- pr26435.c (nonexistent) +++ pr26435.c (revision 816) @@ -0,0 +1,20 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -ftree-loop-linear -fdump-tree-ltrans-all" } */ +/* { dg-require-effective-target size32plus } */ + +int foo(int *p, int n) +{ + int i, j, k = 0; + + /* This is a reduction: there is a scalar dependence that cannot be + removed by rewriting IVs. This code cannot and should not be + transformed into a perfect loop. */ + for (i = 0; i < 2; ++i, p += n) + for (j = 0; j < 2; ++j) + k += p[j]; + + return k; +} + +/* { dg-final { scan-tree-dump-times "converted loop nest to perfect loop nest" 0 "ltrans"} } */ +/* { dg-final { cleanup-tree-dump "ltrans" } } */
pr26435.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: sra-3.c =================================================================== --- sra-3.c (nonexistent) +++ sra-3.c (revision 816) @@ -0,0 +1,28 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-optimized --param sra-max-structure-size=32" } */ + +/* Test for SRA. */ + +typedef struct teststruct +{ + double d; + char f1; +} teststruct; + +teststruct *globf1; + +extern void link_error (void); + +void +copystruct1 (void) +{ + teststruct local; + globf1->f1 = 0; + local = *globf1; + if (local.f1 != 0) + link_error (); +} + +/* There should be no reference to link_error. */ +/* { dg-final { scan-tree-dump-times "link_error" 0 "optimized" { xfail *-*-* } } } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */
sra-3.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: update-threading.c =================================================================== --- update-threading.c (nonexistent) +++ update-threading.c (revision 816) @@ -0,0 +1,24 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-optimized" } */ + +typedef struct { unsigned short a; } A; + +extern void abort (void); +extern void exit (int); + +void foo (unsigned int x) +{ + if (x != 0x800 && x != 0x810) + abort (); +} + +int +main (int argc, char **argv) +{ + int i; + for (i = 0; i < 2; ++i) + foo (((A) { ((!(i >> 4) ? 8 : 64 + (i >> 4)) << 8) + (i << 4) } ).a); + exit (0); +} +/* { dg-final { scan-tree-dump-times "Invalid sum" 0 "optimized"} } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */
update-threading.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: gen-vect-11b.c =================================================================== --- gen-vect-11b.c (nonexistent) +++ gen-vect-11b.c (revision 816) @@ -0,0 +1,33 @@ +/* { dg-do run { target vect_cmdline_needed } } */ +/* { dg-options "-O2 -ftree-vectorize -ftree-vectorizer-verbose=3 -fdump-tree-vect-stats" } */ + +#include + +#define N 16 + +int main () +{ + int i; + char ia[N]; + char ic[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; + char ib[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; + + /* Not vectorizable, multiplication */ + for (i = 0; i < N; i++) + { + ia[i] = ib[i] * ic[i]; + } + + /* check results: */ + for (i = 0; i < N; i++) + { + if (ia[i] != (char) (ib[i] * ic[i])) + abort (); + } + + return 0; +} + + +/* { dg-final { scan-tree-dump-times "vectorized 0 loops" 1 "vect" } } */ +/* { dg-final { cleanup-tree-dump "vect" } } */
gen-vect-11b.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20040204-1.c =================================================================== --- 20040204-1.c (nonexistent) +++ 20040204-1.c (revision 816) @@ -0,0 +1,37 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-optimized" } */ + +extern void link_error (void); + +/* + test that a condition is propagated inside an if +*/ + +void test5 (int x) +{ + extern int foo (int); + if (x == 0) + foo (x); + else if (x == 0 ) + link_error (); +} + +void test55 (int x, int y) +{ + int u; + if (x == 5 && y) + { + u = x + 22; + if (u != 27) + link_error (); + } +} + +/* There should be not link_error calls, if there is any the + optimization has failed */ +/* ??? Ug. This one may or may not fail based on how fold decides + that the && should be emitted (based on BRANCH_COST). Fix this + by teaching dom to look through && and register all components + as true. */ +/* { dg-final { scan-tree-dump-times "link_error" 0 "optimized" { xfail { ! "powerpc*-*-* cris-*-* mmix-*-*" } } } } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */
20040204-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ssa-pre-12.c =================================================================== --- ssa-pre-12.c (nonexistent) +++ ssa-pre-12.c (revision 816) @@ -0,0 +1,27 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-pre-stats" } */ +double cos (double) __attribute__ ((const)); +double sin (double) __attribute__ ((const)); +double f(double a) +{ + double b; + double c,d; + double (*fp) (double) __attribute__ ((const)); + /* Fully redundant call, but we need a phi node to merge the results. */ + if (a < 2.0) + { + fp = sin; + c = fp (a); + } + else + { + c = 1.0; + fp = cos; + c = fp (a); + } + d = fp (a); + return d + c; +} + +/* { dg-final { scan-tree-dump-times "Eliminated: 1" 1 "pre"} } */ +/* { dg-final { cleanup-tree-dump "pre" } } */
ssa-pre-12.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: flatten-2.c =================================================================== --- flatten-2.c (nonexistent) +++ flatten-2.c (revision 816) @@ -0,0 +1,76 @@ +/* { dg-do compile } */ +/* { dg-options -O2 } */ + +/* Check that we finish compiling even if instructed to + flatten a cyclic callgraph. Verify we correctly + flatten with another function marked flatten in the + callgraph. */ + +void __attribute__((flatten)) direct(void) +{ + direct(); +} + + +void __attribute__((flatten)) indirect(void); +static void indirect1(void) +{ + indirect(); +} +void __attribute__((flatten)) indirect(void) +{ + indirect1(); +} + + +void __attribute__((flatten)) doubleindirect(void); +static void doubleindirect2(void) +{ + doubleindirect(); +} +static void doubleindirect1(void) +{ + doubleindirect2(); +} +void __attribute__((flatten)) doubleindirect(void) +{ + doubleindirect1(); +} + + +static void subcycle1(void); +static void subcycle2(void) +{ + subcycle1(); +} +static void subcycle1(void) +{ + subcycle2(); +} +void __attribute__((flatten)) subcycle(void) +{ + subcycle1(); +} + + +static void doublesubcycle1(void); +static void doublesubcycle2(void); +static void doublesubcycle3(void) +{ + doublesubcycle1(); +} +static void doublesubcycle2(void) +{ + doublesubcycle3(); +} +static void doublesubcycle1(void) +{ + doublesubcycle2(); +} +void __attribute__((flatten)) doublesubcycle(void) +{ + doublesubcycle1(); +} + +/* { dg-final { scan-assembler "cycle\[123\]\[: \t\n\]" } } */ +/* { dg-final { scan-assembler-not "indirect\[12\]\[: \t\n\]" } } */
flatten-2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20040324-1.c =================================================================== --- 20040324-1.c (nonexistent) +++ 20040324-1.c (revision 816) @@ -0,0 +1,34 @@ +/* { dg-do run } */ +/* { dg-options "-O2" } */ + +/* Ensure that BIT_FIELD_REFs gets the appropriate VUSE. + Contributed by Paolo Bonzini . + + This testcase actually never triggered in the CVS repo, but it did + in my local tree and it seems worth testing. In this test, the if's + are folded to BIT_FIELD_REFs but the VUSEs were erroneously left out. + Therefore, DOM did not see that i was modified between the two ifs + and optimized away the second if. */ + +extern void abort (void); +extern void exit (int); + +struct x +{ + unsigned b:1; + unsigned c:1; +}; + +struct x i = { 1, 1 }; + +int +main () +{ + i.b = 1; + if (i.b == 1 && i.c == 0) + exit (0); + i.c = 0; + if (i.b == 1 && i.c == 0) + exit (0); + abort (); +}
20040324-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: loadpre16.c =================================================================== --- loadpre16.c (nonexistent) +++ loadpre16.c (revision 816) @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-pre-stats" } */ +typedef int type[2]; +int main(type *a, int argc) +{ + int d, e; + + /* Should be able to eliminate the second load of *a along the main path. */ + d = (*a)[0]; + if (argc) + a++; + e = (*a)[0]; + return d + e; +} +/* { dg-final { scan-tree-dump-times "Eliminated: 1" 1 "pre"} } */ +/* { dg-final { cleanup-tree-dump "pre" } } */
loadpre16.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: reassoc-1.c =================================================================== --- reassoc-1.c (nonexistent) +++ reassoc-1.c (revision 816) @@ -0,0 +1,18 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-optimized" } */ +int a, b, c, d; +extern int printf (const char *, ...); +int main(void) +{ + int e; + int f; + /* We should be able to transform these into the same expression, and only have two additions. */ + e = a + b; + e = e + c; + f = c + a; + f = f + b; + printf ("%d %d\n", e, f); +} + +/* { dg-final { scan-tree-dump-times "b \\\+ a" 1 "optimized"} } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */
reassoc-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ssa-ccp-7.c =================================================================== --- ssa-ccp-7.c (nonexistent) +++ ssa-ccp-7.c (revision 816) @@ -0,0 +1,27 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-optimized" } */ + +extern void link_error (void); + +/* tests to check if cprop works when using non-return functions */ + +extern int not_returning (int) __attribute__ ((noreturn)); + +int b; +int test7 (int a) +{ + b = 7; + if (a) + { + not_returning (a); + } + if (b != 7) + link_error (); + return b; +} + + +/* There should be not link_error calls, if there is any the + optimization has failed */ +/* { dg-final { scan-tree-dump-times "link_error" 0 "optimized"} } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */
ssa-ccp-7.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: loop-17.c =================================================================== --- loop-17.c (nonexistent) +++ loop-17.c (revision 816) @@ -0,0 +1,19 @@ +/* { dg-do compile } */ +/* { dg-options "-O -fdump-tree-sccp-details" } */ + +/* To determine the number of iterations in this loop we need to fold + p_4 + 4B > p_4 + 8B to false. This transformation has caused + troubles in the past due to overflow issues. */ + +int foo (int *p) +{ + int i = 0, *x; + + for (x = p; x < p + 2; x++) + i++; + + return i; +} + +/* { dg-final { scan-tree-dump "set_nb_iterations_in_loop = 2" "sccp" } } */ +/* { dg-final { cleanup-tree-dump "sccp" } } */
loop-17.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ssa-dse-2.c =================================================================== --- ssa-dse-2.c (nonexistent) +++ ssa-dse-2.c (revision 816) @@ -0,0 +1,24 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-dse1" } */ + +int a, b, c; +int +foo () +{ + int *p; + if (c) + p = &a; + else + p = &b; + + *p = 3; + *p = 4; + return *p; +} + + +/* We should eliminate the first assignment to *p, but not the second. */ +/* { dg-final { scan-tree-dump-times " = 3" 0 "dse1"} } */ +/* { dg-final { scan-tree-dump-times " = 4" 1 "dse1"} } */ + +/* { dg-final { cleanup-tree-dump "dse1" } } */
ssa-dse-2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: bool-8.c =================================================================== --- bool-8.c (nonexistent) +++ bool-8.c (revision 816) @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-optimized" } */ + +int f(_Bool x) +{ + return (x == 1); +} + +/* There should be no == 1 which is produced by the front-end as + bool_var == 1 is the same as bool_var. */ +/* { dg-final { scan-tree-dump-times "== 1" 0 "optimized"} } */ + +/* There should be no adde for powerpc. Check if we actually optimized + away the comparison. */ +/* { dg-final { scan-assembler-times "adde" 0 { target powerpc*-*-* } } } */ + +/* { dg-final { cleanup-tree-dump "optimized" } } */
bool-8.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: builtin-vfprintf-chk-1.c =================================================================== --- builtin-vfprintf-chk-1.c (nonexistent) +++ builtin-vfprintf-chk-1.c (revision 816) @@ -0,0 +1,39 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-fab" } */ + +#include + +typedef struct { int i; } FILE; +FILE *fp; +extern int __vfprintf_chk (FILE *, int, const char *, va_list); +volatile int vi0, vi1, vi2, vi3, vi4, vi5, vi6, vi7, vi8, vi9, via; + +void +test (va_list ap1, va_list ap2, va_list ap3, va_list ap4, va_list ap5, + va_list ap6, va_list ap7) +{ + vi0 = 0; + __vfprintf_chk (fp, 1, "hello", ap1); + vi1 = 0; + __vfprintf_chk (fp, 1, "hello\n", ap2); + vi2 = 0; + __vfprintf_chk (fp, 1, "a", ap3); + vi3 = 0; + __vfprintf_chk (fp, 1, "", ap4); + vi4 = 0; + __vfprintf_chk (fp, 1, "%s", ap5); + vi5 = 0; + __vfprintf_chk (fp, 1, "%c", ap6); + vi6 = 0; + __vfprintf_chk (fp, 1, "%s\n", ap7); + vi7 = 0; +} + +/* { dg-final { scan-tree-dump "vi0.*fwrite.*\"hello\".*1, 5, fp.*vi1" "fab"} } */ +/* { dg-final { scan-tree-dump "vi1.*fwrite.*\"hello\\\\n\".*1, 6, fp.*vi2" "fab"} } */ +/* { dg-final { scan-tree-dump "vi2.*fputc.*fp.*vi3" "fab"} } */ +/* { dg-final { scan-tree-dump "vi3 = 0\[^\(\)\]*vi4 = 0" "fab"} } */ +/* { dg-final { scan-tree-dump "vi4.*__vfprintf_chk.*fp.*1.*\"%s\".*vi5" "fab"} } */ +/* { dg-final { scan-tree-dump "vi5.*__vfprintf_chk.*fp.*1.*\"%c\".*vi6" "fab"} } */ +/* { dg-final { scan-tree-dump "vi6.*__vfprintf_chk.*fp.*1.*\"%s\\\\n\".*vi7" "fab"} } */ +/* { dg-final { cleanup-tree-dump "fab" } } */
builtin-vfprintf-chk-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20030907-2.c =================================================================== --- 20030907-2.c (nonexistent) +++ 20030907-2.c (revision 816) @@ -0,0 +1,30 @@ +/* PR optimization/12109 + + This would ICE in tree-ssa-dce.c:process_worklist() when + the function was expecting an SSA_NAME but found a VAR_DECL. */ + +/* { dg-do compile } */ +/* { dg-options "-O -ftree-dce" } */ + +void *do_it(void * dest, const void * src); +double *create_float(void); + +void parse_rvalue(void **DataPtr) +{ + double local = 0.0; + int terms = 1; + + *DataPtr = create_float(); + + switch (terms) + { + case 1: + *((double *)*DataPtr) = local; + break; + + case 2: + do_it(*DataPtr, &local); + break; + } +} +
20030907-2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20030728-1.c =================================================================== --- 20030728-1.c (nonexistent) +++ 20030728-1.c (revision 816) @@ -0,0 +1,47 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-optimized" } */ + + +union tree_node; +typedef union tree_node *tree; + +enum tree_code +{ + ARRAY_TYPE, + LAST_AND_UNUSED_TREE_CODE +}; + +struct tree_common +{ + enum tree_code code:8; +}; + + + + + +union tree_node +{ + struct tree_common common; +}; + + + + +int +objects_must_conflict_p (t1, t2) + tree t1, t2; +{ + + if ((t1->common.code == ARRAY_TYPE) != (t2 + && t2->common.code == ARRAY_TYPE)) + return 11; + + + return foo (t2 ? get_alias_set (t2) : 0); +} + +/* There should be two assignments of variables to the value zero. */ +/* { dg-final { scan-tree-dump-times " = 0" 2 "optimized"} } */ + +/* { dg-final { cleanup-tree-dump "optimized" } } */
20030728-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20030807-5.c =================================================================== --- 20030807-5.c (nonexistent) +++ 20030807-5.c (revision 816) @@ -0,0 +1,39 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-dom3" } */ + +extern void abort (void); +struct rtx_def; +typedef struct rtx_def *rtx; + + +struct rtx_def +{ + + int code; + unsigned int unchanging:1; + +}; +static rtx current_sym_addr; + +int +foo () +{ + if (current_sym_addr->code == 42 + && (({ + rtx _rtx = current_sym_addr; + if (((_rtx)->code) != 42) + abort (); + _rtx;} + )->unchanging)) + return 0; +} + +/* There should be precisely one load of ->code. If there is + more than, then the dominator optimizations failed. */ +/* { dg-final { scan-tree-dump-times "->code" 1 "dom3"} } */ + +/* There should be two IF statements. One for 'current_sym_addr->code == 42'. + The other one for '(EXPR)->unchanging'. */ +/* { dg-final { scan-tree-dump-times "if " 2 "dom3"} } */ + +/* { dg-final { cleanup-tree-dump "dom3" } } */
20030807-5.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: reassoc-9.c =================================================================== --- reassoc-9.c (nonexistent) +++ reassoc-9.c (revision 816) @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-reassoc1" } */ + +int main(int a, int b, int c, int d, int e, int f, int g, int h) +{ + /* Should be transformed into e = 20 */ + int i = (a + 9) + (c + 8); + int j = (-c + 1) + (-a + 2); + + e = i + j; + return e; +} +/* { dg-final { scan-tree-dump-times "= 20" 1 "reassoc1"} } */ +/* { dg-final { cleanup-tree-dump "reassoc1" } } */
reassoc-9.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: structopt-1.c =================================================================== --- structopt-1.c (nonexistent) +++ structopt-1.c (revision 816) @@ -0,0 +1,15 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-lim-details" } */ +int x; int y; +struct { int x; int y; } global; +int foo() { + int i; + for ( i=0; i<10; i++) + y += x*x; + for ( i=0; i<10; i++) + global.y += global.x*global.x; +} + +/* { dg-final { scan-tree-dump-times "Executing store motion of global.y" 1 "lim" } } */ +/* XXX: We should also check for the load motion of global.x, but there is no easy way to do this. */ +/* { dg-final { cleanup-tree-dump "lim" } } */
structopt-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: recip-7.c =================================================================== --- recip-7.c (nonexistent) +++ recip-7.c (revision 816) @@ -0,0 +1,27 @@ +/* { dg-options "-O1 -funsafe-math-optimizations -fno-trapping-math -fdump-tree-recip" } */ +/* { dg-do compile } */ + +/* Test inserting in a block that does not contain a division. */ + +extern double h(); + +double f(int x, double z, double w) +{ + double b, c, d, e, f; + double y = h (); + + if (x) + b = 1 / y, c = z / y; + else + b = 3 / y, c = w / y; + + d = b / y; + e = c / y; + f = 1 / y; + + return d + e + f; +} + +/* { dg-final { scan-tree-dump-times " / " 1 "recip" } } */ +/* { dg-final { cleanup-tree-dump "recip" } } */ +
recip-7.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: alias-11.c =================================================================== --- alias-11.c (nonexistent) +++ alias-11.c (revision 816) @@ -0,0 +1,19 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-optimized" } */ + +struct param { int *a; }; +void foo(struct param *p); +int bar(void) +{ + int a[32]; + struct param p; + a[0] = 1; + a[1] = 1; + p.a = &a[0]; + foo(&p); + return a[0] + *p.a; +} + +/* { dg-final { scan-tree-dump "return \\*p\\.a \\\+ a.0.;" "optimized" } } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */ +
alias-11.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: loadpre4.c =================================================================== --- loadpre4.c (nonexistent) +++ loadpre4.c (revision 816) @@ -0,0 +1,19 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-pre-stats" } */ +int main(int *a, int argc) +{ + int b; + int c; + int i; + int d, e; + + for (i = 0; i < argc; i++) + { + e = *a; + *a = 9; + } + return d + e; +} + +/* { dg-final { scan-tree-dump-times "Eliminated: 1" 1 "pre" } } */ +/* { dg-final { cleanup-tree-dump "pre" } } */
loadpre4.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: loop-5.c =================================================================== --- loop-5.c (nonexistent) +++ loop-5.c (revision 816) @@ -0,0 +1,28 @@ +/* A test for induction variable merging. */ + +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-optimized" } */ + +void foo(long); + +void xxx(void) +{ + long iter, jter; + + for (iter = 0, jter = 2; iter < 100; iter++, jter++) + { + foo (iter); + foo (jter); + } +} + +/* Only iter variable should remain. */ + +/* { dg-final { scan-tree-dump-times "int iter" 1 "optimized" } } */ +/* { dg-final { scan-tree-dump-times "jter" 0 "optimized" } } */ + +/* And the use of jter should be replaced by iter + 2 */ + +/* { dg-final { scan-tree-dump-times " \\+ 2" 1 "optimized" } } */ + +/* { dg-final { cleanup-tree-dump "optimized" } } */
loop-5.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: vrp16.c =================================================================== --- vrp16.c (nonexistent) +++ vrp16.c (revision 816) @@ -0,0 +1,23 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-vrp1-details" } */ + + +extern void abort (void) __attribute__ ((__noreturn__)); +struct rtx_def; +typedef struct rtx_def *rtx; +struct rtx_def +{ + int code; +}; +int +nonlocal_mentioned_p (rtx x) +{ + if (x->code == 6 || x->code == 7) + if (x->code == 7) + if (x->code != 7) + abort (); +} + +/* { dg-final { scan-tree-dump-times "Folding predicate .*to 0" 1 "vrp1" } } */ +/* { dg-final { cleanup-tree-dump "vrp1" } } */ +
vrp16.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: phi-opt-3.c =================================================================== --- phi-opt-3.c (nonexistent) +++ phi-opt-3.c (revision 816) @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-optimized" } */ + +int f(int a, int b) +{ + if (a == 0) + return 0; + if (a != b) + return a; + return a; +} + +/* There should be no ifs as the PHI arguments, we did not + optimize this before because PHI-OPT did not look at + PHIs which have more than two arguments. */ +/* { dg-final { scan-tree-dump-times "if" 0 "optimized"} } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */
phi-opt-3.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ivopts-1.c =================================================================== --- ivopts-1.c (nonexistent) +++ ivopts-1.c (revision 816) @@ -0,0 +1,26 @@ +/* { dg-do compile } */ + +/* Not all platforms support TImode integers. */ +#if defined(__LP64__) && !defined(__hppa__) +typedef int TItype __attribute__ ((mode (TI))); +#else +typedef long TItype; +#endif + +TItype last_data_offset ; +int store; +char *data; + +f () +{ + + TItype data_offset = last_data_offset; + char *p; + + for (p = data; *p; p++) + { + data_offset++; + g (data_offset); + store = data_offset + 1; + } +}
ivopts-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pr23192.c =================================================================== --- pr23192.c (nonexistent) +++ pr23192.c (revision 816) @@ -0,0 +1,23 @@ +/* { dg-options "-O2" } */ +/* { dg-do run } */ + +struct S { int i; } s; + +void f (struct S *q) +{ + int a, *p; + p = &a; + if (q) + p = &q->i; + *p = 1; +} + +void abort (void); + +int main (void) +{ + f (&s); + if (s.i != 1) + abort (); + return 0; +}
pr23192.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: tailrecursion-2.c =================================================================== --- tailrecursion-2.c (nonexistent) +++ tailrecursion-2.c (revision 816) @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -foptimize-sibling-calls -fdump-tree-tailr-details" } */ +int +t(char *a) +{ + static char p[100]; + if (a) + return t(p); + else + return 0; +} +/* { dg-final { scan-tree-dump-times "Eliminated tail recursion" 1 "tailr"} } */ +/* { dg-final { cleanup-tree-dump "tailr" } } */
tailrecursion-2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20031021-1.c =================================================================== --- 20031021-1.c (nonexistent) +++ 20031021-1.c (revision 816) @@ -0,0 +1,21 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-optimized" } */ + +struct A +{ + int i : 8; +}; + +signed char c1, c2; +struct A a; + +int main() +{ + a.i = c1; + c2 = a.i; + return a.i; +} + +/* We should only store to a.i, not load from it. */ +/* { dg-final { scan-tree-dump-times "a.i" 1 "optimized" } } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */
20031021-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: stdarg-5.c =================================================================== --- stdarg-5.c (nonexistent) +++ stdarg-5.c (revision 816) @@ -0,0 +1,119 @@ +/* This test has architecture specific function passing details. */ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-stdarg" } */ + +#include + +extern void foo (int, va_list); +extern void bar (int); +struct S1 { int i; double d; int j; double e; } s1; +struct S2 { double d; long i; } s2; +int y; +_Complex int ci; +_Complex double cd; + +/* Here va_arg can be executed more than once for one va_start. */ +void +f1 (int i, ...) +{ + va_list ap; + va_start (ap, i); + while (i-- > 0) + s1 = va_arg (ap, struct S1); + va_end (ap); +} +/* { dg-final { scan-tree-dump "f1: va_list escapes 0, needs to save 0 GPR units and 0 FPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && lp64 } } } } */ +/* { dg-final { scan-tree-dump "f1: va_list escapes 0, needs to save all GPR units and 1" "stdarg" { target alpha*-*-linux* } } } */ +/* { dg-final { scan-tree-dump "f1: va_list escapes 0, needs to save all GPR units and 0 FPR units" "stdarg" { target s390*-*-linux* } } } */ + +void +f2 (int i, ...) +{ + va_list ap; + va_start (ap, i); + while (i-- > 0) + s2 = va_arg (ap, struct S2); + va_end (ap); +} +/* { dg-final { scan-tree-dump "f2: va_list escapes 0, needs to save all GPR units and all FPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && lp64 } } } } */ +/* { dg-final { scan-tree-dump "f2: va_list escapes 0, needs to save all GPR units and 1" "stdarg" { target alpha*-*-linux* } } } */ +/* { dg-final { scan-tree-dump "f2: va_list escapes 0, needs to save all GPR units and 0 FPR units" "stdarg" { target s390*-*-linux* } } } */ + +/* Here va_arg can be executed at most as many times as va_start. */ +void +f3 (int i, ...) +{ + va_list ap; + int j = i; + while (j-- > 0) + { + va_start (ap, i); + s1 = va_arg (ap, struct S1); + va_end (ap); + bar (s1.i); + } +} +/* { dg-final { scan-tree-dump "f3: va_list escapes 0, needs to save 0 GPR units and 0 FPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && lp64 } } } } */ +/* { dg-final { scan-tree-dump "f3: va_list escapes 0, needs to save 32 GPR units and 1" "stdarg" { target alpha*-*-linux* } } } */ +/* { dg-final { scan-tree-dump "f3: va_list escapes 0, needs to save 1 GPR units and 0 FPR units" "stdarg" { target s390*-*-linux* } } } */ + +void +f4 (int i, ...) +{ + va_list ap; + int j = i; + while (j-- > 0) + { + va_start (ap, i); + s2 = va_arg (ap, struct S2); + y = va_arg (ap, int); + va_end (ap); + bar (s2.i); + } +} +/* { dg-final { scan-tree-dump "f4: va_list escapes 0, needs to save 16 GPR units and 16 FPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && lp64 } } } } */ +/* { dg-final { scan-tree-dump "f4: va_list escapes 0, needs to save 24 GPR units and 1" "stdarg" { target alpha*-*-linux* } } } */ +/* { dg-final { scan-tree-dump "f4: va_list escapes 0, needs to save 2 GPR units and 0 FPR units" "stdarg" { target s390*-*-linux* } } } */ + +void +f5 (int i, ...) +{ + va_list ap; + va_start (ap, i); + ci = va_arg (ap, _Complex int); + ci += va_arg (ap, _Complex int); + va_end (ap); + bar (__real__ ci + __imag__ ci); +} +/* { dg-final { scan-tree-dump "f5: va_list escapes 0, needs to save 16 GPR units and 0 FPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && lp64 } } } } */ +/* { dg-final { scan-tree-dump "f5: va_list escapes 0, needs to save 32 GPR units and 1" "stdarg" { target alpha*-*-linux* } } } */ +/* { dg-final { scan-tree-dump "f5: va_list escapes 0, needs to save (4|2) GPR units and 0 FPR units" "stdarg" { target s390*-*-linux* } } } */ + +void +f6 (int i, ...) +{ + va_list ap; + va_start (ap, i); + ci = va_arg (ap, _Complex int); + cd = va_arg (ap, _Complex double); + va_end (ap); + bar (__real__ ci + __imag__ cd); +} +/* { dg-final { scan-tree-dump "f6: va_list escapes 0, needs to save 8 GPR units and 32 FPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && lp64 } } } } */ +/* { dg-final { scan-tree-dump "f6: va_list escapes 0, needs to save 32 GPR units and 3" "stdarg" { target alpha*-*-linux* } } } */ +/* { dg-final { scan-tree-dump "f6: va_list escapes 0, needs to save (3|2) GPR units and 0 FPR units" "stdarg" { target s390*-*-linux* } } } */ + +void +f7 (int i, ...) +{ + va_list ap; + va_start (ap, i); + cd = va_arg (ap, _Complex double); + cd += va_arg (ap, _Complex double); + va_end (ap); + bar (__real__ cd + __imag__ cd); +} +/* { dg-final { scan-tree-dump "f7: va_list escapes 0, needs to save 0 GPR units and 64 FPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && lp64 } } } } */ +/* { dg-final { scan-tree-dump "f7: va_list escapes 0, needs to save 32 GPR units and 2" "stdarg" { target alpha*-*-linux* } } } */ +/* { dg-final { scan-tree-dump "f7: va_list escapes 0, needs to save 2 GPR units and 0 FPR units" "stdarg" { target s390*-*-linux* } } } */ +/* { dg-final { cleanup-tree-dump "stdarg" } } */
stdarg-5.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: gen-vect-11.c =================================================================== --- gen-vect-11.c (nonexistent) +++ gen-vect-11.c (revision 816) @@ -0,0 +1,32 @@ +/* { dg-do run { target vect_cmdline_needed } } */ +/* { dg-options "-O2 -ftree-vectorize -ftree-vectorizer-verbose=3 -fwrapv -fdump-tree-vect-stats" } */ + +#include + +#define N 16 + +int main () +{ + int i; + char ia[N]; + char ic[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; + char ib[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; + + for (i = 0; i < N; i++) + { + ia[i] = ib[i] + ic[i]; + } + + /* check results: */ + for (i = 0; i < N; i++) + { + if (ia[i] != ib[i] + ic[i]) + abort (); + } + + return 0; +} + + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */ +/* { dg-final { cleanup-tree-dump "vect" } } */
gen-vect-11.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pr24287.c =================================================================== --- pr24287.c (nonexistent) +++ pr24287.c (revision 816) @@ -0,0 +1,25 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-optimized" } */ +int g1(int); +int h(int *a, int *b)__attribute__((pure)); +void link_error(); + +/* The calls to link_error should be eliminated, since nothing escapes to + non-pure functions. */ +int g(void) +{ + int t = 0, t1 = 2; + int t2 = h(&t, &t1); + if (t != 0) + link_error (); + if (t1 != 2) + link_error (); + g1(t2); + if (t != 0) + link_error (); + if (t1 != 2) + link_error (); + return t2 == 2; +} +/* { dg-final { scan-tree-dump-times "link_error" 0 "optimized"} } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */
pr24287.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pr15791-5.c =================================================================== --- pr15791-5.c (nonexistent) +++ pr15791-5.c (revision 816) @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-options "-fdump-tree-gimple" } */ + +int foo(int i, int j) +{ + char g[16]; + if (&g[i] == &g[j]) + return 1; + return 0; +} + +/* { dg-final { scan-tree-dump-times "i == j" 1 "gimple" } } */ +/* { dg-final { cleanup-tree-dump "gimple" } } */
pr15791-5.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20031106-1.c =================================================================== --- 20031106-1.c (nonexistent) +++ 20031106-1.c (revision 816) @@ -0,0 +1,21 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-optimized" } */ + +extern void link_error (void); + +/* Check for dead stores to an array. */ + +void foo (int testarray[]) +{ + testarray[0] = 0; + testarray[0]++; + if (testarray[0] != 1) + link_error (); +} + +/* There should be only one reference to "testarray" and one in the function header. */ +/* { dg-final { scan-tree-dump-times "testarray" 2 "optimized" } } */ + +/* There should be no link_error calls. */ +/* { dg-final { scan-tree-dump-times "link_error" 0 "optimized"} } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */
20031106-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20050412-1.c =================================================================== --- 20050412-1.c (nonexistent) +++ 20050412-1.c (revision 816) @@ -0,0 +1,16 @@ +/* PR tree-optimization/14627 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-optimized" } */ + + +int b; +void foo (int a) { + if (a) + a = 3; + b = a; +} + +/* Make sure we do not have an assignment a = 0 in the resulting + optimized dump. */ +/* { dg-final { scan-tree-dump-times "a.* = 0;" 0 "optimized"} } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */
20050412-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20030711-2.c =================================================================== --- 20030711-2.c (nonexistent) +++ 20030711-2.c (revision 816) @@ -0,0 +1,69 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-dom3" } */ + + +struct rtx_def; +typedef struct rtx_def *rtx; +struct rtvec_def; +typedef struct rtvec_def *rtvec; +union tree_node; +typedef union tree_node *tree; +typedef struct mem_attrs +{ + long alias; +} +mem_attrs; +union rtunion_def +{ + mem_attrs *rtmem; +}; +typedef union rtunion_def rtunion; +struct rtx_def +{ + int code; + rtunion fld[1]; +}; +struct tree_decl +{ + rtx rtl; +}; +union tree_node +{ + struct tree_decl decl; +}; +long +get_alias_set (t,z) + tree t; + rtx z; +{ + if (t->decl.rtl && (((t->decl.rtl ? z + : (make_decl_rtl (t, 0), t->decl.rtl)))->code)) + return (((((t->decl.rtl ? z : (make_decl_rtl (t, 0), t->decl.rtl)))-> + fld[1]).rtmem) == 0 ? 0 : ((((( + { + t;} + )->decl. + rtl ? z : (make_decl_rtl (t, 0), + t->decl.rtl)))-> + fld[1]).rtmem)->alias); +} + +/* The calls to make_decl_rtl should be eliminated +/* { dg-final { scan-tree-dump-not "make_decl_rtl \\(\\)" "dom3" } } */ + +/* There should be three IF conditionals. */ +/* { dg-final { scan-tree-dump-times "if " 3 "dom3"} } */ + +/* There should be one loads of decl.rtl. */ +/* { dg-final { scan-tree-dump-times "decl\\.rtl" 1 "dom3"} } */ + +/* There should be one load of code. */ +/* { dg-final { scan-tree-dump-times "code" 1 "dom3"} } */ + +/* There should be one load of rtmem. */ +/* { dg-final { scan-tree-dump-times "rtmem" 1 "dom3"} } */ + +/* There should be one load of alias. */ +/* { dg-final { scan-tree-dump-times "->alias" 1 "dom3"} } */ + +/* { dg-final { cleanup-tree-dump "dom3" } } */
20030711-2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20050215-1.c =================================================================== --- 20050215-1.c (nonexistent) +++ 20050215-1.c (revision 816) @@ -0,0 +1,14 @@ +/* PR middle-end/19857 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-optimized" } */ + +int i; +int foo (void) +{ + return i & ~(unsigned int) 3; +} + +/* Make sure the optimizers don't introduce overflow where one + did not exist in the original. */ +/* { dg-final { scan-tree-dump-times "-0+4" 0 "optimized"} } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */
20050215-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: alias-7.c =================================================================== --- alias-7.c (nonexistent) +++ alias-7.c (revision 816) @@ -0,0 +1,17 @@ +/* { dg-do run } */ +/* { dg-options "-O2" } */ + +void abort(void); +int main() +{ + int a[2]; + int *p = a; + int i; + a[0] = 1; + a[1] = 2; + for (i=0; i<2; ++i) + if (p[i] != i+1) + abort(); + return 0; +} +
alias-7.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20030814-1.c =================================================================== --- 20030814-1.c (nonexistent) +++ 20030814-1.c (revision 816) @@ -0,0 +1,21 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-dom3" } */ + +extern void abort (void); + +com(int *blah) +{ + int z = *blah; + if (z == 256) + { + oof (z); + abort (); + } + return *blah; +} + +/* There should be precisely one load of blah. If there is + more than one, then the dominator optimizations failed. */ +/* { dg-final { scan-tree-dump-times "\\*blah" 1 "dom3"} } */ + +/* { dg-final { cleanup-tree-dump "dom3" } } */
20030814-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20040615-1.c =================================================================== --- 20040615-1.c (nonexistent) +++ 20040615-1.c (revision 816) @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-dom1" } */ + +void bar1 (void); +void bar2 (void); + +void +foo (unsigned int a, unsigned int b) +{ + if (a >= b) + bar1 (); + else if (b <= a) + bar2 (); +} + +/* { dg-final { scan-tree-dump-times "bar2" 0 "dom1" } } */ +/* { dg-final { cleanup-tree-dump "dom1" } } */
20040615-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ssa-dom-ccp-1.c =================================================================== --- ssa-dom-ccp-1.c (nonexistent) +++ ssa-dom-ccp-1.c (revision 816) @@ -0,0 +1,18 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-optimized" } */ +int t(int a) __attribute__ ((const)); +void abort (void); +int +ccp(int b) +{ + int a=1; + a++; + a++; + a++; + if (b) + abort(); + return a; +} +/* We should propagate constant 4 into return. */ +/* { dg-final { scan-tree-dump-times "return 4" 1 "optimized"} } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */
ssa-dom-ccp-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ssa-pre-1.c =================================================================== --- ssa-pre-1.c (nonexistent) +++ ssa-pre-1.c (revision 816) @@ -0,0 +1,21 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-pre-stats" } */ +extern int printf (const char *, ...); +int main(int argc, char **argv) +{ + int a; + int b; + int c; + b = argc + 1; + c = argc + 2; + a = b + c; + if (argc * 2) + { + c = argc + 3; + } + printf ("%d, %d\n", a, b + c); +} +/* We should eliminate one evaluation of b + c along the main path, + causing one reload. */ +/* { dg-final { scan-tree-dump-times "Eliminated: 1" 1 "pre"} } */ +/* { dg-final { cleanup-tree-dump "pre" } } */
ssa-pre-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ssa-ccp-12.c =================================================================== --- ssa-ccp-12.c (nonexistent) +++ ssa-ccp-12.c (revision 816) @@ -0,0 +1,32 @@ +/* { dg-do run } */ +/* { dg-options "-O2" } */ + +struct A +{ + int a; + int b; +}; + +struct A a; +const int B = 42; + +void foo (int i) +{ + if (i > 10) + a.a = 42; + else + { + a.b = 21; + a.a = a.b + 21; + } + + /* This should be folded to 'if (0)' as a.a and B are both 42. */ + if (a.a != B) + link_error (); +} + +main () +{ + foo (3); + return 0; +}
ssa-ccp-12.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: reassoc-11.c =================================================================== --- reassoc-11.c (nonexistent) +++ reassoc-11.c (revision 816) @@ -0,0 +1,11 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-reassoc1" } */ +int main(int a, int b, int c, int d) +{ + /* All the xor's cancel each other out, leaving 0 */ + int e = (a ^ b) ^ (c ^ d); + int f = (c ^ a) ^ (b ^ d); + return e ^ f; +} +/* { dg-final { scan-tree-dump-times "= 0" 1 "reassoc1"} } */ +/* { dg-final { cleanup-tree-dump "reassoc1" } } */
reassoc-11.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: vrp25.c =================================================================== --- vrp25.c (nonexistent) +++ vrp25.c (revision 816) @@ -0,0 +1,52 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-vrp1-details" } */ + +extern void abort (); +int tree_code_length[100]; + +blah (int code1) +{ + unsigned char D18670; + + if (code1 != 53) goto L0; else goto L1; + +L0: + abort (); + +L1: + D18670 = tree_code_length[53]; + if (D18670 <= 1) goto L2; else goto L3; + +L2: + abort (); + +L3: + if (D18670 == 2) goto L4; else goto L5; + +L4: + abort (); + +L5: + arf (); + if (code1 != 53) goto L6; else goto L7; + +L6: + abort (); + +L7: + if (D18670 <= 2) goto L8; else goto L9; + +L8: + abort (); + +L9: + return; + +} + +/* The second test of (code1 != 53) and the test (D18670 <= 2) are + both totally subsumed by earlier tests and thus should be folded + away using VRP. */ +/* { dg-final { scan-tree-dump-times "Folding predicate" 2 "vrp1" } } */ +/* { dg-final { cleanup-tree-dump "vrp1" } } */ +
vrp25.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ssa-dce-3.c =================================================================== --- ssa-dce-3.c (nonexistent) +++ ssa-dce-3.c (revision 816) @@ -0,0 +1,31 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-cddce" } */ + +int main(void) +{ + unsigned i, j; + + for (i = 1, j = 0; i != 0; i+=2) + { + j += 500; + if (j % 7) + { + j++; + } + else + { + j--; + } + } + + return 0; +} + +/* We should eliminate the inner condition, but the loop must be preserved + as it is infinite. Therefore there should be just one phi node (for i): */ +/* { dg-final { scan-tree-dump-times "PHI " 1 "cddce"} } */ + +/* And one if (for the exit condition of the loop): */ +/* { dg-final { scan-tree-dump-times "if " 1 "cddce"} } */ + +/* { dg-final { cleanup-tree-dump "cddce" } } */
ssa-dce-3.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: vrp08.c =================================================================== --- vrp08.c (nonexistent) +++ vrp08.c (revision 816) @@ -0,0 +1,23 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fno-tree-fre -fdump-tree-vrp1-details" } */ + +/* Compile with -fno-tree-fre -O2 to prevent CSEing *p. */ +foo (int a, int *p) +{ + int x = *p + 2; + int y = *p - 1; + int z = *p + 9; + + /* This should be folded to if (1), but only one ASSERT_EXPR should + be inserted. */ + if (p) + a = x + y + z; + else + a = x - y; + + return a; +} + +/* { dg-final { scan-tree-dump-times "Folding predicate p_.*to 1" 1 "vrp1" } } */ +/* { dg-final { scan-tree-dump-times "PREDICATE: p_. ne_expr 0" 1 "vrp1" } } */ +/* { dg-final { cleanup-tree-dump "vrp1" } } */
vrp08.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pr20256.c =================================================================== --- pr20256.c (nonexistent) +++ pr20256.c (revision 816) @@ -0,0 +1,25 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -ftree-loop-linear -fdump-tree-ltrans-all" } */ +/* { dg-require-effective-target size32plus } */ + +int foo() +{ + int x[2][2], y[2]; + int i, n, s; + + /* This is a reduction: there is a scalar dependence that cannot be + removed by rewriting IVs. This code cannot and should not be + transformed into a perfect loop. */ + for (n = 0; n < 2; n++) + { + s = 0; + for (i = 0; i < 2; i++) + s += x[n][i]*y[i]; + s += 1; + } + + return s; +} + +/* { dg-final { scan-tree-dump-times "converted loop nest to perfect loop nest" 0 "ltrans"} } */ +/* { dg-final { cleanup-tree-dump "ltrans" } } */
pr20256.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ssa-pre-9.c =================================================================== --- ssa-pre-9.c (nonexistent) +++ ssa-pre-9.c (revision 816) @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fno-tree-dominator-opts -fdump-tree-fre-stats" } */ +int +foo (unsigned long a) +{ + int b = __builtin_clzl (a); + int c = __builtin_clzl (a); + if (b == c) + return 1; + return 0; +} +/* { dg-final { scan-tree-dump-times "Eliminated: 1" 1 "fre"} } */ +/* { dg-final { cleanup-tree-dump "fre" } } */
ssa-pre-9.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pr20933.c =================================================================== --- pr20933.c (nonexistent) +++ pr20933.c (revision 816) @@ -0,0 +1,70 @@ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +extern __SIZE_TYPE__ strlen (__const char *__s) + __attribute__ ((__nothrow__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); +extern char *strcpy (char *__restrict __dest, __const char *__restrict __src) + __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2))); +extern char *getenv (__const char *__name) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))); +extern int access (__const char *__name, int __type) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))); +extern void * xmalloc (__SIZE_TYPE__) __attribute__ ((__malloc__)); + +static __inline__ const char * +try (const char *dir, const char *base) +{ + if (base != 0) + return base; + if (dir != 0 + && access (dir, 4 | 2 | 1) == 0) + return dir; + return 0; +} + +static const char tmp[] = { '/', 't', 'm', 'p', 0 }; +static const char usrtmp[] = +{ '/', 'u', 's', 'r', '/', 't', 'm', 'p', 0 }; +static const char vartmp[] = +{ '/', 'v', 'a', 'r', '/', 't', 'm', 'p', 0 }; + +static char *memoized_tmpdir; +char * +choose_tmpdir (void) +{ + const char *base = 0; + char *tmpdir; + unsigned int len; + + if (memoized_tmpdir) + return memoized_tmpdir; + + base = try (getenv ("TMPDIR"), base); + base = try (getenv ("TMP"), base); + base = try (getenv ("TEMP"), base); + + + base = try ("/tmp", base); + + + + base = try (vartmp, base); + base = try (usrtmp, base); + base = try (tmp, base); + + + if (base == 0) + base = "."; + + + + len = strlen (base); + tmpdir = xmalloc (len + 2); + strcpy (tmpdir, base); + /* Alias analysis was associating read-only memory tags to pointers + that are not read-only. We would then not issue any V_MAY_DEF in + this store. */ + tmpdir[len] = '/'; + tmpdir[len+1] = '\0'; + + memoized_tmpdir = tmpdir; + return tmpdir; +}
pr20933.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pr14490-4.c =================================================================== --- pr14490-4.c (nonexistent) +++ pr14490-4.c (revision 816) @@ -0,0 +1,10 @@ +/* { dg-do compile } */ +/* { dg-options "-fdump-tree-gimple -fwrapv" } */ +int g(int x) +{ + return (x + 10) < 0; +} +/* There should be no x < -10 and one x + 10. */ +/* { dg-final { scan-tree-dump-times "< -10" 0 "gimple"} } */ +/* { dg-final { scan-tree-dump-times "\\+ 10" 1 "gimple"} } */ +/* { dg-final { cleanup-tree-dump "gimple" } } */
pr14490-4.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: loop-10.c =================================================================== --- loop-10.c (nonexistent) +++ loop-10.c (revision 816) @@ -0,0 +1,33 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-optimized" } */ +/* { dg-require-effective-target int32plus } */ + +int bar (void); + +void foo (void) +{ + unsigned i, j, n; + + for (i = 0; i < 100000; i++) + ; + + n = bar (); + for (i = 0; i < n; i++) + ; + + for (i = 0; i < n; i++) + for (j = 0; j < n; j++) + ; + + /* These should not be removed. */ + for (i = 0; i < 10000; i++) + bar (); + + for (i = 0; i != n; i += 2) + ; +} + +/* { dg-final { scan-tree-dump-times "if " 3 "optimized" } } */ +/* { dg-final { scan-tree-dump-times "bar " 2 "optimized" } } */ + +/* { dg-final { cleanup-tree-dump "optimized" } } */
loop-10.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pr24990-1.c =================================================================== --- pr24990-1.c (nonexistent) +++ pr24990-1.c (revision 816) @@ -0,0 +1,21 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-optimized" } */ + +int f(int x) +{ + return ((~x) != 0); +} +int f1(int x) +{ + return ((~x) == 0); +} + +/* There should be no != 0 which is produced by the front-end as + ~x != 0 is the same as x != -1 (or ~0). Likewise for ==. */ +/* { dg-final { scan-tree-dump-times "!= 0" 0 "optimized"} } */ +/* { dg-final { scan-tree-dump-times "!= -1" 1 "optimized"} } */ +/* { dg-final { scan-tree-dump-times "== 0" 0 "optimized"} } */ +/* { dg-final { scan-tree-dump-times "== -1" 1 "optimized"} } */ + +/* { dg-final { cleanup-tree-dump "optimized" } } */ +
pr24990-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: bool-1.c =================================================================== --- bool-1.c (nonexistent) +++ bool-1.c (revision 816) @@ -0,0 +1,19 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-optimized" } */ + +int f(_Bool x) +{ + if (x != 0) + return 1; + return 0; +} + +/* There should be no != 0 which is produced by the front-end as + bool_var != 0 is the same as bool_var. */ +/* { dg-final { scan-tree-dump-times "!= 0" 0 "optimized"} } */ + +/* There should be no adde for powerpc. Check if we actually optimized + away the comparison. */ +/* { dg-final { scan-assembler-times "adde" 0 { target powerpc*-*-* } } } */ + +/* { dg-final { cleanup-tree-dump "optimized" } } */
bool-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: gen-vect-11c.c =================================================================== --- gen-vect-11c.c (nonexistent) +++ gen-vect-11c.c (revision 816) @@ -0,0 +1,39 @@ +/* { dg-do run { target vect_cmdline_needed } } */ +/* { dg-options "-O2 -ftree-vectorize -ftree-vectorizer-verbose=3 -fdump-tree-vect-stats" } */ + +#include + +#define N 16 + +#if LONG_MAX == 2147483647 +typedef short half_word; +#else +typedef int half_word; +#endif + +int main () +{ + int i; + half_word ia[N]; + half_word ic[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; + half_word ib[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; + + /* Not worthwhile, only 2 parts per int */ + for (i = 0; i < N; i++) + { + ia[i] = ib[i] + ic[i]; + } + + /* check results: */ + for (i = 0; i < N; i++) + { + if (ia[i] != ib[i] + ic[i]) + abort (); + } + + return 0; +} + + +/* { dg-final { scan-tree-dump-times "vectorized 0 loops" 1 "vect" } } */ +/* { dg-final { cleanup-tree-dump "vect" } } */
gen-vect-11c.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ssa-pre-13.c =================================================================== --- ssa-pre-13.c (nonexistent) +++ ssa-pre-13.c (revision 816) @@ -0,0 +1,26 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-pre-stats" } */ +double cos (double) __attribute__ ((const)); +double sin (double) __attribute__ ((const)); +double f(double a) +{ + double b; + double c,d; + double (*fp) (double) __attribute__ ((const)); + /* Partially redundant call */ + if (a < 2.0) + { + fp = sin; + c = fp (a); + } + else + { + c = 1.0; + fp = cos; + } + d = fp (a); + return d + c; +} + +/* { dg-final { scan-tree-dump-times "Eliminated: 1" 1 "pre"} } */ +/* { dg-final { cleanup-tree-dump "pre" } } */
ssa-pre-13.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20030703-1.c =================================================================== --- 20030703-1.c (nonexistent) +++ 20030703-1.c (revision 816) @@ -0,0 +1,22 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-dom3" } */ + +extern void abort (void); +extern int blah[]; + +foo(int index) +{ + if (blah [(unsigned int)index] != 0) + abort (); + if (blah [(unsigned int)index] != 0) + abort (); +} + +/* There should be precisely one load of blah. If there is + more than one, then the dominator optimizations failed. */ +/* { dg-final { scan-tree-dump-times "blah" 1 "dom3"} } */ + +/* There should be exactly one IF conditional. */ +/* { dg-final { scan-tree-dump-times "if " 1 "dom3"} } */ + +/* { dg-final { cleanup-tree-dump "dom3" } } */
20030703-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: loadpre17.c =================================================================== --- loadpre17.c (nonexistent) +++ loadpre17.c (revision 816) @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-pre-stats" } */ +typedef int type[2]; +int main(type *a, int argc) +{ + int d, e; + + /* Should be able to eliminate the second load of *a along the main path. */ + d = (*a)[argc]; + if (argc) + a++; + e = (*a)[argc]; + return d + e; +} +/* { dg-final { scan-tree-dump-times "Eliminated: 1" 1 "pre"} } */ +/* { dg-final { cleanup-tree-dump "pre" } } */
loadpre17.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: reassoc-2.c =================================================================== --- reassoc-2.c (nonexistent) +++ reassoc-2.c (revision 816) @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-optimized" } */ +int f (int a0,int a1,int a2,int a3,int a4) +{ +int b0, b1, b2, b3, b4,e; + /* this can be optimized to four additions... */ + b4 = a4 + a3 + a2 + a1 + a0; + b3 = a3 + a2 + a1 + a0; + b2 = a2 + a1 + a0; + b1 = a1 + a0; + /* This is actually 0 */ + e = b4 - b3 + b2 - b1 - a4 - a2; + return e; +} + +/* { dg-final { scan-tree-dump-times "return 0" 1 "optimized" } } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */
reassoc-2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: update-cunroll.c =================================================================== --- update-cunroll.c (nonexistent) +++ update-cunroll.c (revision 816) @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-optimized" } */ +int a[8]; +int t() +{ + int i; + for (i = 0; i < 3; i++) + if (a[i]) + break; + return i; +} +/* { dg-final { scan-tree-dump-times "Invalid sum" 0 "optimized"} } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */
update-cunroll.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: loop-18.c =================================================================== --- loop-18.c (nonexistent) +++ loop-18.c (revision 816) @@ -0,0 +1,24 @@ +/* A test for # of iterations estimation. We know that I does not overflow, + thus we can perform strength reduction (even though the 32-bit variable + i is first extended to 64-bit type). */ + +/* { dg-options "-O2 -fdump-tree-optimized" } */ +/* { dg-do compile { target x86_64-*-* } } */ + +unsigned bar(void); + +void foo(unsigned *p, unsigned n) +{ + unsigned i; + + for (i = 0; i < n; i++) + p[i] = bar (); +} + +/* Check that the memory reference was replaced with MEM, and that there is no + multiplication. */ + +/* { dg-final { scan-tree-dump-times "MEM" 1 "optimized" } } */ +/* { dg-final { scan-tree-dump-times "\[^\\n\\r\]*= \\* " 0 "optimized" } } */ + +/* { dg-final { cleanup-tree-dump "optimized" } } */
loop-18.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: gen-vect-28.c =================================================================== --- gen-vect-28.c (nonexistent) +++ gen-vect-28.c (revision 816) @@ -0,0 +1,35 @@ +/* { dg-do run { target vect_cmdline_needed } } */ +/* { dg-options "-O2 -ftree-vectorize -ftree-vectorizer-verbose=3 -fdump-tree-vect-stats" } */ + +#include + +#define N 128 +#define OFF 3 + +/* unaligned store. */ + +int main (int off) +{ + int i; + char ia[N+OFF]; + + for (i = 0; i < N; i++) + { + ia[i+off] = 5; + } + + /* check results: */ + for (i = 0; i < N; i++) + { + if (ia[i+off] != 5) + abort (); + } + + return 0; +} + + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */ +/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" } } */ +/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 1 "vect" } } */ +/* { dg-final { cleanup-tree-dump "vect" } } */
gen-vect-28.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20040624-1.c =================================================================== --- 20040624-1.c (nonexistent) +++ 20040624-1.c (revision 816) @@ -0,0 +1,21 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-dom1" } */ + +void bar1 (void); +void bar2 (void); + +void +foo (unsigned int a, unsigned int b) +{ + if (a >= b) + bar1 (); + else if (a <= b) + bar2 (); +} + +/* The second conditional is redundant since we know it must be + true (to reach the second condition we know a < b via the first + conditional. */ + +/* { dg-final { scan-tree-dump-times "if " 1 "dom1" } } */ +/* { dg-final { cleanup-tree-dump "dom1" } } */
20040624-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ssa-dse-3.c =================================================================== --- ssa-dse-3.c (nonexistent) +++ ssa-dse-3.c (revision 816) @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-dse1" } */ + +char Bool_Glob; +void f(void) +{ + Bool_Glob = 0; + Bool_Glob = 1; +} + +/* We should eliminate the first assignment to *p, but not the second. */ +/* { dg-final { scan-tree-dump-times "Bool_Glob = 0" 0 "dse1"} } */ +/* { dg-final { scan-tree-dump-times "Bool_Glob = 1" 1 "dse1"} } */ + +/* { dg-final { cleanup-tree-dump "dse1" } } */ +
ssa-dse-3.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: bool-9.c =================================================================== --- bool-9.c (nonexistent) +++ bool-9.c (revision 816) @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-optimized" } */ + +_Bool f1(_Bool x) +{ + return !!x; +} + +/* There should be no != 0 which is produced by the front-end as + bool_var != 0 is the same as bool_var. */ +/* { dg-final { scan-tree-dump-times "!= 0" 0 "optimized"} } */ + +/* There should be no subfe for powerpc. Check if we actually optimized + away the comparison. */ +/* { dg-final { scan-assembler-times "subfe" 0 { target powerpc*-*-* } } } */ + +/* { dg-final { cleanup-tree-dump "optimized" } } */
bool-9.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20030807-6.c =================================================================== --- 20030807-6.c (nonexistent) +++ 20030807-6.c (revision 816) @@ -0,0 +1,43 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-vrp1" } */ + + +void +foo (distance, i, j) + int distance[13][13]; + int i, j; +{ + if (distance[i][j] < 0) + distance[i][0] = ((distance[i][j]) < 0 ? -(distance[i][j]) : (distance[i][j])); +} + +void +foo2 (distance, i, j) + int distance[13][13]; + int i, j; +{ + if (distance[i][j] <= 0) + distance[i][0] = ((distance[i][j]) < 0 ? -(distance[i][j]) : (distance[i][j])); +} + +void +foo3 (distance, i, j) + int distance[13][13]; + int i, j; +{ + if (distance[i][j] > 0) + distance[i][0] = ((distance[i][j]) < 0 ? -(distance[i][j]) : (distance[i][j])); +} + +void +foo4 (distance, i, j) + double distance[13][13]; + int i, j; +{ + if (distance[i][j] >= 0) + distance[i][0] = ((distance[i][j]) < 0 ? -(distance[i][j]) : (distance[i][j])); +} + +/* There should be no ABS_EXPR. */ +/* { dg-final { scan-tree-dump-times "ABS_EXPR " 0 "vrp1"} } */ +/* { dg-final { cleanup-tree-dump "vrp1" } } */
20030807-6.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ssa-dom-thread-1.c =================================================================== --- ssa-dom-thread-1.c (nonexistent) +++ ssa-dom-thread-1.c (revision 816) @@ -0,0 +1,18 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-dom1-details" } */ +void t(void); +void q(void); +void q1(void); +void +threading(int a,int b) +{ + if (a>b) + t(); + else + q(); + if (a<=b) + q1(); +} +/* We should thread the jump twice and elliminate it. */ +/* { dg-final { scan-tree-dump-times "Threaded" 2 "dom1"} } */ +/* { dg-final { cleanup-tree-dump "dom1" } } */
ssa-dom-thread-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: structopt-2.c =================================================================== --- structopt-2.c (nonexistent) +++ structopt-2.c (revision 816) @@ -0,0 +1,46 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-optimized -fno-tree-sra" } */ + +/* Even without SRA being enabled, we should be able to eliminate every structure store and load here. */ +extern void foo (const int); +int main(void) +{ + struct a + { + int e; + int f; + int g; + } a; + struct a b; + int x, c; + a.e = 50; + a.f = 9; + a.g = a.e * a.f; + foo (a.f); + foo (a.g); + x = a.f; + c = a.e; + foo (x); + foo (c); + a.e = 5; + a.f = 40; + a.g = 90; + foo (a.e); + foo (a.f); + foo (a.g); + c = a.f; + foo (c); + b.e = 9; + a.e = b.e + 1 * c; + a.f = 30; + foo (a.e); + foo (a.f); + x = a.e * a.f; + foo (x); + +} +/* { dg-final { scan-tree-dump-times "a.e" 0 "optimized" } } */ +/* { dg-final { scan-tree-dump-times "a.f" 0 "optimized" } } */ +/* { dg-final { scan-tree-dump-times "a.g" 0 "optimized" } } */ +/* { dg-final { scan-tree-dump-times "b.e" 0 "optimized" } } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */
structopt-2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: foldstring-1.c =================================================================== --- foldstring-1.c (nonexistent) +++ foldstring-1.c (revision 816) @@ -0,0 +1,11 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-useless" } */ + +void +arf () +{ + if (""[0] == 0) + blah (); +} +/* { dg-final { scan-tree-dump-times "= 0;" 1 "useless"} } */ +/* { dg-final { cleanup-tree-dump "useless" } } */
foldstring-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: alias-12.c =================================================================== --- alias-12.c (nonexistent) +++ alias-12.c (revision 816) @@ -0,0 +1,18 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-alias1-vops" } */ + +struct { + int i; + int x[128]; + int j; +} a; + +int foo(int i) +{ + a.x[i] = 0; + return a.x[i]; +} + +/* { dg-final { scan-tree-dump "V_MAY_DEF" "alias1" } } */ +/* { dg-final { cleanup-tree-dump "alias1" } } */ +
alias-12.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: loadpre5.c =================================================================== --- loadpre5.c (nonexistent) +++ loadpre5.c (revision 816) @@ -0,0 +1,22 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-pre-stats" } */ +int p; +int r; +int a(void) +{ + return p; +} +int main(int argc) +{ + int q; + q = a(); + + /* We should be able to move the call to a into the if path. + in a perfect world, we'd actually decide that it can't touch + r, and not recompute it at all!. */ + if (argc) + r = 9; + return q + a(); +} +/* { dg-final { scan-tree-dump-times "Eliminated: 1" 1 "pre"} } */ +/* { dg-final { cleanup-tree-dump "pre" } } */
loadpre5.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: loop-6.c =================================================================== --- loop-6.c (nonexistent) +++ loop-6.c (revision 816) @@ -0,0 +1,28 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -funswitch-loops -fdump-tree-unswitch-details -fdump-tree-optimized" } */ + +int ch; +int a[100]; + +void xxx(void) +{ + int i; + + for (i = 0; i < 100; i++) + { + if (ch) + a[i] = ch; + else + a[i] = i; + } +} + +/* Loop should be unswitched. */ + +/* { dg-final { scan-tree-dump-times "Unswitching loop" 1 "unswitch" } } */ +/* { dg-final { cleanup-tree-dump "unswitch" } } */ + +/* In effect there should be exactly three conditional jumps in the final program. */ + +/* { dg-final { scan-tree-dump-times "else" 3 "optimized" } } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */
loop-6.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: vrp17.c =================================================================== --- vrp17.c (nonexistent) +++ vrp17.c (revision 816) @@ -0,0 +1,32 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-vrp1" } */ + +extern void abort (void) __attribute__ ((__noreturn__)); +union tree_node; +typedef union tree_node *tree; +extern const unsigned char tree_code_length[]; +struct tree_common +{ + int code; +}; +struct tree_exp +{ + tree operands[1]; +}; +union tree_node +{ + struct tree_common common; + struct tree_exp exp; +}; +int +gimplify_for_stmt (tree stmt) +{ + if (2 >= tree_code_length[stmt->common.code]) + abort (); + if (3 >= tree_code_length[stmt->common.code]) + abort (); +} + +/* { dg-final { scan-tree-dump-times "Simplified relational" 1 "vrp1" } } */ +/* { dg-final { cleanup-tree-dump "vrp1" } } */ +
vrp17.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: phi-opt-4.c =================================================================== --- phi-opt-4.c (nonexistent) +++ phi-opt-4.c (revision 816) @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-optimized" } */ + +_Bool t(); +_Bool t1(); + +_Bool f1() +{ + return t() && t1(); +} + +/* There should be only one if, the outer one; the inner one + should have been changed to straight line code with the + value of b (except that we don't fold ! (b != 0) into b + which means that we miss a sib calling opportunity). */ +/* { dg-final { scan-tree-dump-times "if " 1 "optimized"} } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */
phi-opt-4.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ivopts-2.c =================================================================== --- ivopts-2.c (nonexistent) +++ ivopts-2.c (revision 816) @@ -0,0 +1,24 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-ivopts-details" } */ + +long last_data_offset; +int store; +char *data; + +f () +{ + + long data_offset = last_data_offset; + char *p; + + for (p = data; *p; p++) + { + data_offset++; + g (data_offset); + store = data_offset + 1; + } +} + +/* We should only have two IVs. */ +/* { dg-final { scan-tree-dump-not "\\n candidates \\d+, \\d+,\[^\\n\]*\\n\[^\\n\]*\\nFinal cost" "ivopts" } } */ +/* { dg-final { cleanup-tree-dump "ivopts" } } */
ivopts-2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: copy-headers.c =================================================================== --- copy-headers.c (nonexistent) +++ copy-headers.c (revision 816) @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-ch-details" } */ + +extern int foo (int); + +void bla (void) +{ + int i, n = foo (0); + + for (i = 0; i < n; i++) + foo (i); +} + +/* There should be a header duplicated. */ +/* { dg-final { scan-tree-dump-times "Duplicating header" 1 "ch"} } */ +/* { dg-final { cleanup-tree-dump "ch" } } */
copy-headers.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: tailrecursion-3.c =================================================================== --- tailrecursion-3.c (nonexistent) +++ tailrecursion-3.c (revision 816) @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -foptimize-sibling-calls -fdump-tree-tailr-details" } */ +int +t(int a) +{ + int r; + if (a) + r = t(a-1); + else + return 0; + if (r) + r=r; + return r; +} +/* { dg-final { scan-tree-dump-times "Eliminated tail recursion" 1 "tailr"} } */ +/* { dg-final { cleanup-tree-dump "tailr" } } */
tailrecursion-3.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pr21458.c =================================================================== --- pr21458.c (nonexistent) +++ pr21458.c (revision 816) @@ -0,0 +1,20 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-vrp1" } */ + +extern void g (void); +extern void bar (int); + +int +foo (int a) +{ + int i; + + for (i = 1; i < 100; i++) + { + if (i) + g (); + } +} + +/* { dg-final { scan-tree-dump-times "Folding predicate.*to 1" 1 "vrp1" } } */ +/* { dg-final { cleanup-tree-dump "vrp1" } } */
pr21458.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20041002-1.c =================================================================== --- 20041002-1.c (nonexistent) +++ 20041002-1.c (revision 816) @@ -0,0 +1,24 @@ +/* PR tree-optimization/16632 + fold() failed to see the following "if" statements never trigger. */ + +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-ssa" } */ + +int +foo (int i) +{ + if ((i | 3) == 1) + return 1; + return 0; +} + +int +bar (int i) +{ + if ((i & 4) == 2) + return 1; + return 0; +} + +/* { dg-final { scan-tree-dump-times "if" 0 "ssa" } } */ +/* { dg-final { cleanup-tree-dump "ssa" } } */
20041002-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20041122-1.c =================================================================== --- 20041122-1.c (nonexistent) +++ 20041122-1.c (revision 816) @@ -0,0 +1,38 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-dom3" } */ + + +typedef unsigned int size_t; +extern void *xmalloc (size_t) __attribute__ ((__malloc__)); +struct edge_def +{ + struct basic_block_def *dest; + int flags; +}; +typedef struct edge_def *edge; +struct basic_block_def +{ + int flags; +}; +typedef struct basic_block_def *basic_block; +extern int n_basic_blocks; +extern edge frob (); +void +find_unreachable_blocks (int frobit) +{ + basic_block *tos, *worklist, bb; + tos = worklist = xmalloc (sizeof (basic_block) * n_basic_blocks); + edge e = frob(); + if (!(e->dest->flags & 4)) + { + e->dest->flags |= 4; + *tos++ = e->dest; + } +} + +/* If the aliasing code does its job properly, then we should be + able to determine that modifying e->dest->flags does not + modify e or e->dest. The net result is that we only need one + load of e->dest. */ +/* { dg-final { scan-tree-dump-times "->dest" 1 "dom3" { xfail *-*-* } } } */ +/* { dg-final { cleanup-tree-dump "dom3" } } */
20041122-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20031106-2.c =================================================================== --- 20031106-2.c (nonexistent) +++ 20031106-2.c (revision 816) @@ -0,0 +1,29 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-optimized" } */ + +extern void link_error (void); + +/* Check for dead stores to a struct. */ + +struct s +{ + char d; + int a, b; + double m; +}; + +void foo (struct s* teststruct) +{ + teststruct->a = 0; + teststruct->a++; + if (teststruct->a != 1) + link_error (); +} + +/* There should be only one reference to "teststruct" and one in the function header. */ +/* { dg-final { scan-tree-dump-times "teststruct" 2 "optimized" } } */ + +/* There should be no link_error calls. */ +/* { dg-final { scan-tree-dump-times "link_error" 0 "optimized"} } */ + +/* { dg-final { cleanup-tree-dump "optimized" } } */
20031106-2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20040513-1.c =================================================================== --- 20040513-1.c (nonexistent) +++ 20040513-1.c (revision 816) @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-forwprop1" } */ +void bar (void); + +void +foo (unsigned int a) +{ + if ((a >> 5) & 1) + bar (); +} + + + +/* There should be no casts to a _Bool since we can use the temporary + holding (a>>5)&1 directly. */ +/* { dg-final { scan-tree-dump-times "\\(_Bool\\)" 0 "forwprop1"} } */ +/* { dg-final { cleanup-tree-dump "forwprop1" } } */
20040513-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20050314-1.c =================================================================== --- 20050314-1.c (nonexistent) +++ 20050314-1.c (revision 816) @@ -0,0 +1,21 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-lim-details" } */ + +float a[100]; + +int foo(void); +float sinf (float); + +void xxx (void) +{ + int i, k = foo (); + + for (i = 0; i < 100; i++) + a[k] += sinf (i); +} + +/* Store motion may be applied to the assignment to a[k], since sinf + cannot read nor write the memory. */ + +/* { dg-final { scan-tree-dump-times "Moving statement" 1 "lim" } } */ +/* { dg-final { cleanup-tree-dump "lim" } } */
20050314-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20030711-3.c =================================================================== --- 20030711-3.c (nonexistent) +++ 20030711-3.c (revision 816) @@ -0,0 +1,61 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-dom3" } */ + + +struct rtx_def; +typedef struct rtx_def *rtx; +struct rtvec_def; +typedef struct rtvec_def *rtvec; +union tree_node; +typedef union tree_node *tree; +typedef struct mem_attrs +{ + long alias; +} +mem_attrs; +union rtunion_def +{ + mem_attrs *rtmem; +}; +typedef union rtunion_def rtunion; +struct rtx_def +{ + int code; + rtunion fld[1]; +}; +struct tree_decl +{ + rtx rtl; +}; +union tree_node +{ + struct tree_decl decl; +}; +long +get_alias_set (t) + tree t; +{ + if (t->decl.rtl != (void *) 0) + return (((t->decl.rtl->fld[1]).rtmem) == + 0 ? 0 + : ((((t->decl. + rtl ? 0 : (make_decl_rtl (t, ((void *) 0)), + t->decl.rtl)))->fld[1]).rtmem)->alias); +} + +/* The calls to make_decl_rtl should be eliminated. */ +/* { dg-final { scan-tree-dump-not "make_decl_rtl \\(\\)" "dom3" } } */ + +/* There should be two IF conditionals. */ +/* { dg-final { scan-tree-dump-times "if " 2 "dom3"} } */ + +/* There should be one load of decl.rtl. */ +/* { dg-final { scan-tree-dump-times "decl\\.rtl" 1 "dom3"} } */ + +/* There should be two loads of rtmem. */ +/* { dg-final { scan-tree-dump-times "rtmem" 2 "dom3"} } */ + +/* There should be one load of alias. */ +/* { dg-final { scan-tree-dump-times "->alias" 1 "dom3"} } */ + +/* { dg-final { cleanup-tree-dump "dom3" } } */
20030711-3.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.