[PATCH] D119127: Preserve inbounds information of GEP during Argument Promotion Pass across callee and its callers.

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 7 06:24:25 PST 2022


nikic added a reviewer: nikic.
nikic added a comment.

It looks like you need to update a number of existing tests.

You should also test the case where the GEP inbounds is conditional -- I think it might still be okay based on a dereferenceabiliy argument, but it's not entirely obvious to me.



================
Comment at: llvm/lib/Transforms/IPO/ArgumentPromotion.cpp:283
           Idxs[1] = ConstantInt::get(Type::getInt32Ty(F->getContext()), i);
-          auto *Idx =
-              IRB.CreateGEP(STy, *AI, Idxs, (*AI)->getName() + "." + Twine(i));
+          // It is safe to create inbounds GEP since source type is struct
+          auto *Idx = IRB.CreateInBoundsGEP(STy, *AI, Idxs,
----------------
I think using inbounds here is okay, but the justification is not correct. You probably want to argue about byval-implied dereferenceability here.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119127



More information about the llvm-commits mailing list