Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion llvm/lib/IR/Type.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -791,7 +791,8 @@ VectorType *VectorType::get(Type *ElementType, ElementCount EC) {

bool VectorType::isValidElementType(Type *ElemTy) {
return ElemTy->isIntegerTy() || ElemTy->isFloatingPointTy() ||
ElemTy->isPointerTy() || ElemTy->getTypeID() == TypedPointerTyID;
ElemTy->isPointerTy() || ElemTy->getTypeID() == TypedPointerTyID ||
(ElemTy->isTargetExtTy() && ElemTy->isSized());
}

//===----------------------------------------------------------------------===//
Expand Down
8 changes: 8 additions & 0 deletions llvm/test/Verifier/target-ext-vector-invalid.ll
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
; RUN: not llvm-as %s -o /dev/null 2>&1 | FileCheck %s
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-disable-output instead of -o /dev/null


; CHECK: invalid vector element type

define void @bad() {
%v = alloca <2 x target("spirv.IntegralConstant")>
ret void
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing newline error

11 changes: 11 additions & 0 deletions llvm/test/Verifier/target-ext-vector.ll
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
; RUN: llvm-as -o - %s | llvm-dis | FileCheck %s

; CHECK-LABEL: @vec_ops(
define <2 x target("spirv.Image")> @vec_ops(<2 x target("spirv.Image")> %x) {
%a = alloca <2 x target("spirv.Image")>
store <2 x target("spirv.Image")> %x, ptr %a
%load = load <2 x target("spirv.Image")>, ptr %a
%elt = extractelement <2 x target("spirv.Image")> %load, i64 0
%res = insertelement <2 x target("spirv.Image")> undef, target("spirv.Image") %elt, i64 1
ret <2 x target("spirv.Image")> %res
}