[llvm-bugs] [Bug 44425] New: Merging GEP inbounds of GEP incorrectly preserves inbounds

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Jan 1 10:05:17 PST 2020


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

            Bug ID: 44425
           Summary: Merging GEP inbounds of GEP incorrectly preserves
                    inbounds
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: nikita.ppv at gmail.com
                CC: llvm-bugs at lists.llvm.org

define i32* @test_gep2(i32* %base) {
  %ptr1 = getelementptr i32, i32* %base, i64 4
  %ptr2 = getelementptr inbounds i32, i32* %ptr1, i64 4
  ret i32* %ptr2
}

opt -instcombine

define i32* @test_gep2(i32* %base) {
  %ptr2 = getelementptr inbounds i32, i32* %base, i64 8
  ret i32* %ptr2
}

I believe this this transform isn't correct, e.g. if the original %base was
pointing 4 elements before the start of an object.

This only happens in the case where the GEP is updated in-place.

Noticed this while looking into https://bugs.llvm.org/show_bug.cgi?id=44423...

-- 
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/20200101/3b935eef/attachment-0001.html>


More information about the llvm-bugs mailing list