[PATCH] D117038: [InstSimplify] Pass pointer and indices separately to SimplifyGEPInst.
Florian Hahn via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 11 12:23:29 PST 2022
fhahn added inline comments.
================
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();
----------------
lebedev.ri wrote:
> Have you tried
> ```
> auto Ops = llvm::concat<Value*>(makeArrayRef(Ptr), Indices);
> ```
> ?
I gave that a try try the issue is that the iterator type of `ArrayRef<Value *>` is `Value * const *`. `concat<Value*>` has a helper that returns `ValueTy *` with `ValueTy = Value *`, which unfortunately breaks. Adjusting `SimplifyGEPInst` was easier in that case (not a great justification, I know), but the distinction between ptr & indices makes at least some sense I think.
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