1 // RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++11 -emit-llvm %s -o - | FileCheck %s
34 // CHECK-LABEL: define{{.*}} void @_Z5test01X(
35 // CHECK-SAME: ptr noundef [[ARG:%.*]])
36 // CHECK: [[ARG_ADDR:%.*]] = alloca ptr
37 // CHECK-NEXT: [[TMP:%.*]] = alloca [[A:%.*]], align
38 // CHECK-NEXT: store ptr [[ARG]], ptr [[ARG_ADDR]]
39 // CHECK-NEXT: [[T0:%.*]] = call noundef nonnull align {{[0-9]+}} dereferenceable({{[0-9]+}}) ptr @_ZN1XcvR1BEv(
40 // CHECK-NEXT: call void @_ZN1AC1ERKS_(ptr {{[^,]*}} [[TMP]], ptr noundef nonnull align {{[0-9]+}} dereferenceable({{[0-9]+}}) [[T0]])
41 // CHECK-NEXT: call void @_Z12test0_helper1A(ptr noundef [[TMP]])
42 // CHECK-NEXT: call void @_ZN1AD1Ev(ptr {{[^,]*}} [[TMP]])
43 // CHECK-NEXT: ret void
60 struct Derived
: Base
{
63 void test1_helper(Base
);
64 void test1(Derived bb
) {
65 // CHECK-LABEL: define{{.*}} void @_Z5test17Derived(
66 // CHECK-NOT: call {{.*}} @_ZN4BasecvR7DerivedEv(
67 // CHECK: call void @_ZN4BaseC1ERKS_(
68 // CHECK-NOT: call {{.*}} @_ZN4BasecvR7DerivedEv(
69 // CHECK: call void @_Z12test1_helper4Base(
73 // Don't crash after devirtualizing a derived-to-base conversion
74 // to an empty base allocated at offset zero.
75 // rdar://problem/11993704
77 class Test2b final
: public virtual Test2a
{};
78 void test2(Test2b
&x
) {
80 // CHECK-LABEL: define{{.*}} void @_Z5test2R6Test2b(
81 // CHECK: [[X:%.*]] = alloca ptr, align 8
82 // CHECK-NEXT: [[Y:%.*]] = alloca ptr, align 8
83 // CHECK-NEXT: store ptr {{%.*}}, ptr [[X]], align 8
84 // CHECK-NEXT: [[T0:%.*]] = load ptr, ptr [[X]], align 8
85 // CHECK-NEXT: store ptr [[T0]], ptr [[Y]], align 8
86 // CHECK-NEXT: ret void