From 06a67e2c6faee4645f43e786e292b5eafcb9b70f Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Tue, 3 Jun 2014 06:58:52 +0000 Subject: 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 --- clang/test/CodeGenCXX/new-array-init.cpp | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'clang/test/CodeGenCXX/new-array-init.cpp') 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 +} -- cgit v1.2.3