[llvm-bugs] [Bug 45445] New: gep(ptr, undef) isn't undef

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Apr 6 06:33:17 PDT 2020


https://bugs.llvm.org/show_bug.cgi?id=45445

            Bug ID: 45445
           Summary: gep(ptr, undef) isn't undef
           Product: libraries
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Keywords: miscompilation
          Severity: normal
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: nunoplopes at sapo.pt
                CC: efriedma at quicinc.com, juneyoung.lee at sf.snu.ac.kr,
                    lebedev.ri at gmail.com, llvm-bugs at lists.llvm.org,
                    regehr at cs.utah.edu, spatel+llvm at rotateright.com

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 >


https://web.ist.utl.pt/nuno.lopes/alive2/index.php?hash=2009353267698970&test=Transforms%2FInstCombine%2Fvec_demanded_elts.ll

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200406/6cb37583/attachment.html>


More information about the llvm-bugs mailing list