First Last Prev Next    No search results available
Details
: memset/memcpy analysis/optimizations need improving
Bug#: 452
: libraries
: Interprocedural Optimizations
Status: RESOLVED
Resolution: FIXED
: All
: All
: trunk
: P2
: enhancement
: ---

:
: code-quality
: 1226 1952 2058 2059
:
  Show dependency tree - Show dependency graph
People
Reporter: Brian R. Gaeke <gaeke+bugs@uiuc.edu>
Assigned To: Unassigned LLVM Bugs <unassignedbugs@nondot.org>
:

Attachments
Edits a hard-coded string in an unrolled loop (752 bytes, text/x-c++src)
2007-04-05 16:57, Mathias Gaunard
Details
example with poor memcpy optimization (345 bytes, text/plain)
2008-01-28 23:55, Duncan Sands
Details


Note

You need to log in before you can comment on or make changes to this bug.

Related actions


Description:   Opened: 2004-10-20 12:46
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.
------- Comment #1 From Mathias Gaunard 2007-04-05 16:57:46 -------
Created an attachment (id=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".
------- Comment #2 From Chris Lattner 2007-04-08 19:57:19 -------
Bug 1309 is also related to this.
------- Comment #3 From Duncan Sands 2008-01-28 23:55:17 -------
Created an attachment (id=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.
------- Comment #4 From Chris Lattner 2008-01-28 23:58:15 -------
Bug 1952 is one specific optimization that we can do, relating it.
------- Comment #5 From Owen Anderson 2008-04-09 03:27:16 -------
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.
------- Comment #6 From Owen Anderson 2009-04-22 04:37:27 -------
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.

First Last Prev Next    No search results available