aboutsummaryrefslogtreecommitdiff
path: root/lib/Target
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2011-01-09 11:29:57 +0000
committerChandler Carruth <chandlerc@gmail.com>2011-01-09 11:29:57 +0000
commit694d753b09c8f76f0ded5f2d650446bf021e9e8a (patch)
treef78eda0905128bbbce489014fe912024d780a992 /lib/Target
parentf78df5ebb8319eb28936937e7f53aac4afb2270b (diff)
Another missed memset in std::vector initialization.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123116 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target')
-rw-r--r--lib/Target/README.txt19
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/Target/README.txt b/lib/Target/README.txt
index 7d90795aa3..9ecd2ffc19 100644
--- a/lib/Target/README.txt
+++ b/lib/Target/README.txt
@@ -2230,3 +2230,22 @@ Then, the really painful one is the second memset, of the same memory, to the
same value.
//===---------------------------------------------------------------------===//
+
+clang -O3 -fno-exceptions currently compiles this code:
+
+struct S {
+ unsigned short m1, m2;
+ unsigned char m3, m4;
+};
+
+void f(int N) {
+ std::vector<S> v(N);
+ extern void sink(void*); sink(&v);
+}
+
+into poor code for zero-initializing 'v' when N is >0. The problem is that
+S is only 6 bytes, but each element is 8 byte-aligned. We generate a loop and
+4 stores on each iteration. If the struct were 8 bytes, this gets turned into
+a memset.
+
+//===---------------------------------------------------------------------===//