<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><span class="vcard"><a class="email" href="mailto:david.stenberg@ericsson.com" title="David Stenberg <david.stenberg@ericsson.com>"> <span class="fn">David Stenberg</span></a>
</span> changed
          <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED FIXED - First DBG_VALUE for parameter is moved down after the end of the prologue (before DebugHandlerBase)"
   href="https://bugs.llvm.org/show_bug.cgi?id=40638">bug 40638</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;">Resolution</td>
           <td>---
           </td>
           <td>FIXED
           </td>
         </tr>

         <tr>
           <td style="text-align:right;">Status</td>
           <td>NEW
           </td>
           <td>RESOLVED
           </td>
         </tr></table>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED FIXED - First DBG_VALUE for parameter is moved down after the end of the prologue (before DebugHandlerBase)"
   href="https://bugs.llvm.org/show_bug.cgi?id=40638#c8">Comment # 8</a>
              on <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED FIXED - First DBG_VALUE for parameter is moved down after the end of the prologue (before DebugHandlerBase)"
   href="https://bugs.llvm.org/show_bug.cgi?id=40638">bug 40638</a>
              from <span class="vcard"><a class="email" href="mailto:david.stenberg@ericsson.com" title="David Stenberg <david.stenberg@ericsson.com>"> <span class="fn">David Stenberg</span></a>
</span></b>
        <pre>I never reached the finish line with this. Sorry about that.

In <a href="https://reviews.llvm.org/D62650">https://reviews.llvm.org/D62650</a> (r362750), Alexey Lapshin disabled the
lexical-scope trimming which caused the debug value to be moved down. The
trimming was disabled for all types of variables.

If I now compile the attached test case using:

$ clang --target=i386-unknown-linux-gnu -g -O1 pr40638.c -S -mllvm
-stop-after=virtregrewriter -o -

the debug value is kept at the start of the function:

body:             |
  bb.0.entry:
    DBG_VALUE %fixed-stack.0, 0, !19, !DIExpression(), debug-location !20
    renamable $eax = MOV32rm %fixed-stack.0, 1, $noreg, 0, $noreg :: (load 4
from %fixed-stack.0, align 16)
    renamable $ecx = MOV32rm $noreg, 1, $noreg, @g2, $noreg, debug-location !21
:: (dereferenceable load 4 from @g2, !tbaa !22)
    MOV32mr $noreg, 1, $noreg, @g1, $noreg, killed renamable $ecx,
debug-location !26 :: (store 4 into @g1, !tbaa !22)
    MOV32mi killed renamable $eax, 1, $noreg, 0, $noreg, 0, debug-location !27
:: (store 4 into %ir.p1, !tbaa !22)
    RET 0, debug-location !28

I don't think there is anything more to do here, so I'll close this ticket now.</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>