1// Test if PGO sample use preparation passes are executed correctly.
2//
3// Ensure that instcombine is executed after simplifycfg and sroa so that
4// "a < 255" will not be converted to a * 256 < 255 * 256.
5// RUN: %clang_cc1 -O2 -fprofile-sample-use=%S/Inputs/pgo-sample.prof %s -emit-llvm -o - 2>&1 | FileCheck %s
6
7void bar(int);
8void foo(int x, int y, int z) {
9  int m;
10  for (m = 0; m < x ; m++) {
11    int a = (((y >> 8) & 0xff) * z) / 256;
12    bar(a < 255 ? a : 255);
13  }
14}
15
16// CHECK-NOT: icmp slt i32 %mul, 65280
17