[PATCH] D26014: [ConstantFold] Get the correct vector type when folding a getelementptr instruction with vector indices
Filipe Cabecinhas via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 27 08:25:29 PDT 2016
Yes, different patch is probably better if it's not the same problem.
Thank you,
Filipe
F
On Thu, Oct 27, 2016 at 1:50 AM, Davide Italiano via llvm-commits
<llvm-commits at lists.llvm.org> wrote:
> On Wed, Oct 26, 2016 at 3:56 PM, Davide Italiano via llvm-commits
> <llvm-commits at lists.llvm.org> wrote:
>> 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
>>
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
> Michael found another case where vector GEP break.
>
>
> +%struct.foo = type { [0 x i64] }
> +
> +define <8 x i64*> @patatino3(%struct.foo*) {
> + %2 = getelementptr inbounds %struct.foo, %struct.foo* undef, i64 0,
> i32 0, <8 x i64> undef
> + ret <8 x i64*> %2
> +}
>
> It fails with a different assertion, I'd rather fix it in a separate
> patch if there are no objections.
>
> --
> Davide
>
> "There are no solved problems; there are only problems that are more
> or less solved" -- Henri Poincare
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list