<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><span class="vcard"><a class="email" href="mailto:florian_hahn@apple.com" title="Florian Hahn <florian_hahn@apple.com>"> <span class="fn">Florian Hahn</span></a>
</span> changed
          <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED FIXED - [DeadStoreElimination w/ MemSSA] wrong code"
   href="https://bugs.llvm.org/show_bug.cgi?id=48036">bug 48036</a>
          <br>
             <table border="1" cellspacing="0" cellpadding="8">
          <tr>
            <th>What</th>
            <th>Removed</th>
            <th>Added</th>
          </tr>

         <tr>
           <td style="text-align:right;">Status</td>
           <td>NEW
           </td>
           <td>RESOLVED
           </td>
         </tr>

         <tr>
           <td style="text-align:right;">Fixed By Commit(s)</td>
           <td>
                
           </td>
           <td>aab71d44431e
           </td>
         </tr>

         <tr>
           <td style="text-align:right;">Resolution</td>
           <td>---
           </td>
           <td>FIXED
           </td>
         </tr></table>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED FIXED - [DeadStoreElimination w/ MemSSA] wrong code"
   href="https://bugs.llvm.org/show_bug.cgi?id=48036#c1">Comment # 1</a>
              on <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED FIXED - [DeadStoreElimination w/ MemSSA] wrong code"
   href="https://bugs.llvm.org/show_bug.cgi?id=48036">bug 48036</a>
              from <span class="vcard"><a class="email" href="mailto:florian_hahn@apple.com" title="Florian Hahn <florian_hahn@apple.com>"> <span class="fn">Florian Hahn</span></a>
</span></b>
        <pre>(In reply to Jonas Paulsson from <a href="show_bug.cgi?id=48036#c0">comment #0</a>)
<span class="quote">> 
> I can't see any other store to that address/element, and I have no idea why
> DSE removes it...</span >

Thanks for reducing the issue!

I had a look yesterday and the store was killed by the free call. DSE +
MemorySSA used to quite aggressive, it considered a free to kill the whole
underlying object.

In the example attached here, it looks like the free is used to release part of
an underlying object. What is even odder is that the underlying object appears
to be a alloca (I might be missing something though, as it goes through
multiple GEPs/casts/types).

I also checked the logic legacy DSE used, which only considers the region
starting at the freed pointer as freed when it is part of a larger object.

I updated MemorySSA DSE to use the same logic and I think this should have
fixed the obj copy issue on the bot. The first build with the patch is
<a href="http://lab.llvm.org:8011/#/builders/8/builds/25">http://lab.llvm.org:8011/#/builders/8/builds/25</a> and the only failed tests seem
fixed-point related.

The patch is <a href="https://reviews.llvm.org/rGaab71d44431e">https://reviews.llvm.org/rGaab71d44431e</a>

Please re-open the issue, if the problem still persists.</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>