forked from OSchip/llvm-project
[IR] Reintroduce getGEPReturnType(), it will be used in a later patch.
llvm-svn: 285365
This commit is contained in:
parent
6b9c1be4ea
commit
e865a525df
|
@ -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)),
|
||||
|
|
|
@ -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
|
||||
}
|
Loading…
Reference in New Issue