summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGen
diff options
context:
space:
mode:
authorSerge Pavlov <sepavloff@gmail.com>2018-05-21 16:09:54 +0000
committerSerge Pavlov <sepavloff@gmail.com>2018-05-21 16:09:54 +0000
commit9f8068420a7b18180a7c8da2224508e93f99587f (patch)
treef12032b5586f2b39029f20a2fdee57ca8c30c437 /clang/test/CodeGen
parent1a7aaf3cd50422797a45910e76aa197975a1e1ed (diff)
downloadbcm5719-llvm-9f8068420a7b18180a7c8da2224508e93f99587f.tar.gz
bcm5719-llvm-9f8068420a7b18180a7c8da2224508e93f99587f.zip
[CodeGen] Recognize more cases of zero initialization
If a variable has an initializer, codegen tries to build its value. If the variable is large in size, building its value requires substantial resources. It causes strange behavior from user viewpoint: compilation of huge zero initialized arrays like: char data_1[2147483648u] = { 0 }; consumes enormous amount of time and memory. With this change codegen tries to determine if variable initializer is equivalent to zero initializer. In this case variable value is not constructed. This change fixes PR18978. Differential Revision: https://reviews.llvm.org/D46241 llvm-svn: 332847
Diffstat (limited to 'clang/test/CodeGen')
-rw-r--r--clang/test/CodeGen/const-init.c2
-rw-r--r--clang/test/CodeGen/designated-initializers.c2
-rw-r--r--clang/test/CodeGen/union-init2.c2
3 files changed, 3 insertions, 3 deletions
diff --git a/clang/test/CodeGen/const-init.c b/clang/test/CodeGen/const-init.c
index 3fd231b630e..2d699954031 100644
--- a/clang/test/CodeGen/const-init.c
+++ b/clang/test/CodeGen/const-init.c
@@ -167,7 +167,7 @@ void g30() {
int : 1;
int x;
} a = {};
- // CHECK: @g30.a = internal global %struct.anon.1 <{ i8 undef, i32 0 }>, align 1
+ // CHECK: @g30.a = internal global %struct.anon.1 zeroinitializer, align 1
#pragma pack()
}
diff --git a/clang/test/CodeGen/designated-initializers.c b/clang/test/CodeGen/designated-initializers.c
index 74532c8fa5b..21077b4c147 100644
--- a/clang/test/CodeGen/designated-initializers.c
+++ b/clang/test/CodeGen/designated-initializers.c
@@ -8,7 +8,7 @@ struct foo {
// CHECK: @u = global %union.anon zeroinitializer
union { int i; float f; } u = { };
-// CHECK: @u2 = global { i32, [4 x i8] } { i32 0, [4 x i8] undef }
+// CHECK: @u2 = global %union.anon.0 zeroinitializer
union { int i; double f; } u2 = { };
// CHECK: @u3 = global %union.anon.1 zeroinitializer
diff --git a/clang/test/CodeGen/union-init2.c b/clang/test/CodeGen/union-init2.c
index bf20696a22c..0b68c211122 100644
--- a/clang/test/CodeGen/union-init2.c
+++ b/clang/test/CodeGen/union-init2.c
@@ -5,7 +5,7 @@
union x {long long b;union x* a;} r = {.a = &r};
-// CHECK: global { [3 x i8], [5 x i8] } { [3 x i8] zeroinitializer, [5 x i8] undef }
+// CHECK: global %union.z zeroinitializer
union z {
char a[3];
long long b;
OpenPOWER on IntegriCloud