RFC: redundant stores in C++
Dale Johannesen
dalej@apple.com
Sun Oct 2 02:11:00 GMT 2005
In C++, when we have an automatic array with variable initializers:
void bar(char[4]);
void foo(char a, char b, char c, char d) {
char x[4] = { a, b, c, d };
bar(x);
}
the C++ FE generates 32-bit store(s) of 0 for the entire array,
followed by stores
of the individual elements. In the case above, where the elements are
not
32-bits, the optimizers do not figure out they can eliminate the
redundant store(s)
of 0. The C FE does not generate that to begin with, and the C++ FE
should
not either. This is not my native habitat, but I think this is the
right general idea:
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: diffs4.txt
URL: <https://gcc.gnu.org/pipermail/gcc/attachments/20051002/42d9775c/attachment.txt>
-------------- next part --------------
Testsuite passes with this but I can believe improvements are possible;
comments?
More information about the Gcc
mailing list