[llvm] [clang] [IR] Fix GEP offset computations for vector GEPs (PR #75448)

Nuno Lopes via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 10 06:35:52 PST 2024


nunoplopes wrote:

Alive2 is complaining about one of the tests:
```llvm
@Global = global 10 bytes, align 1

define void @test_overaligned_vec(i8 %B) {
  %A = gep ptr @Global, 4 x i64 0, 4 x i64 1
  store i8 %B, ptr %A, align 1
  ret void
}
=>
@Global = global 10 bytes, align 1

define void @test_overaligned_vec(i8 %B) {
  %__constexpr_0 = gep inbounds ptr @Global, 10 x i64 0, 1 x i64 2
  store i8 %B, ptr %__constexpr_0, align 1
  ret void
}
Transformation doesn't verify! (unsound)
ERROR: Mismatch in memory

Example:
i8 %B = #x11 (17)

Source:
ptr %A = pointer(non-local, block_id=0, offset=4)
```

GEP of 4 vs 2 bytes.

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


More information about the cfe-commits mailing list