[PATCH] Bug 15391: Fix rejecting valid int / ptr vector attributes

Matt Arsenault Matthew.Arsenault at amd.com
Fri Aug 30 10:31:26 PDT 2013


http://llvm-reviews.chandlerc.com/D1561

Files:
  lib/IR/Attributes.cpp
  test/Verifier/vector-type-attributes.ll

Index: lib/IR/Attributes.cpp
===================================================================
--- lib/IR/Attributes.cpp
+++ lib/IR/Attributes.cpp
@@ -1157,20 +1157,22 @@
 AttributeSet AttributeFuncs::typeIncompatible(Type *Ty, uint64_t Index) {
   AttrBuilder Incompatible;
 
-  if (!Ty->isIntegerTy())
-    // Attribute that only apply to integers.
+  if (!Ty->isIntOrIntVectorTy()) {
+    // Attributes that only apply to integers.
     Incompatible.addAttribute(Attribute::SExt)
       .addAttribute(Attribute::ZExt);
+  }
 
-  if (!Ty->isPointerTy())
-    // Attribute that only apply to pointers.
+  if (!Ty->isPtrOrPtrVectorTy()) {
+    // Attributes that only apply to pointers.
     Incompatible.addAttribute(Attribute::ByVal)
       .addAttribute(Attribute::Nest)
       .addAttribute(Attribute::NoAlias)
       .addAttribute(Attribute::NoCapture)
       .addAttribute(Attribute::ReadNone)
       .addAttribute(Attribute::ReadOnly)
       .addAttribute(Attribute::StructRet);
+  }
 
   return AttributeSet::get(Ty->getContext(), Index, Incompatible);
 }
Index: test/Verifier/vector-type-attributes.ll
===================================================================
--- /dev/null
+++ test/Verifier/vector-type-attributes.ll
@@ -0,0 +1,14 @@
+; RUN: llvm-as -disable-output %s
+; Bug 15391: valid signext attribute rejected for integer vector
+
+define <4 x i32> @sext_vector_param(<4 x i1> signext %mask, <4 x float> %a, <4 x float> %b) {
+  ret <4 x i32> undef
+}
+
+define <4 x i32> @zext_vector_param(<4 x i1> zeroext %mask) {
+  ret <4 x i32> undef
+}
+
+define <4 x i8*> @noalias_vector_param(<4 x i8*> noalias %mask) {
+  ret <4 x i8*> undef
+}
\ No newline at end of file
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D1561.1.patch
Type: text/x-patch
Size: 1694 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130830/a3fad44d/attachment.bin>


More information about the llvm-commits mailing list