summaryrefslogtreecommitdiffstats
path: root/clang/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
commit06a67e2c6faee4645f43e786e292b5eafcb9b70f (patch)
treec0c702dd64a90ed2169866ecec654c4d02958670 /clang/test/CodeGenCXX/new-array-init.cpp
parente00fec8fe470a800423688b448434f3b2340d038 (diff)
downloadbcm5719-llvm-06a67e2c6faee4645f43e786e292b5eafcb9b70f.tar.gz
bcm5719-llvm-06a67e2c6faee4645f43e786e292b5eafcb9b70f.zip
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. llvm-svn: 210079
Diffstat (limited to 'clang/test/CodeGenCXX/new-array-init.cpp')
-rw-r--r--clang/test/CodeGenCXX/new-array-init.cpp19
1 files changed, 17 insertions, 2 deletions
diff --git a/clang/test/CodeGenCXX/new-array-init.cpp b/clang/test/CodeGenCXX/new-array-init.cpp
index 0e925c0a67e..65123ea7fee 100644
--- a/clang/test/CodeGenCXX/new-array-init.cpp
+++ b/clang/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
+}
OpenPOWER on IntegriCloud