[llvm-bugs] [Bug 28562] New: GVN ignores inbounds of getelementptr

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Jul 14 21:14:27 PDT 2016


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

            Bug ID: 28562
           Summary: GVN ignores inbounds of getelementptr
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: kyoonss at gmail.com
                CC: david.majnemer at gmail.com, dberlin at dberlin.org,
                    listmail at philipreames.com, llvm-bugs at lists.llvm.org,
                    nunoplopes at sapo.pt, sanjoy at playingwithpointers.com
    Classification: Unclassified

GVN ignores the inbounds keyword of getelementptr instructions.

As a consequence, it may replace a GEP instruction without inbounds with
another GEP with inbounds.

Running 'opt -gvn' for the source code below produces the following result:


source:

define i32* @foo(i32* %a) {
  %x1 = getelementptr inbounds i32, i32* %a, i32 10
  %x2 = getelementptr i32, i32* %a, i32 10
  ret i32* %x2
}

result:

define i32* @foo(i32* %a) {
  %x1 = getelementptr inbounds i32, i32* %a, i32 10
  ret i32* %x1
}


I think foo's behavior is changed, since the GEP with inbounds can be a poison
value.

-- 
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/20160715/6e6d7379/attachment.html>


More information about the llvm-bugs mailing list