<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 - Duplicate select instruction causing one use check failure"
   href="https://bugs.llvm.org/show_bug.cgi?id=51092">51092</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Duplicate select instruction causing one use check failure
          </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>lebedev.ri@gmail.com, llvm-bugs@lists.llvm.org, nikita.ppv@gmail.com, spatel+llvm@rotateright.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre><a href="https://godbolt.org/z/4avqKsT4x">https://godbolt.org/z/4avqKsT4x</a>

struct PayLoad
{
        unsigned short data[3];
};

void sort(PayLoad* pData, int lo, int hi, int ishi)
{
  if (ishi)
  {
    pData->data[hi]++;
  }
  else
  {
    pData->data[lo]++;
  }
}

%struct.PayLoad = type { [3 x i16] }

define void @_Z4sortP7PayLoadiii(%struct.PayLoad* nocapture %0, i32 %1, i32 %2,
i32 %3) {
  %5 = icmp eq i32 %3, 0
  %6 = sext i32 %1 to i64
  %7 = getelementptr inbounds %struct.PayLoad, %struct.PayLoad* %0, i64 0, i32
0, i64 %6
  %8 = sext i32 %2 to i64
  %9 = getelementptr inbounds %struct.PayLoad, %struct.PayLoad* %0, i64 0, i32
0, i64 %8
  %10 = select i1 %5, i16* %7, i16* %9
  %11 = select i1 %5, i16* %7, i16* %9
  %12 = load i16, i16* %10, align 2, !tbaa !3
  %13 = add i16 %12, 1
  store i16 %13, i16* %11, align 2, !tbaa !3
  ret void
}

I'm currently investigating supporting select(gep,gep) folding for geps with >
2 operands, but we fail the one use check on this reduced test case as we end
up with the same select instruction twice which never get merged.

Should these be merged or not?</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>