summaryrefslogtreecommitdiffstats
path: root/test/CodeGenCXX/new-array-init.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2014-06-03 06:58:52 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2014-06-03 06:58:52 +0000
commit95563a5ba8b44747d272f66bad585cd4caf5fbb7 (patch)
tree31c8b8224b5de4ff8119b3658ef4a16597fe6ecc /test/CodeGenCXX/new-array-init.cpp
parenta52f6237e83863fd602bd74ac627d63425bdea08 (diff)
When emitting a multidimensional array new, emit the initializers for the
trailing elements as a single loop, rather than sometimes emitting a nest of several loops. This fixes a bug where CodeGen would sometimes try to emit an expression with the wrong type for the element being initialized. Plus various other minor cleanups to the IR produced for array new initialization. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@210079 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGenCXX/new-array-init.cpp')
-rw-r--r--test/CodeGenCXX/new-array-init.cpp19
1 files changed, 17 insertions, 2 deletions
diff --git a/test/CodeGenCXX/new-array-init.cpp b/test/CodeGenCXX/new-array-init.cpp
index 0e925c0a67..65123ea7fe 100644
--- a/test/CodeGenCXX/new-array-init.cpp
+++ b/test/CodeGenCXX/new-array-init.cpp
@@ -6,8 +6,8 @@ void fn(int n) {
// CHECK: store i32 1
// CHECK: store i32 2
// CHECK: store i32 3
- // CHECK: icmp eq i32*
- // CHECK-NEXT: br i1
+ // CHECK: sub {{.*}}, 12
+ // CHECK: call void @llvm.memset
new int[n] { 1, 2, 3 };
}
@@ -31,3 +31,18 @@ void const_sufficient() {
new int[4] { 1, 2, 3 };
// CHECK: ret void
}
+
+// CHECK-LABEL: define void @_Z22check_array_value_initv
+void check_array_value_init() {
+ struct S;
+ new (int S::*[3][4][5]) ();
+
+ // CHECK: call noalias i8* @_Zna{{.}}(i{{32 240|64 480}})
+ // CHECK: getelementptr inbounds i{{32|64}}* {{.*}}, i{{32|64}} 60
+
+ // CHECK: phi
+ // CHECK: store i{{32|64}} -1,
+ // CHECK: getelementptr inbounds i{{32|64}}* {{.*}}, i{{32|64}} 1
+ // CHECK: icmp eq
+ // CHECK: br i1
+}