[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 12:46:48 PDT 2016


On Mon, Oct 31, 2016 at 12:42 PM Davide Italiano <davide at freebsd.org> wrote:

> On Mon, Oct 31, 2016 at 11:15 AM, David Blaikie <dblaikie at gmail.com>
> wrote:
> > 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?)
> >
>
> It was a mistake, reverted couple of minutes later, sorry.
>

Ah, no worries - handy to follow-up with a reply to the original commit to
help others looking for the story/how things happened. But not always
necessary by any means - I certainly don't always/generally send a follow
up like that.


>
> > & adding an unused function's probably not ideal either, and should
> probably
> > go in alongside its usage
> >
>
> I used here. If you prefer I can include together with its usage in the
> future.
>

I think that'd be my call in this case - but it does vary, for sure.
Usually I think it's good to include tests with the code, one way or
another (either with unit tests, or by rolling the functionality up into
the code where it becomes live/testable, etc)


> http://llvm.org/viewvc/llvm-project?rev=285371&view=rev
>
>
> > 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
>
>
>
> --
> Davide
>
> "There are no solved problems; there are only problems that are more
> or less solved" -- Henri Poincare
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161031/c80d4f2c/attachment.html>


More information about the llvm-commits mailing list