1 // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py
2 // RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -o - %s | FileCheck %s
5 // CHECK-LABEL: @test1(
7 // CHECK-NEXT: [[A_ADDR:%.*]] = alloca ptr, align 8
8 // CHECK-NEXT: [[B_ADDR:%.*]] = alloca ptr, align 8
9 // CHECK-NEXT: store ptr [[A:%.*]], ptr [[A_ADDR]], align 8
10 // CHECK-NEXT: store ptr [[B:%.*]], ptr [[B_ADDR]], align 8
11 // CHECK-NEXT: [[TMP0:%.*]] = load ptr, ptr [[A_ADDR]], align 8
12 // CHECK-NEXT: [[TMP1:%.*]] = load ptr, ptr [[B_ADDR]], align 8
13 // CHECK-NEXT: call void @llvm.assume(i1 true) [ "separate_storage"(ptr [[TMP0]], ptr [[TMP1]]) ]
14 // CHECK-NEXT: ret void
16 void test1(int *a
, int *b
) {
18 __builtin_assume_separate_storage(a
, b
);
21 // Separate storage assumptions evaluate their arguments unconditionally, like
22 // assume_aligned but *unlike* assume. Check that we actually do so.
23 // CHECK-LABEL: @test2(
25 // CHECK-NEXT: [[A_ADDR:%.*]] = alloca ptr, align 8
26 // CHECK-NEXT: [[B_ADDR:%.*]] = alloca ptr, align 8
27 // CHECK-NEXT: store ptr [[A:%.*]], ptr [[A_ADDR]], align 8
28 // CHECK-NEXT: store ptr [[B:%.*]], ptr [[B_ADDR]], align 8
29 // CHECK-NEXT: [[TMP0:%.*]] = load ptr, ptr [[A_ADDR]], align 8
30 // CHECK-NEXT: [[CALL:%.*]] = call ptr @nonconst()
31 // CHECK-NEXT: call void @llvm.assume(i1 true) [ "separate_storage"(ptr [[TMP0]], ptr [[CALL]]) ]
32 // CHECK-NEXT: ret void
34 void test2(int *a
, int *b
) {
35 __builtin_assume_separate_storage(a
, nonconst());