[llvm] r285365 - [IR] Reintroduce getGEPReturnType(), it will be used in a later patch.

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 31 11:15:01 PDT 2016


>From the description it sounds like you're adding an unused function - yet
this commit included a test case? (if the function is unused it wouldn't
change the behavior of the compiler, so there would be nothing new to test,
right?)

& adding an unused function's probably not ideal either, and should
probably go in alongside its usage

On Thu, Oct 27, 2016 at 4:48 PM Davide Italiano via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

> Author: davide
> Date: Thu Oct 27 18:38:51 2016
> New Revision: 285365
>
> URL: http://llvm.org/viewvc/llvm-project?rev=285365&view=rev
> Log:
> [IR] Reintroduce getGEPReturnType(), it will be used in a later patch.
>
> Added:
>     llvm/trunk/test/Transforms/InstCombine/gep-vector.ll
> Modified:
>     llvm/trunk/include/llvm/IR/Instructions.h
>
> Modified: llvm/trunk/include/llvm/IR/Instructions.h
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/Instructions.h?rev=285365&r1=285364&r2=285365&view=diff
>
> ==============================================================================
> --- llvm/trunk/include/llvm/IR/Instructions.h (original)
> +++ llvm/trunk/include/llvm/IR/Instructions.h Thu Oct 27 18:38:51 2016
> @@ -959,6 +959,11 @@ public:
>
>    /// Returns the pointer type returned by the GEP
>    /// instruction, which may be a vector of pointers.
> +  static Type *getGEPReturnType(Value *Ptr, ArrayRef<Value *> IdxList) {
> +    return getGEPReturnType(
> +
> cast<PointerType>(Ptr->getType()->getScalarType())->getElementType(),
> +      Ptr, IdxList);
> +  }
>    static Type *getGEPReturnType(Type *ElTy, Value *Ptr,
>                                  ArrayRef<Value *> IdxList) {
>      Type *PtrTy = PointerType::get(checkGEPType(getIndexedType(ElTy,
> IdxList)),
>
> Added: llvm/trunk/test/Transforms/InstCombine/gep-vector.ll
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/gep-vector.ll?rev=285365&view=auto
>
> ==============================================================================
> --- llvm/trunk/test/Transforms/InstCombine/gep-vector.ll (added)
> +++ llvm/trunk/test/Transforms/InstCombine/gep-vector.ll Thu Oct 27
> 18:38:51 2016
> @@ -0,0 +1,15 @@
> +; RUN: opt -instcombine %s -S | FileCheck %s
> +
> +; CHECK-LABEL: patatino
> +; CHECK-NEXT: ret <8 x i64*> undef
> +define <8 x i64*> @patatino() {
> +  %el = getelementptr i64, <8 x i64*> undef, <8 x i64> undef
> +  ret <8 x i64*> %el
> +}
> +
> +; CHECK-LABEL: patatino2
> +; CHECK-NEXT: ret <8 x i64*> undef
> +define <8 x i64*> @patatino2() {
> +  %el = getelementptr inbounds i64, i64* undef, <8 x i64> undef
> +  ret <8 x i64*> %el
> +}
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161031/9ad3f076/attachment.html>


More information about the llvm-commits mailing list