<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 - InstCombine incorrectly folds select of vector"
   href="https://bugs.llvm.org/show_bug.cgi?id=49832">49832</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>InstCombine incorrectly folds select of vector
          </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>juneyoung.lee@sf.snu.ac.kr
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>```
$ cat src.ll
define void @src(<2 x i32> %input) {
    %cond = icmp eq <2 x i32> %input, zeroinitializer
    %.14 = extractelement <2 x i32> %input, i32 1
    %.15 = insertelement <2 x i32> poison, i32 %.14, i32 0
    %.16 = extractelement <2 x i32> %input, i32 0
    %.17 = insertelement <2 x i32> %.15, i32 %.16, i32 1
    %.18 = select <2 x i1> %cond, <2 x i32> %.17, <2 x i32> %input
    %x = extractelement <2 x i32> %.18, i32 0
    %y = extractelement <2 x i32> %.18, i32 1
    call void @f(i32 %x, i32 %y)
    ret void
}

declare void @f(i32, i32)
$ opt -instcombine -S -o - src.ll
define void @src(<2 x i32> %input) {
  %x = extractelement <2 x i32> %input, i32 0
  %y = extractelement <2 x i32> %input, i32 1
  call void @f(i32 %x, i32 %y)
  ret void
}

declare void @f(i32, i32)
```

This is incorrect: <a href="https://alive2.llvm.org/ce/z/8X-4kR">https://alive2.llvm.org/ce/z/8X-4kR</a>
If input is <0, 2>, (%x, %y) is (2, 2) in src, but it becomes (0, 2) in tgt.</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>