[PATCH] D124459: [InstCombine] Combine opaque pointer GEPs with mismatching element types

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 26 08:23:33 PDT 2022


nikic added inline comments.


================
Comment at: llvm/test/Transforms/InstCombine/opaque-ptr.ll:215
 ; CHECK-NEXT:    [[A2:%.*]] = getelementptr { i32, i32 }, ptr [[A:%.*]], i64 0, i32 1
 ; CHECK-NEXT:    [[A3:%.*]] = getelementptr i8, ptr [[A2]], i64 10
 ; CHECK-NEXT:    ret ptr [[A3]]
----------------
Worth noting that we still miss cases like these, where we would have to change the element type of the first GEP. I think we'll want to handle this by canonicalizing constant GEPs to i8 in InstCombine. I think this patch should ensure that doing so will not cause regressions when such i8 GEPs are combined with non-constant GEPs.

Type-based GEPs are such a mess :(


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

https://reviews.llvm.org/D124459



More information about the llvm-commits mailing list