diff options
Diffstat (limited to 'gcc/testsuite/gcc.dg/ipa/ipa-clone-4.c')
-rw-r--r-- | gcc/testsuite/gcc.dg/ipa/ipa-clone-4.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/ipa/ipa-clone-4.c b/gcc/testsuite/gcc.dg/ipa/ipa-clone-4.c new file mode 100644 index 0000000..bf74e64 --- /dev/null +++ b/gcc/testsuite/gcc.dg/ipa/ipa-clone-4.c @@ -0,0 +1,30 @@ +/* { dg-options "-O3 -fdump-ipa-cp" } */ +__attribute__ ((used)) +int a[1000]; + +__attribute__ ((noinline)) +void +test2(int sz) +{ + for (int i = 0; i < sz; i++) + a[i]++; + asm volatile (""::"m"(a)); +} + +__attribute__ ((noinline)) +void +test1 (int sz) +{ + for (int i = 0; i < 1000; i++) + test2(sz); +} +int main() +{ + test1(1000); + return 0; +} +/* We should clone test1 and test2 for constant 1000. + In the past we did not do this since we did not clone for edges that are not hot + and call main->test1 is not considered hot since it is executed just once. */ +/* { dg-final { scan-ipa-dump-times "Creating a specialized node of test1" 1 "cp"} } */ +/* { dg-final { scan-ipa-dump-times "Creating a specialized node of test2" 1 "cp"} } */ |