<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 - swap select operands and reuse existing inverted condition"
   href="https://bugs.llvm.org/show_bug.cgi?id=41113">41113</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>swap select operands and reuse existing inverted condition
          </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>All
          </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>spatel+llvm@rotateright.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>I'm not sure if there's an existing pass that should have responsibility for
this transform:

define i1 @swapportunity(i8 %a, i8 %b, i8 %c, i8 %d, i8* %p) {
  %cmp1 = icmp ult i8 %a, %b
  %sel = select i1 %cmp1, i8 %c, i8 %d
  store i8 %sel, i8* %p
  %cmp2 = icmp uge i8 %a, %b ; this could also be a 'not' of cmp1
  ret i1 %cmp2
}

-->

define i1 @swapportunity(i8 %a, i8 %b, i8 %c, i8 %d, i8* %p) {
  %cmp2 = icmp uge i8 %a, %b
  %swap = select i1 %cmp2, i8 %d, i8 %c
  store i8 %swap, i8* %p
  ret i1 %cmp2
}

-------------------------------------------------------------------

It's not quite CSE or instcombine. There's precedence for a similar
analysis/transform in instcombine via "swapMayExposeCSEOpportunities()", but
that seems suspect to include there as this is not really a local/peephole
pattern-match.</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>