<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 - [Meta] Missed combines using freeze"
   href="https://bugs.llvm.org/show_bug.cgi?id=49930">49930</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[Meta] Missed combines using freeze
          </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>Windows NT
          </td>
        </tr>

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

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>Scalar Optimizations
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>llvm-dev@redking.me.uk
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>david.bolvansky@gmail.com, lebedev.ri@gmail.com, llvm-bugs@lists.llvm.org, nunoplopes@sapo.pt, spatel+llvm@rotateright.com
          </td>
        </tr>

        <tr>
          <th>Depends on</th>
          <td>44136
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Now that we have the freeze instruction (and we really want to get rid of
undef), we should be more willing to perform folds that introduce freeze.

Part of this is a general apprehension about using freeze, and also we need to
decide how freeze counts in the 'is this simpler or not' metric that we use for
InstCombine combine rules.

For example, <a href="https://reviews.llvm.org/D100211">https://reviews.llvm.org/D100211</a> [<a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED FIXED - Missed optimization: bitwise OR"
   href="show_bug.cgi?id=44136">Bug #44136</a>], proposed the fold:

define i1 @src(i8 %a, i8 %b) {
  %n = xor i8 %a, -1
  %o = and i8 %n, %b
  %c = icmp eq i8 %o, 0
  ret i1 %c
}

define i1 @tgt(i8 %a, i8 %b) {
  %aa = freeze i8 %a
  %o = or i8 %aa, %b
  %c = icmp eq i8 %o, %aa
  ret i1 %c
}

The freeze is necessary for the fold to be valid, but means we don't reduce the
instruction count (but does freeze count as an instruction in the same way?).
And some were worried about freeze preventing later folds from occurring.</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_RESOLVED  bz_closed"
   title="RESOLVED FIXED - Missed optimization: bitwise OR"
   href="https://bugs.llvm.org/show_bug.cgi?id=44136">Bug 44136</a>] Missed optimization: bitwise OR
              </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>