[LLVMbugs] [Bug 1309] store only array is never removed

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Fri Apr 6 05:39:28 PDT 2007


http://llvm.org/bugs/show_bug.cgi?id=1309

baldrick at free.fr changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|WORKSFORME                  |



------- Additional Comments From baldrick at free.fr  2007-04-06 07:39 -------
> go instcombine!  is there anything it cannot do? ;-)

If you add a memset, it is no longer optimized.  This occurs
in every optimized Ada program, since the Ada @main, which does
some initialisation before calling the real "main", contains
code that reduces to something almost identical to this, in
which the array and a bunch of stores to it are not removed.
An additional silliness in the Ada case is that the array is a
zero-initialized global, and the first thing that is done to
it in @main is that it is memset to 0, so the memset could be
dropped.

#include <string.h>
int x(int y) {
int f[100];
memset(f,0,sizeof(f));
for (y = 0; y < 100; ++y)
  f[y] = 0;
return 1;
}



------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.



More information about the llvm-bugs mailing list