[llvm] r285365 - [IR] Reintroduce getGEPReturnType(), it will be used in a later patch.
Davide Italiano via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 27 16:38:51 PDT 2016
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
+}
More information about the llvm-commits
mailing list