summaryrefslogtreecommitdiffstats
path: root/test/CodeGenCXX/delete.cpp
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2011-07-13 01:41:37 +0000
committerJohn McCall <rjmccall@apple.com>2011-07-13 01:41:37 +0000
commit7cfd76cb5cec2aa7aaa4176339c806de6ec85a79 (patch)
tree6b1bed5477a9a7e745daa3ce3b6ff0e1b7e391ee /test/CodeGenCXX/delete.cpp
parenta8b20f70d562cdc2679f82d409832b79fc415277 (diff)
Switch delete[] IR-generation over to the destroy framework,
which implicitly makes it EH-safe as well. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135025 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGenCXX/delete.cpp')
-rw-r--r--test/CodeGenCXX/delete.cpp36
1 files changed, 14 insertions, 22 deletions
diff --git a/test/CodeGenCXX/delete.cpp b/test/CodeGenCXX/delete.cpp
index f3586d4674..ae5e29bf06 100644
--- a/test/CodeGenCXX/delete.cpp
+++ b/test/CodeGenCXX/delete.cpp
@@ -67,31 +67,23 @@ namespace test1 {
// CHECK: define void @_ZN5test14testEPA10_A20_NS_1AE(
void test(A (*arr)[10][20]) {
delete [] arr;
- // CHECK: icmp eq [10 x [20 x [[S:%.*]]]]* [[PTR:%.*]], null
+ // CHECK: icmp eq [10 x [20 x [[A:%.*]]]]* [[PTR:%.*]], null
// CHECK-NEXT: br i1
- // CHECK: [[ARR:%.*]] = getelementptr inbounds [10 x [20 x [[S]]]]* [[PTR]], i32 0, i32 0, i32 0
- // CHECK-NEXT: bitcast {{.*}} to i8*
- // CHECK-NEXT: [[ALLOC:%.*]] = getelementptr inbounds {{.*}}, i64 -8
- // CHECK-NEXT: bitcast i8* [[ALLOC]] to i64*
- // CHECK-NEXT: load
- // CHECK-NEXT: store i64 {{.*}}, i64* [[IDX:%.*]]
-
- // CHECK: load i64* [[IDX]]
- // CHECK-NEXT: icmp ne {{.*}}, 0
- // CHECK-NEXT: br i1
-
- // CHECK: load i64* [[IDX]]
- // CHECK-NEXT: [[I:%.*]] = sub i64 {{.*}}, 1
- // CHECK-NEXT: getelementptr inbounds [[S]]* [[ARR]], i64 [[I]]
- // CHECK-NEXT: call void @_ZN5test11AD1Ev(
+ // CHECK: [[BEGIN:%.*]] = getelementptr inbounds [10 x [20 x [[A]]]]* [[PTR]], i32 0, i32 0, i32 0
+ // CHECK-NEXT: [[T0:%.*]] = bitcast [[A]]* [[BEGIN]] to i8*
+ // CHECK-NEXT: [[ALLOC:%.*]] = getelementptr inbounds i8* [[T0]], i64 -8
+ // CHECK-NEXT: [[T1:%.*]] = bitcast i8* [[ALLOC]] to i64*
+ // CHECK-NEXT: [[COUNT:%.*]] = load i64* [[T1]]
+ // CHECK-NEXT: [[ISZERO:%.*]] = icmp eq i64 [[COUNT]], 0
+ // CHECK-NEXT: br i1 [[ISZERO]],
+ // CHECK: [[END:%.*]] = getelementptr inbounds [[A]]* [[BEGIN]], i64 [[COUNT]]
// CHECK-NEXT: br label
-
- // CHECK: load i64* [[IDX]]
- // CHECK-NEXT: sub
- // CHECK-NEXT: store {{.*}}, i64* [[IDX]]
- // CHECK-NEXT: br label
-
+ // CHECK: [[PAST:%.*]] = phi [[A]]* [ [[END]], {{%.*}} ], [ [[CUR:%.*]], {{%.*}} ]
+ // CHECK-NEXT: [[CUR:%.*]] = getelementptr inbounds [[A]]* [[PAST]], i64 -1
+ // CHECK-NEXT: call void @_ZN5test11AD1Ev([[A]]* [[CUR]])
+ // CHECK-NEXT: [[ISDONE:%.*]] = icmp eq [[A]]* [[CUR]], [[BEGIN]]
+ // CHECK-NEXT: br i1 [[ISDONE]]
// CHECK: call void @_ZdaPv(i8* [[ALLOC]])
}
}