summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavide Italiano <davide@freebsd.org>2016-10-27 23:38:51 +0000
committerDavide Italiano <davide@freebsd.org>2016-10-27 23:38:51 +0000
commite865a525df9f8799626845f72d68be4195989fab (patch)
treeba36675d244e5463301762df08e6435aca32e7ca
parent6b9c1be4eaf35180c03fedce483c6b798be91c8a (diff)
downloadbcm5719-llvm-e865a525df9f8799626845f72d68be4195989fab.tar.gz
bcm5719-llvm-e865a525df9f8799626845f72d68be4195989fab.zip
[IR] Reintroduce getGEPReturnType(), it will be used in a later patch.
llvm-svn: 285365
-rw-r--r--llvm/include/llvm/IR/Instructions.h5
-rw-r--r--llvm/test/Transforms/InstCombine/gep-vector.ll15
2 files changed, 20 insertions, 0 deletions
diff --git a/llvm/include/llvm/IR/Instructions.h b/llvm/include/llvm/IR/Instructions.h
index b3ad55bf308..0afbaccd8b5 100644
--- a/llvm/include/llvm/IR/Instructions.h
+++ b/llvm/include/llvm/IR/Instructions.h
@@ -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)),
diff --git a/llvm/test/Transforms/InstCombine/gep-vector.ll b/llvm/test/Transforms/InstCombine/gep-vector.ll
new file mode 100644
index 00000000000..ce021bf207f
--- /dev/null
+++ b/llvm/test/Transforms/InstCombine/gep-vector.ll
@@ -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
+}
OpenPOWER on IntegriCloud