mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-09 10:31:14 +00:00
Another missed memset in std::vector initialization.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123116 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
f78df5ebb8
commit
694d753b09
@ -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.
|
||||
|
||||
//===---------------------------------------------------------------------===//
|
||||
|
Loading…
x
Reference in New Issue
Block a user