<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 - SimplifyDemandedVectorElts' handling of undef"
   href="https://bugs.llvm.org/show_bug.cgi?id=40091">40091</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>SimplifyDemandedVectorElts' handling of undef
          </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>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Common Code Generator Code
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>david.green@arm.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org, llvm-dev@redking.me.uk
          </td>
        </tr></table>
      <p>
        <div>
        <pre>;target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"
;target triple = "aarch64-arm-none-eabi"

define i64 @test(i64 %aa) {
entry:
  %a = bitcast i64 %aa to  <1 x i64>
  %k = icmp sgt <1 x i64> %a, zeroinitializer
  %l = zext <1 x i1> %k to <1 x i64>
  %o = and <1 x i64> %l, %a
  %p = xor <1 x i64> %l, <i64 -1>
  %q = and <1 x i64> %p, <i64 81985529216486895>
  %r = or <1 x i64> %q, %o
  %s = bitcast <1 x i64> %r to <8 x i8>
  %t = shufflevector <8 x i8> %s, <8 x i8> %s, <8 x i32> <i32 3, i32 3, i32 3,
i32 3, i32 3, i32 3, i32 3, i32 3>
  %u = bitcast <8 x i8> %t to i64
  ret i64 %u
}

I would expect this to always return 0x8989898989898989 (the third element of
that big constant in there), but currently returns 0xffffffffffffffff. It seems
that the icmp is folded to undef (perhaps because it is not needed by demand
bits), which then gets folded through into pretty much everything else (even
through the zext). I am under the impression that undef should be bitwise (not
vector-lane-wise), but I may be wrong there.

Bisects back to r349264, which adds OR handling to SimplifyDemandedVectorElts
(but it looks like a bit of a knock-on effect).</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>