[clang][modules] Don't prevent translation of FW_Private includes when explicitly...
[llvm-project.git] / clang / test / Profile / c-ternary.c
blob680bb91317564aa6398b14556e28b35d4b9d6ac0
1 // RUN: %clang_cc1 -triple x86_64-apple-macosx10.11.0 -x c %s -o - -emit-llvm -fprofile-instrument=clang | FileCheck %s
3 // PR32019: Clang can lower some ternary operator expressions to select
4 // instructions. Make sure we only increment the profile counter for the
5 // condition when the condition evaluates to true.
6 // CHECK-LABEL: define{{.*}} i32 @f1
7 int f1(int x) {
8 // CHECK: [[TOBOOL:%.*]] = icmp ne i32 %{{.*}}, 0
9 // CHECK-NEXT: [[STEP:%.*]] = zext i1 [[TOBOOL]] to i64
10 // CHECK-NEXT: [[COUNTER:%.*]] = load i64, ptr getelementptr inbounds ([2 x i64], ptr @__profc_f1, i32 0, i32 1)
11 // CHECK-NEXT: add i64 [[COUNTER]], [[STEP]]
12 // CHECK: [[COND:%.*]] = select i1 [[TOBOOL]], i32 0, i32 1
13 return x ? 0 : 1;
14 // CHECK: ret i32 [[COND]]