<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </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 - [DebugInfo@O2] DAGCombine drops easily salvageable variable location"
   href="https://bugs.llvm.org/show_bug.cgi?id=44881">44881</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[DebugInfo@O2] DAGCombine drops easily salvageable variable location
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

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

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

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

        <tr>
          <th>Keywords</th>
          <td>wrong-debug
          </td>
        </tr>

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

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

        <tr>
          <th>Component</th>
          <td>Common Code Generator Code
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>jeremy.morse.llvm@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>chackz0x12@gmail.com, greg.bedwell@sony.com, llvm-bugs@lists.llvm.org, orlando.hyams@sony.com, paul.robinson@am.sony.com, stephen.tozer@sony.com, vsk@apple.com
          </td>
        </tr>

        <tr>
          <th>Blocks</th>
          <td>38768
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Spun off from <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [DebugInfo] Arguments are lost after a call across TUs"
   href="show_bug.cgi?id=39724">bug 39724</a>, Davides test case which I copy below has 'l' optimised
out in the fn1 function. The cause appears to be a DAGCombine that drops the
multiply, which the SelectionDAG salvager can't recover. This is true of todays
master, 2733ad2c24 ish.

--------8<--------
a.c:

extern void other_func(long int, long int, long int);

__attribute__((noinline))
        int fn1 (long int x, long int y, long int z) {
                        int l = x * 2;
                                int q = y * z;
                                other_func(x, y, z);
                                        return l + q;
        }

__attribute__((noinline)) long int
fn2 (long int a, long int b, long int c)
{
          long int q = 2 * a;
            return fn1 (5, 6, 7);
}

int main(void) {
                return fn2(14, 23, 34);
}

b.c:

void other_func(long int a, long int b, long int c) {}


built with: ${CC} a.c b.c -O3 -g
-------->8--------

I guess this ticket can more broadly represents the fact that all the folding /
morphing in DAGCombine isn't robustly salvaged.</pre>
        </div>
      </p>

        <div id="referenced">
          <hr style="border: 1px dashed #969696">
          <b>Referenced Bugs:</b>
          <ul>
              <li>
                [<a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [meta][DebugInfo] Umbrella bug for poor debug experiences"
   href="https://bugs.llvm.org/show_bug.cgi?id=38768">Bug 38768</a>] [meta][DebugInfo] Umbrella bug for poor debug experiences
              </li>
          </ul>
        </div>
        <br>

      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>