diff options
| author | Xinliang David Li <davidxl@google.com> | 2017-07-12 23:28:45 +0000 |
|---|---|---|
| committer | Xinliang David Li <davidxl@google.com> | 2017-07-12 23:28:45 +0000 |
| commit | 07df59b7b656e0817001e2c37566dc9919100950 (patch) | |
| tree | 6e1c1c6e4a322d011fd101b2770b2c8966c7c909 | |
| parent | f564c6959e51223bbb1b11fd296140e13f8cf368 (diff) | |
| download | bcm5719-llvm-07df59b7b656e0817001e2c37566dc9919100950.tar.gz bcm5719-llvm-07df59b7b656e0817001e2c37566dc9919100950.zip | |
[PGO] Add a test for 2-deep loop nest
llvm-svn: 307864
| -rw-r--r-- | compiler-rt/test/profile/Linux/counter_promo_nest.c | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/compiler-rt/test/profile/Linux/counter_promo_nest.c b/compiler-rt/test/profile/Linux/counter_promo_nest.c new file mode 100644 index 00000000000..57e5c61d760 --- /dev/null +++ b/compiler-rt/test/profile/Linux/counter_promo_nest.c @@ -0,0 +1,51 @@ +// RUN: rm -fr %t.promo.prof +// RUN: rm -fr %t.nopromo.prof +// RUN: %clang_pgogen=%t.promo.prof/ -o %t.promo.gen -O2 %s +// RUN: %clang_pgogen=%t.promo.prof/ -o %t.promo.gen.ll -emit-llvm -S -O2 %s +// RUN: cat %t.promo.gen.ll | FileCheck --check-prefix=PROMO %s +// RUN: %run %t.promo.gen +// RUN: llvm-profdata merge -o %t.promo.profdata %t.promo.prof/ +// RUN: llvm-profdata show --counts --all-functions %t.promo.profdata > %t.promo.dump +// RUN: %clang_pgogen=%t.nopromo.prof/ -mllvm -do-counter-promotion=false -o %t.nopromo.gen -O2 %s +// RUN: %run %t.nopromo.gen +// RUN: llvm-profdata merge -o %t.nopromo.profdata %t.nopromo.prof/ +// RUN: llvm-profdata show --counts --all-functions %t.nopromo.profdata > %t.nopromo.dump +// RUN: diff %t.promo.profdata %t.nopromo.profdata +int g; +__attribute__((noinline)) void bar() { + g++; +} + +extern int printf(const char*,...); + +int c = 10; + +int main() +// PROMO-LABEL: @main +// PROMO: load{{.*}}@__profc_main{{.*}} +// PROMO-NEXT: add +// PROMO-NEXT: store{{.*}}@__profc_main{{.*}} +// PROMO-NEXT: load{{.*}}@__profc_main{{.*}} +// PROMO-NEXT: add +// PROMO-NEXT: store{{.*}}@__profc_main{{.*}} +// PROMO-NEXT: load{{.*}}@__profc_main{{.*}} +// PROMO-NEXT: add +// PROMO-NEXT: store{{.*}}@__profc_main{{.*}} +{ + int i, j, k; + + g = 0; + for (i = 0; i < c; i++) + for (j = 0; j < c; j++) + for (k = 0; k < c; k++) + bar(); + + for (i = 0; i < c; i++) + for (j = 0; j < 10*c;j++) + bar(); + + for (i = 0; i < 100*c; i++) + bar(); + + return 0; +} |

