<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 - gep(ptr, undef) isn't undef"
   href="https://bugs.llvm.org/show_bug.cgi?id=45445">45445</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>gep(ptr, undef) isn't undef
          </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>Keywords</th>
          <td>miscompilation
          </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>nunoplopes@sapo.pt
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>efriedma@quicinc.com, juneyoung.lee@sf.snu.ac.kr, lebedev.ri@gmail.com, llvm-bugs@lists.llvm.org, regehr@cs.utah.edu, spatel+llvm@rotateright.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Test: Transforms/InstCombine/vec_demanded_elts.ll
Summary: gep(ptr, undef) isn't undef. It's a pointer based on ptr with an undef
offset (a multiple of 4 in this case). A way to make this correct is to return
<%base, %base>.


define <2 x *> @gep_all_lanes_undef(* %base, i64 %idx) {
  %basevec = insertelement <2 x *> undef, * %base, i32 0
  %idxvec = insertelement <2 x i64> undef, i64 %idx, i32 1
  %gep = gep <2 x *> %basevec, 4 x <2 x i64> %idxvec
  ret <2 x *> %gep
}
=>
define <2 x *> @gep_all_lanes_undef(* %base, i64 %idx) {
  ret <2 x *> undef
}

Transformation doesn't verify!
ERROR: Value mismatch

Example:
* %base = pointer(non-local, block_id=1, offset=0)
i64 %idx = #x0000000000080000 (524288)

Source:
<2 x *> %basevec = < pointer(non-local, block_id=1, offset=0), null >
<2 x i64> %idxvec = < undef, #x0000000000080000 (524288) >
<2 x *> %gep = < pointer(non-local, block_id=1, offset=0), pointer(non-local,
block_id=0, offset=2097152) >

Target:
Source value: < pointer(non-local, block_id=1, offset=0), pointer(non-local,
block_id=0, offset=2097152) >
Target value: < pointer(non-local, block_id=0, offset=16), null >


<a href="https://web.ist.utl.pt/nuno.lopes/alive2/index.php?hash=2009353267698970&test=Transforms%2FInstCombine%2Fvec_demanded_elts.ll">https://web.ist.utl.pt/nuno.lopes/alive2/index.php?hash=2009353267698970&test=Transforms%2FInstCombine%2Fvec_demanded_elts.ll</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>