[llvm-commits] [llvm] r123116 - /llvm/trunk/lib/Target/README.txt

Chandler Carruth chandlerc at gmail.com
Sun Jan 9 03:29:57 PST 2011


Author: chandlerc
Date: Sun Jan  9 05:29:57 2011
New Revision: 123116

URL: http://llvm.org/viewvc/llvm-project?rev=123116&view=rev
Log:
Another missed memset in std::vector initialization.

Modified:
    llvm/trunk/lib/Target/README.txt

Modified: llvm/trunk/lib/Target/README.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/README.txt?rev=123116&r1=123115&r2=123116&view=diff
==============================================================================
--- llvm/trunk/lib/Target/README.txt (original)
+++ llvm/trunk/lib/Target/README.txt Sun Jan  9 05:29:57 2011
@@ -2230,3 +2230,22 @@
 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.
+
+//===---------------------------------------------------------------------===//





More information about the llvm-commits mailing list