[llvm] [MemoryBuiltins] Consider index type size when aggregating gep offsets (PR #132365)

via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 8 06:33:00 PDT 2025


================
@@ -200,8 +200,12 @@ if.end:
   ret i64 %size
 }
 
-define i64 @pick_negative_offset_different_width(i32 %n) {
-; CHECK-LABEL: @pick_negative_offset_different_width(
+; FIXME: The result here looks weird. Either we reference into buffer0 with an
+;        oob offset. Or we reference buffer1 (8 bytes) with a 4 byte
+;        offset. The result 5 is wrong in both cases. Probably better to
+;        return -1 here since we do not know if we have an oob pointer.
+define i64 @pick_negative_offset_different_width_index_maybe_too_small(i32 %n, i1 %c) {
----------------
serge-sans-paille wrote:

I agree

https://github.com/llvm/llvm-project/pull/132365


More information about the llvm-commits mailing list