[PATCH] D117038: [InstSimplify] Pass pointer and indices separately to SimplifyGEPInst.

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 11 10:52:33 PST 2022


lebedev.ri added inline comments.


================
Comment at: llvm/lib/Analysis/InstructionSimplify.cpp:4074
+      return PreventSelfSimplify(SimplifyGEPInst(
+          GEP->getSourceElementType(), NewOps[0], makeArrayRef(NewOps).slice(1),
+          GEP->isInBounds(), Q, MaxRecurse - 1));
----------------
?


================
Comment at: llvm/lib/Analysis/InstructionSimplify.cpp:4433-4437
-static Value *SimplifyGEPInst(Type *SrcTy, ArrayRef<Value *> Ops, bool InBounds,
+static Value *SimplifyGEPInst(Type *SrcTy, Value *Ptr,
+                              ArrayRef<Value *> Indices, bool InBounds,
                               const SimplifyQuery &Q, unsigned) {
   // The type of the GEP pointer operand.
   unsigned AS =
-      cast<PointerType>(Ops[0]->getType()->getScalarType())->getAddressSpace();
----------------
Have you tried
```
auto Ops = llvm::concat<Value*>(makeArrayRef(Ptr), Indices);
```
?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D117038



More information about the llvm-commits mailing list