diff options
author | Serge Pavlov <sepavloff@gmail.com> | 2018-05-21 16:09:54 +0000 |
---|---|---|
committer | Serge Pavlov <sepavloff@gmail.com> | 2018-05-21 16:09:54 +0000 |
commit | 6b450481a2d4d66aa0b146a1d7fc1084c555488e (patch) | |
tree | 5785f7637a56462ec413d35ad1e697dfdcbd873c /test/CodeGen/const-init.c | |
parent | dc6b868ff22d0bf6d426d177578a8afd9231bdea (diff) |
[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
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@332847 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/const-init.c')
-rw-r--r-- | test/CodeGen/const-init.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/test/CodeGen/const-init.c b/test/CodeGen/const-init.c index 3fd231b630..2d69995403 100644 --- a/test/CodeGen/const-init.c +++ b/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() } |