<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 - shuffle undef mask on vectors with poison"
   href="https://bugs.llvm.org/show_bug.cgi?id=43958">43958</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>shuffle undef mask on vectors with poison
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>All
          </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>Scalar Optimizations
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>liuz@cs.utah.edu
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>A shuffle undef mask should select either of the elements. If one of them
happens to be poison, then the result can be poison. The langref [1] and a
transformation in instcombine seems forgot considering the poison case.

See below the transformation of insertelement to shufflevector. Assume the
function input %arg is poison, the target program shuffles the vector <poison,
undef, undef, undef> with mask <undef, 0, 0, 0>, the result should be <poison,
poison, poison, poison>, whereas the source program evaluates to <undef,
poison, poison, poison>. The target is more poisonous than the source.

llvm/test/Transforms/InstCombine/broadcast.ll

define <4 x float> @splat_undef1(float %arg) {
; CHECK-LABEL: @splat_undef1(
; CHECK-NEXT:    [[TMP1:%.*]] = insertelement <4 x float> undef, float
[[ARG:%.*]], i32 0
; CHECK-NEXT:    [[T6:%.*]] = shufflevector <4 x float> [[TMP1]], <4 x float>
undef, <4 x i32> <i32 undef, i32 0, i32 0, i32 0>
; CHECK-NEXT:    ret <4 x float> [[T6]]
;
  %t = insertelement <4 x float> undef, float %arg, i32 1
  %t4 = insertelement <4 x float> %t, float %arg, i32 1
  %t5 = insertelement <4 x float> %t4, float %arg, i32 2
  %t6 = insertelement <4 x float> %t5, float %arg, i32 3
  ret <4 x float> %t6
}

[1] <a href="https://llvm.org/docs/LangRef.html#id186">https://llvm.org/docs/LangRef.html#id186</a></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>