brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.2 KiB · 0ad6f03 Raw
36 lines · c
1// RUN: rm -fr %t.prof2// RUN: %clang_pgogen=%t.prof/ -o %t.gen.cs -O2 %s3// RUN: %run %t.gen.cs4// RUN: llvm-profdata merge -o %t.cs.profdata %t.prof/5// Check context sensitive profile6// RUN: %clang_profuse=%t.cs.profdata  -O2 -emit-llvm -S %s -o - | FileCheck %s --check-prefix=CS7//8// RUN: %clang_profgen=%t.profraw -o %t.gen.cis -O2 %s9// RUN: %run %t.gen.cis10// RUN: llvm-profdata merge -o %t.cis.profdata %t.profraw11// Check context insensitive profile12// RUN: %clang_profuse=%t.cis.profdata  -O2 -emit-llvm -S %s -o - | FileCheck %s --check-prefix=CIS13int g1 = 1;14int volatile g2 = 2;15static void toggle(int t) {16  if (t & 1)17    g1 *= t;18  else19    g2 *= t;20}21 22int main() {23  int i;24  // CS: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}, !prof ![[PD1:[0-9]+]]25  // CIS: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}, !prof ![[PD:[0-9]+]]26  toggle(g1);27  // CS: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}, !prof ![[PD2:[0-9]+]]28  // CIS: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}, !prof ![[PD:[0-9]+]]29  toggle(g2);30  return 0;31}32 33// CS: ![[PD1]] = !{!"branch_weights", i32 0, i32 1}34// CS: ![[PD2]] = !{!"branch_weights", i32 1, i32 0}35// CIS: ![[PD]] = !{!"branch_weights", i32 2, i32 2}36