<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 - [InstructionCombiner (?)] WRONG CODE involving @llvm.vector.reduce.xor"
   href="https://bugs.llvm.org/show_bug.cgi?id=50145">50145</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[InstructionCombiner (?)]  WRONG CODE involving @llvm.vector.reduce.xor
          </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>Linux
          </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>paulsson@linux.vnet.ibm.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=24806" name="attach_24806" title="reduced testcase">attachment 24806</a> <a href="attachment.cgi?id=24806&action=edit" title="reduced testcase">[details]</a></span>
reduced testcase

The attached program should print '0' but currently it prints '119' on
SystemZ...

A bisect leads to 79b1b4a "[Vectorizers][TTI] remove option to bypass creation
of vector reduction intrinsics". The only difference in the IR after SLP is
then:

 %rdx.shuf = shufflevector <4 x i8> %32, <4 x i8> poison, <4 x i32> <i32 2, i32
3, i32 undef, i32 undef>
 %bin.rdx = xor <4 x i8> %32, %rdx.shuf                                         
 %rdx.shuf11 = shufflevector <4 x i8> %bin.rdx, <4 x i8> poison, <4 x i32> <i32
1, i32 undef, i32 undef, i32 undef>       
 %bin.rdx12 = xor <4 x i8> %bin.rdx, %rdx.shuf11                                
 %47 = extractelement <4 x i8> %bin.rdx12, i32 0                               
 <>
     %47 = call i8 @llvm.vector.reduce.xor.v4i8(<4 x i8> %32)

This then later gets different treatment of InstCombiner. With the shuffles,
the store to @d dissapears, but with the intrinsic it seems some poison value
ends up being stored...

clang -march=z13 -O3 wrong0.i -o a.out -w ; ./a.out</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>