[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
Sun Dec 4 23:51:38 PST 2022


skc7 added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstructionCombining.cpp:2091-2097
+    return IsInBounds
+               ? GetElementPtrInst::CreateInBounds(Src->getSourceElementType(),
+                                                   Src->getOperand(0),
+                                                   NewIndices, GEP.getName())
+               : GetElementPtrInst::Create(Src->getSourceElementType(),
+                                           Src->getOperand(0), NewIndices,
+                                           GEP.getName());
----------------
jmmartinez wrote:
> What do you think about doing the following ?
> 
>   Instruction *GEP = GetElementPtrInst::Create(Src->getSourceElementType(), Src->getOperand(0), NewIndices, GEP.getName());
>   GEP->setIsInBounds(IsInBounds);
>   return GEP;
Updated. There were previous methods in instcombine pass using specifically GetElementPtrInst::CreateInBounds. I guess, creating GEP instruction and then setting InBounds is fine.


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

https://reviews.llvm.org/D138637



More information about the llvm-commits mailing list