[PATCH] D96881: Avoid Bitcast-GEP fusion for void pointers

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 10 12:31:09 PST 2021


lebedev.ri added a comment.

In D96881#2615088 <https://reviews.llvm.org/D96881#2615088>, @hjooybar2 wrote:

> <...>

(unless i'm not aware of a RFC newer than https://lists.llvm.org/pipermail/llvm-dev/2019-December/137684.html)
I think my main point is being ignored:
This fix is temporary. After the pointer types are gone from IR,
the problem will reappear, because the GEP's will have pointer offsets,
they won't know anything about structs,
see http://lists.llvm.org/pipermail/llvm-dev/attachments/20191218/761e8893/attachment.obj:

  define i8* @gep(p0 %ptr) {
    %res = getelementptr { i8, i32 }, p0 %ptr, i32 5, i32 0
    ret i8* %res
  }

So it would be most future-proof to work towards making that transition as easy as possible,
by enhancing whatever passes aren't happy about this existing transformation.

All that being said, i understand that it is a *much* bigger endeavor than just adjusting InstCombine.



================
Comment at: llvm/test/Transforms/InstCombine/getelementptr.ll:1275
 }
 
 !0 = !{!"branch_weights", i32 2, i32 10}
----------------
For my own reference, the current result is: https://godbolt.org/z/TTE3nM


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D96881/new/

https://reviews.llvm.org/D96881



More information about the llvm-commits mailing list