llvm-project
25 строк · 904.0 Байт
1// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -O3 -disable-llvm-passes -o - %s | FileCheck %s
2
3// Test that can call `__builtin_constant_p` with instances of different
4// Objective-C classes.
5@class Foo;
6@class Bar;
7
8extern void callee(void);
9
10// CHECK-LABEL: define{{.*}} void @test(ptr noundef %foo, ptr noundef %bar)
11void test(Foo *foo, Bar *bar) {
12// CHECK: call i1 @llvm.is.constant.p0(ptr %{{.*}})
13// CHECK: call i1 @llvm.is.constant.p0(ptr %{{.*}})
14if (__builtin_constant_p(foo) && __builtin_constant_p(bar))
15callee();
16}
17
18// Test other Objective-C types.
19// CHECK-LABEL: define{{.*}} void @test_more(ptr noundef %object, ptr noundef %klass)
20void test_more(id object, Class klass) {
21// CHECK: call i1 @llvm.is.constant.p0(ptr %{{.*}})
22// CHECK: call i1 @llvm.is.constant.p0(ptr %{{.*}})
23if (__builtin_constant_p(object) && __builtin_constant_p(klass))
24callee();
25}
26