[PATCH] D155688: [PATCH] [llvm] [InstCombine] Canonicalise ADD+GEP

Nikita Popov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 4 06:34:01 PDT 2023


nikic accepted this revision.
nikic added a comment.
This revision is now accepted and ready to land.

LGTM

We should give this a try, but I think there is a fairly large chance that this will cause regressions somewhere and a more targeted change may be necessary (e.g. only do this for loop-invariants in LICM).



================
Comment at: llvm/lib/Transforms/InstCombine/InstructionCombining.cpp:2334-2335
+      Value *Ptr = GEP.getPointerOperand();
+      auto *NewPtr = GetElementPtrInst::Create(GEP.getResultElementType(), Ptr,
+                                               Idx1, "", &GEP);
+      return GetElementPtrInst::Create(GEP.getResultElementType(), NewPtr,
----------------
IRBuilder needs to be used for all but the last instruction.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D155688



More information about the cfe-commits mailing list