Commit 3a3dd865 by Razya Ladelsky

ipa-1.c: New test.

        * gcc.dg/ipa/ipa-1.c: New test.
        * gcc.dg/ipa/ipa-2.c: New test.
        * gcc.dg/ipa/ipa-3.c: New test.
        * gcc.dg/ipa/ipa-4.c: New test.
        * gcc.dg/ipa/ipa-5.c: New test.
        * gcc.dg/ipa/ipa.exp: New file.

From-SVN: r105291
parent e2953e41
/* { dg-do compile } */
/* { dg-options "-O3 -fipa-cp -fdump-ipa-cp" } */
#include <stdio.h>
int g (int b, int c)
{
printf ("%d %d\n", b, c);
}
int f (int a)
{
/* Second parameter of g gets different values. */
if (a > 0)
g (a, 3);
else
g (a, 5);
}
int main ()
{
f (7);
return 0;
}
/* { dg-final { scan-ipa-dump-times "versioned function" 2 "cp" } } */
/* { dg-final { scan-ipa-dump-times "propagating const" 2 "cp" } } */
/* { dg-final { cleanup-ipa-dump "cp" } } */
/* { dg-do compile } */
/* { dg-options "-O3 -fipa-cp -fdump-ipa-cp" } */
#include <stdio.h>
int g (int b, int c)
{
printf ("%d %d\n", b, c);
}
int f (int a)
{
/* a is modified. */
if (a++ > 0)
g (a, 3);
}
int main ()
{
f (7);
return 0;
}
/* { dg-final { scan-ipa-dump-times "versioned function" 2 "cp" } } */
/* { dg-final { scan-ipa-dump-times "propagating const" 2 "cp" } } */
/* { dg-final { cleanup-ipa-dump "cp" } } */
/* { dg-do compile } */
/* { dg-options "-O3 -fipa-cp -fdump-ipa-cp" } */
/* Double constants. */
#include <stdio.h>
int g (double b, double c)
{
return (int)(b+c);
}
int f (double a)
{
if (a > 0)
g (a, 3.1);
else
g (a, 3.1);
}
int main ()
{
f (7.44);
return 0;
}
/* { dg-final { scan-ipa-dump-times "versioned function" 2 "cp" } } */
/* { dg-final { scan-ipa-dump-times "propagating const" 3 "cp" } } */
/* { dg-final { cleanup-ipa-dump "cp" } } */
/* { dg-do compile } */
/* { dg-options "-O3 -fipa-cp -fdump-ipa-cp" } */
#include <stdio.h>
int g (int b, int c)
{
printf ("%d %d\n", b, c);
}
int f (int a)
{
/* First and second parameter of g gets different values. */
if (a > 0)
g (a, 3);
else
g (a+1, 5);
}
int main ()
{
f (7);
return 0;
}
/* { dg-final { scan-ipa-dump-times "versioned function" 1 "cp" } } */
/* { dg-final { scan-ipa-dump-times "propagating const" 1 "cp" } } */
/* { dg-final { cleanup-ipa-dump "cp" } } */
/* { dg-do compile } */
/* { dg-options "-O3 -fipa-cp -fdump-ipa-cp" } */
/* Float & short constants. */
#include <stdio.h>
int g (float b, short c)
{
return c + (int)b;
}
int f (float a)
{
/* a is modified. */
if (a++ > 0)
g (a, 3);
}
int main ()
{
f (7.6);
return 0;
}
/* { dg-final { scan-ipa-dump-times "versioned function" 2 "cp" } } */
/* { dg-final { scan-ipa-dump-times "propagating const" 2 "cp" } } */
/* { dg-final { cleanup-ipa-dump "cp" } } */
# Copyright (C) 1997, 2004 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 2 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 this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
# 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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment