1 // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -std=c++23 %s -emit-llvm -o - | FileCheck %s
2 // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -std=c++23 -fno-assumptions %s -emit-llvm -o - | FileCheck %s --check-prefix=DISABLED
4 // DISABLED-NOT: @llvm.assume
10 [[assume(sizeof(T
) == sizeof(int))]];
13 // CHECK: @_Z1gii(i32 noundef [[X:%.*]], i32 noundef [[Y:%.*]])
15 // CHECK-NEXT: [[X_ADDR:%.*]] = alloca i32
16 // CHECK-NEXT: [[Y_ADDR:%.*]] = alloca i32
17 // CHECK-NEXT: store i32 [[X]], ptr [[X_ADDR]]
18 // CHECK-NEXT: store i32 [[Y]], ptr [[Y_ADDR]]
19 void g(int x
, int y
) {
20 // Not emitted because it has side-effects.
23 // CHECK-NEXT: call void @llvm.assume(i1 true)
26 // CHECK-NEXT: [[X1:%.*]] = load i32, ptr [[X_ADDR]]
27 // CHECK-NEXT: [[CMP1:%.*]] = icmp ne i32 [[X1]], 27
28 // CHECK-NEXT: call void @llvm.assume(i1 [[CMP1]])
31 // CHECK-NEXT: [[X2:%.*]] = load i32, ptr [[X_ADDR]]
32 // CHECK-NEXT: [[Y2:%.*]] = load i32, ptr [[Y_ADDR]]
33 // CHECK-NEXT: [[CMP2:%.*]] = icmp eq i32 [[X2]], [[Y2]]
34 // CHECK-NEXT: call void @llvm.assume(i1 [[CMP2]])
37 // CHECK-NEXT: call void @_Z2f2IiEvv()
40 // CHECK-NEXT: call void @_Z2f2IdEvv()
44 // CHECK: void @_Z2f2IiEvv()
46 // CHECK-NEXT: call void @llvm.assume(i1 true)
48 // CHECK: void @_Z2f2IdEvv()
50 // CHECK-NEXT: call void @llvm.assume(i1 false)