<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - DeadStoreElimination ("-dse") eliminates a store that isn't dead"
   href="http://llvm.org/bugs/show_bug.cgi?id=15822">15822</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>DeadStoreElimination ("-dse") eliminates a store that isn't dead
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>tools
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>opt
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>mseaborn@chromium.org
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>DeadStoreElimination ("-dse") eliminates a store that isn't dead.

In the following test case, which is a reduced version of
SingleSource/UnitTests/byval-alignment.c from the LLVM test suite, @do_copy()
should set @g0 to 1234:


@g0 = global i32 zeroinitializer, align 4
@init_val = global i32 1234, align 4

declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture, i8* nocapture, i32, i32,
i1)

define void @f0(i8* %y) noinline {
  tail call void @llvm.memcpy.p0i8.p0i8.i32(i8* bitcast (i32* @g0 to i8*), i8*
%y, i32 4, i32 1, i1 false)
  ret void
}

define void @do_copy() {
  %copy = alloca i32, align 4
  %copy_cast = bitcast i32* %copy to i8*
  %init_val_cast = bitcast i32* @init_val to i8*
  call void @llvm.memcpy.p0i8.p0i8.i32(i8* %copy_cast, i8* %init_val_cast, i32
4, i32 1, i1 false)
  tail call void @f0(i8* %copy_cast)
  ret void
}


However, "-dse" removes the memcpy() from @do_copy so that it will copy
uninitialised data to @g0:

$ opt -basicaa -dse byval-min.ll -S -o -
...
define void @do_copy() {
  %copy = alloca i32, align 4
  %copy_cast = bitcast i32* %copy to i8*
  tail call void @f0(i8* %copy_cast)
  ret void
}

This also occurs with "opt -std-link-opts".

This occurs in at least LLVM 3.0, 3.1 and r176253.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>