<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] InstCombine drops value of a boolean argument"
   href="https://bugs.llvm.org/show_bug.cgi?id=41475">41475</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[DebugInfo@O2] InstCombine drops value of a boolean argument
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>8.0
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </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>Transformation Utilities
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>Wolfgang_Pieb@playstation.sony.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>bool foo(bool b) {
  return b;
}
//========= end of source =============


When compiled with -O2 -g, there is no location information for 'b'. The reason
appears to be the instcombine pass eliminating the zext that expands the
incoming parameter to an i8, while not being able to salvage the associated
debug info:

BEFORE:
  %frombool = zext i1 %b to i8
  call void @llvm.dbg.value(metadata i8 %frombool, metadata !12, ...

AFTER:
  <zext removed>
  call void @llvm.dbg.value(metadata i8 undef, metadata !12,

The core algorithm attempting the salvaging is in salvageDebugInfo() in
Transform/Utils/Local.cpp, which is why the component of this Bugzilla is
chosen this way.

<a class="bz_bug_link 
          bz_status_CONFIRMED "
   title="CONFIRMED - [DebugInfo@O2] InstCombine drops dbg.value of an argument"
   href="show_bug.cgi?id=40648">Bug 40648</a> also seems to address problems with salvaging debug info and
instcombine, though they seem more complex there.</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>