[PATCH] D26014: [ConstantFold] Get the correct vector type when folding a getelementptr instruction with vector indices
Davide Italiano via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 26 15:56:28 PDT 2016
davide added inline comments.
================
Comment at: lib/IR/ConstantFold.cpp:2063-2070
if (VectorType *VT = dyn_cast<VectorType>(C->getType()))
GEPTy = VectorType::get(GEPTy, VT->getNumElements());
+ // When the getelementptr has one of more vector indices, it will
+ // return a vector of pointers. We guarantee that all the vectors
+ // in this case will have the same width, so we can just look at
+ // the first one.
+ else if (VectorType *VT = dyn_cast<VectorType>(Idxs[0]->getType()))
----------------
majnemer wrote:
> Could this be replaced with `GetElementPtrInst::getGEPReturnType` ?
hmm, I don't see an overload of `getGEPReturnType` which takes an `ArrayRef` of `Constant` but only `Value` -- do you want me to add one?
https://reviews.llvm.org/D26014
More information about the llvm-commits
mailing list