1 // RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -o - %s | FileCheck %s
2 // RUN: %clang_cc1 -triple i386-mingw32 -fms-extensions -emit-llvm -o - %s | FileCheck %s
5 int isconst(void) __attribute__((const));
6 int ispure(void) __attribute__((pure
));
9 int test1(int *a
, int i
) {
10 // CHECK: store ptr %a, ptr [[A_ADDR:%.+]], align
11 // CHECK: [[A:%.+]] = load ptr, ptr [[A_ADDR]]
12 // CHECK: [[CMP:%.+]] = icmp ne ptr [[A]], null
13 // CHECK: call void @llvm.assume(i1 [[CMP]])
15 // CHECK: [[CALL:%.+]] = call i32 @isconst()
16 // CHECK: [[BOOL:%.+]] = icmp ne i32 [[CALL]], 0
17 // CHECK: call void @llvm.assume(i1 [[BOOL]])
19 // CHECK: [[CALLPURE:%.+]] = call i32 @ispure()
20 // CHECK: [[BOOLPURE:%.+]] = icmp ne i32 [[CALLPURE]], 0
21 // CHECK: call void @llvm.assume(i1 [[BOOLPURE]])
27 __builtin_assume(a
!= 0);
28 __builtin_assume(isconst());
29 __builtin_assume(ispure());
32 // Nothing is generated for an assume with side effects...
33 // CHECK-NOT: load ptr, ptr %i.addr
34 // CHECK-NOT: call void @llvm.assume
35 // CHECK-NOT: call i32 @nonconst()
40 __builtin_assume(++i
!= 0);
41 __builtin_assume(nonconst());