<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 --- - alloca scalarization with dynamic indexing into vectors deletes stores"
   href="http://llvm.org/bugs/show_bug.cgi?id=15200">15200</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>alloca scalarization with dynamic indexing into vectors deletes stores
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>3.2
          </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>new bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>elnino2324@gmail.com
          </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>Created <span class=""><a href="attachment.cgi?id=9978" name="attach_9978" title="example case running -scalarrepl">attachment 9978</a> <a href="attachment.cgi?id=9978&action=edit" title="example case running -scalarrepl">[details]</a></span>
example case running -scalarrepl

I see that in the ScalarReplAggregates pass in the LLVM 3.2 release the call
SROA::isSafeGEP() will now allow alloca scalarization in the case where a GEP
index into a vector isn’t a constant.  I have an example .ll where we have an
alloca that can potentially be scalarized where the index into the vector is a
function argument and could be set to any value.

In the attached example, the sequence of stores is copying the data from %src
into %sPrivateStorage with the GEP of interest being:

  %add.ptr = getelementptr inbounds [3 x <2 x i32>]* %sPrivateStorage, i64 0,
i64 0, i64 %idx.ext

After running the line:

opt.exe -scalarrepl scalar_repl_store_delete.ll
-o=scalar_repl_store_delete_after.bc

we get the bottom result in the attachment.  The second two stores are deleted
because they appear to be dead even though that data can actually be reached by
the out of bounds vector index in the GEP.  I would expect the stores to be
untouched so that the data from %src gets copied over to %sPrivateStorage.</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>