[PATCH] D138637: [InstCombine] Combine opaque pointer single index GEP and with src GEP which has result of array type

krishna chaitanya sankisa via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 30 21:03:44 PST 2022


skc7 added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstructionCombining.cpp:2084
+  // GEP having single index.
+  if (PtrTy->isOpaquePointerTy() && Src->getResultElementType()->isArrayTy() &&
+      GEP.getNumIndices() == 1) {
----------------
lebedev.ri wrote:
> Do we need an explicit `PtrTy->isOpaquePointerTy()` check?
> Do we need an one-use check on the inner (`Src`) gep?
> Do we want to perform the same LICM-appeasing checks about their loop disposition?
With new changes of making opaque pointer all-zero index gep as no-op lead to these GepOfGep not getting combined. So this change is specific to opaque pointers. 

Src gep can have multiple users which can be geps. This patch tries to optimize them aswell. See gepofgep4 test added below.

I'm not sure about LICM checks are required here. Please let me know if this change would cause any issue with that? I would work on fixing it.


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

https://reviews.llvm.org/D138637



More information about the llvm-commits mailing list