A number of array-related IR-gen cleanups.
- Emit default-initialization of arrays that were partially initialized
with initializer lists with a loop, rather than emitting the default
initializer N times;
- support destroying VLAs of non-trivial type, although this is not
yet exposed to users; and
- support the partial destruction of arrays initialized with
initializer lists when an initializer throws an exception.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134784 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/CodeGenCXX/destructors.cpp b/test/CodeGenCXX/destructors.cpp
index 94d8833..c6f5bed 100644
--- a/test/CodeGenCXX/destructors.cpp
+++ b/test/CodeGenCXX/destructors.cpp
@@ -233,27 +233,16 @@
namespace test5 {
struct A { ~A(); };
- // This is really unnecessarily verbose; we should be using phis,
- // even at -O0.
-
// CHECK: define void @_ZN5test53fooEv()
// CHECK: [[ELEMS:%.*]] = alloca [5 x [[A:%.*]]], align
- // CHECK-NEXT: [[IVAR:%.*]] = alloca i64
- // CHECK: [[ELEMSARRAY:%.*]] = bitcast [5 x [[A]]]* [[ELEMS]] to [[A]]
- // CHECK-NEXT: store i64 5, i64* [[IVAR]]
+ // CHECK-NEXT: [[BEGIN:%.*]] = getelementptr inbounds [5 x [[A]]]* [[ELEMS]], i32 0, i32 0
+ // CHECK-NEXT: [[END:%.*]] = getelementptr inbounds [[A]]* [[BEGIN]], i64 5
// CHECK-NEXT: br label
- // CHECK: [[I:%.*]] = load i64* [[IVAR]]
- // CHECK-NEXT: icmp ne i64 [[I]], 0
- // CHECK-NEXT: br i1
- // CHECK: [[I:%.*]] = load i64* [[IVAR]]
- // CHECK-NEXT: [[I2:%.*]] = sub i64 [[I]], 1
- // CHECK-NEXT: getelementptr inbounds [[A]]* [[ELEMSARRAY]], i64 [[I2]]
- // CHECK-NEXT: call void @_ZN5test51AD1Ev(
- // CHECK-NEXT: br label
- // CHECK: [[I:%.*]] = load i64* [[IVAR]]
- // CHECK-NEXT: [[I1:%.*]] = sub i64 [[I]], 1
- // CHECK-NEXT: store i64 [[I1]], i64* [[IVAR]]
- // CHECK-NEXT: br label
+ // CHECK: [[POST:%.*]] = phi [[A]]* [ [[END]], {{%.*}} ], [ [[ELT:%.*]], {{%.*}} ]
+ // CHECK-NEXT: [[ELT]] = getelementptr inbounds [[A]]* [[POST]], i64 -1
+ // CHECK-NEXT: call void @_ZN5test51AD1Ev([[A]]* [[ELT]])
+ // CHECK-NEXT: [[T0:%.*]] = icmp eq [[A]]* [[ELT]], [[BEGIN]]
+ // CHECK-NEXT: br i1 [[T0]],
// CHECK: ret void
void foo() {
A elems[5];