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: [email protected]
          Reporter: [email protected]
                CC: [email protected]

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.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to