diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2013-01-10 23:28:43 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2013-01-10 23:28:43 +0000 |
commit | c2316db5decd9cb7f8768ca67fad41fd8cffc110 (patch) | |
tree | 7aa0007eff5027b8d0854ad1c5eb2c4eb197dc07 /test/CodeGenCXX/cxx11-trivial-initializer-struct.cpp | |
parent | 8e2999cd4cfcf6447ca1f6e41d5707305e2d8dd0 (diff) |
c++ IRGen. In trivial cases that object is going into static
storage and thus is implicitly zero-initialized, no need to
do C++11 memory model. This patch unconditionally detects
such condition and zeroinitializer's the variable.
Patch has been commented on and OKed by Doug off-line.
// rdar://12897704
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172144 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGenCXX/cxx11-trivial-initializer-struct.cpp')
-rw-r--r-- | test/CodeGenCXX/cxx11-trivial-initializer-struct.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/CodeGenCXX/cxx11-trivial-initializer-struct.cpp b/test/CodeGenCXX/cxx11-trivial-initializer-struct.cpp new file mode 100644 index 0000000000..f38d01a467 --- /dev/null +++ b/test/CodeGenCXX/cxx11-trivial-initializer-struct.cpp @@ -0,0 +1,18 @@ +// RUN: %clang_cc1 -S -emit-llvm -o %t.ll %s -triple x86_64-apple-darwin10 +// RUN: %clang_cc1 -std=c++11 -S -emit-llvm -o %t-c++11.ll %s -triple x86_64-apple-darwin10 +// RUN: diff %t.ll %t-c++11.ll + +// rdar://12897704 + +struct sAFSearchPos { + unsigned char *pos; + unsigned char count; +}; + +static volatile struct sAFSearchPos testPositions; + +static volatile struct sAFSearchPos arrayPositions[100][10][5]; + +int main() { + return testPositions.count + arrayPositions[10][4][3].count; +} |