1 // RUN: %clang_cc1 -triple i686-pc-linux-gnu %s -o - -emit-llvm -verify | FileCheck %s
2 // expected-no-diagnostics
4 typedef __typeof(sizeof(int)) size_t;
7 struct A
{ void operator delete(void*,size_t); int x
; };
9 // CHECK-LABEL: define{{.*}} void @_ZN5test11aEPNS_1AE(
12 // CHECK-NEXT: icmp eq {{.*}}, null
14 // CHECK: call void @_ZN5test11AdlEPvj(ptr noundef %{{.*}}, i32 noundef 4)
19 // Check that we make cookies for the two-arg delete even when using
20 // the global allocator and deallocator.
24 void *operator new[](size_t);
25 void operator delete[](void *, size_t);
28 // CHECK: define{{.*}} ptr @_ZN5test24testEv()
30 // CHECK: [[NEW:%.*]] = call noalias noundef nonnull ptr @_Znaj(i32 noundef 44)
31 // CHECK-NEXT: store i32 10, ptr [[NEW]]
32 // CHECK-NEXT: [[T1:%.*]] = getelementptr inbounds i8, ptr [[NEW]], i32 4
33 // CHECK-NEXT: ret ptr [[T1]]
37 // CHECK-LABEL: define{{.*}} void @_ZN5test24testEPNS_1AE(
39 // CHECK: [[P:%.*]] = alloca ptr, align 4
40 // CHECK-NEXT: store ptr {{%.*}}, ptr [[P]], align 4
41 // CHECK-NEXT: [[T0:%.*]] = load ptr, ptr [[P]], align 4
42 // CHECK-NEXT: [[T1:%.*]] = icmp eq ptr [[T0]], null
43 // CHECK-NEXT: br i1 [[T1]],
44 // CHECK: [[T3:%.*]] = getelementptr inbounds i8, ptr [[T0]], i32 -4
45 // CHECK-NEXT: [[T5:%.*]] = load i32, ptr [[T3]]
46 // CHECK-NEXT: call void @_ZdaPv(ptr noundef [[T3]])
47 // CHECK-NEXT: br label
55 void operator delete[](void *, size_t);
59 // CHECK-LABEL: define{{.*}} void @_ZN5test34testEv()
61 // CHECK: [[CALL:%.*]] = call noalias noundef nonnull ptr @_Znaj(i32 noundef 24)
62 // CHECK-NEXT: store i32 5