Commit Graph

9 Commits

Author SHA1 Message Date
Richard Smith 1bc857476c Revert r332847; it caused us to miscompile certain forms of reference initialization.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@332886 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-21 20:36:58 +00:00
Serge Pavlov 6b450481a2 [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
2018-05-21 16:09:54 +00:00
Chris Lattner 9cbe4f0ba0 clang side to match the LLVM IR type system rewrite patch.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134831 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-09 17:41:47 +00:00
Nuno Lopes cdb30b4159 emit padding as undef values, take 2
merge also a few tests I had here for this feature, and FileCheck'ize one file

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101535 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-16 20:56:35 +00:00
Chris Lattner 0eea9f92b4 fix PR6660/6168: emit padding as zeros instead of undef. Because
trailing fields may not be represented in initializer lists, they
are being handled as padding and those fields *must* be zero 
initialized.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101067 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-12 21:10:05 +00:00
Daniel Dunbar a5728872c7 Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'.
- This is designed to make it obvious that %clang_cc1 is a "test variable"
   which is substituted. It is '%clang_cc1' instead of '%clang -cc1' because it
   can be useful to redefine what gets run as 'clang -cc1' (for example, to set
   a default target).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91446 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-15 20:14:24 +00:00
Nuno Lopes c6eb131a83 make clang emit undefs for padding of structs and unions instead of zeros. this enables constant compaction optimizations.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85504 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-29 11:27:06 +00:00
Eli Friedman cdcea87381 Make test a bit more precise.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79073 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-15 03:35:55 +00:00
Eli Friedman c0879bbbe0 Fix a minor issue with unions in the new struct building code.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77829 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-01 23:11:24 +00:00