Just so this doesn't get lost, I'm filing a "wishlist" item for this. Date: Wed, 6 Oct 2004 14:25:30 -0500 (CDT) From: Chris Lattner <sabre@nondot.org> Subject: memset optimizations memset currently inhibits multiple optimizations, e.g. memset/load doesn't get copy-propagated, memset doesn't cause dead stores to die, and memset inhibits SRA. This should be fixed! Also: memset(&X, 4) -> store int 0, X iff X is aligned Also, memset should not kill unaliased loads/stores.
Created attachment 759 [details] Edits a hard-coded string in an unrolled loop I was told in the IRC channel that the non optimized LLVM code I was getting of the attached C++ code was related to this issue. It becomes optimized when the string 's' becomes small, like "this".
Bug 1309 is also related to this.
Created attachment 1358 [details] example with poor memcpy optimization In the last line return r + x.A; the value of x.A is zero, but LLVM doesn't understand this. Presumably this is because it thinks memcpy has modified x, even though it copies from x and not to it.
Bug 1952 is one specific optimization that we can do, relating it.
This has gotten a lot better recently, with work Chris and I have done which is now in the MemCpyOpt pass. There's still a lot to do, though.
I'm closing this open-ended bug, as we'll never catch EVERY case. If you still have specific cases that you'd like to see addressed, please file individual PRs for them.