[PATCH] D106450: [InstCombine] Fold (gep (oneuse(gep Ptr, Idx0)), Idx1) -> (gep Ptr, (add Idx0, Idx1)) (PR51069)

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 21 08:33:09 PDT 2021


lebedev.ri added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstructionCombining.cpp:2134
+      if (GO1->getType() == SO1->getType()) {
+        auto *NewIdx = Builder.CreateAdd(GO1, SO1, GEP.getName() + ".idx");
+        auto *NewGEP = GetElementPtrInst::Create(
----------------
I believe this `add` is `nsw` iff `NewGEP` is `inbounds`.
alive2 timeouts/memouts even with 10min/64gb limits,
but that means it fails to disprove it, which is a good sign.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D106450



More information about the llvm-commits mailing list