<div dir="ltr">On Wed, Sep 4, 2013 at 1:37 PM, Matt Arsenault <span dir="ltr"><<a href="mailto:Matthew.Arsenault@amd.com" target="_blank">Matthew.Arsenault@amd.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> Don't accept sret or nest for vectors of pointers. Update LangRef to mention vectors.<br>
<br>
I'm not sure about nest, and I'm not sure about noalias. Are the pointers within the vector allowed to alias another in the vector?<br></blockquote><div><br></div><div>Nest shouldn't allow vectors of pointers.</div>
<div><br></div><div>As for noalias, I'd suggest posting to llvmdev.</div><div><br></div><div>-Eli</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
<a href="http://llvm-reviews.chandlerc.com/D1561" target="_blank">http://llvm-reviews.chandlerc.com/D1561</a><br>
<br>
CHANGE SINCE LAST DIFF<br>
<a href="http://llvm-reviews.chandlerc.com/D1561?vs=3933&id=4043#toc" target="_blank">http://llvm-reviews.chandlerc.com/D1561?vs=3933&id=4043#toc</a><br>
<br>
Files:<br>
docs/LangRef.rst<br>
lib/IR/Attributes.cpp<br>
test/Verifier/vector-type-attributes.ll<br>
<br>
Index: docs/LangRef.rst<br>
===================================================================<br>
--- docs/LangRef.rst<br>
+++ docs/LangRef.rst<br>
@@ -661,14 +661,16 @@<br>
<br>
``zeroext``<br>
This indicates to the code generator that the parameter or return<br>
- value should be zero-extended to the extent required by the target's<br>
- ABI (which is usually 32-bits, but is 8-bits for a i1 on x86-64) by<br>
- the caller (for a parameter) or the callee (for a return value).<br>
+ value should be zero-extended to the extent required by the<br>
+ target's ABI (which is usually 32-bits, but is 8-bits for a i1 on<br>
+ x86-64) by the caller (for a parameter) or the callee (for a<br>
+ return value). When applied to a vector, this is per-component.<br>
``signext``<br>
This indicates to the code generator that the parameter or return<br>
value should be sign-extended to the extent required by the target's<br>
ABI (which is usually 32-bits) by the caller (for a parameter) or<br>
- the callee (for a return value).<br>
+ the callee (for a return value). When applied to a vector, this is<br>
+ per-component.<br>
``inreg``<br>
This indicates that this parameter or return value should be treated<br>
in a special target-dependent fashion during while emitting code for<br>
@@ -701,7 +703,7 @@<br>
loads and stores to the structure may be assumed by the callee<br>
not to trap and to be properly aligned. This may only be applied to<br>
the first parameter. This is not a valid attribute for return<br>
- values.<br>
+ values, or for vectors of pointers.<br>
``noalias``<br>
This indicates that pointer values :ref:`based <pointeraliasing>` on<br>
the argument or return value do not alias pointer values which are<br>
@@ -722,15 +724,17 @@<br>
while LLVM's ``noalias`` is.<br>
``nocapture``<br>
This indicates that the callee does not make any copies of the<br>
- pointer that outlive the callee itself. This is not a valid<br>
- attribute for return values.<br>
+ pointer (or pointers in the case of a vector of pointers) that<br>
+ outlive the callee itself. This is not a valid attribute for<br>
+ return values.<br>
<br>
.. _nest:<br>
<br>
``nest``<br>
This indicates that the pointer parameter can be excised using the<br>
:ref:`trampoline intrinsics <int_trampoline>`. This is not a valid<br>
- attribute for return values and can only be applied to one parameter.<br>
+ attribute for return values and can only be applied to one<br>
+ parameter that is not a vector.<br>
<br>
``returned``<br>
This indicates that the function always returns the argument as its return<br>
<div class="im">Index: lib/IR/Attributes.cpp<br>
===================================================================<br>
--- lib/IR/Attributes.cpp<br>
+++ lib/IR/Attributes.cpp<br>
</div>@@ -1157,20 +1157,26 @@<br>
<div class="im"> AttributeSet AttributeFuncs::typeIncompatible(Type *Ty, uint64_t Index) {<br>
AttrBuilder Incompatible;<br>
<br>
- if (!Ty->isIntegerTy())<br>
- // Attribute that only apply to integers.<br>
+ if (!Ty->isIntOrIntVectorTy()) {<br>
+ // Attributes that only apply to integers.<br>
Incompatible.addAttribute(Attribute::SExt)<br>
.addAttribute(Attribute::ZExt);<br>
+ }<br>
<br>
- if (!Ty->isPointerTy())<br>
- // Attribute that only apply to pointers.<br>
+ if (!Ty->isPtrOrPtrVectorTy()) {<br>
+ // Attributes that only apply to pointers.<br>
Incompatible.addAttribute(Attribute::ByVal)<br>
</div>- .addAttribute(Attribute::Nest)<br>
<div class="im"> .addAttribute(Attribute::NoAlias)<br>
.addAttribute(Attribute::NoCapture)<br>
.addAttribute(Attribute::ReadNone)<br>
</div>- .addAttribute(Attribute::ReadOnly)<br>
- .addAttribute(Attribute::StructRet);<br>
+ .addAttribute(Attribute::ReadOnly);<br>
+<br>
+ if (Ty->isVectorTy()) {<br>
+ // Attributes that don't make sense for a vector of pointers<br>
+ Incompatible.addAttribute(Attribute::Nest)<br>
+ .addAttribute(Attribute::StructRet);<br>
+ }<br>
<div class="HOEnZb"><div class="h5">+ }<br>
<br>
return AttributeSet::get(Ty->getContext(), Index, Incompatible);<br>
}<br>
Index: test/Verifier/vector-type-attributes.ll<br>
===================================================================<br>
--- /dev/null<br>
+++ test/Verifier/vector-type-attributes.ll<br>
@@ -0,0 +1,14 @@<br>
+; RUN: llvm-as -disable-output %s<br>
+; Bug 15391: valid signext attribute rejected for integer vector<br>
+<br>
+define <4 x i32> @sext_vector_param(<4 x i1> signext %mask, <4 x float> %a, <4 x float> %b) {<br>
+ ret <4 x i32> undef<br>
+}<br>
+<br>
+define <4 x i32> @zext_vector_param(<4 x i1> zeroext %mask) {<br>
+ ret <4 x i32> undef<br>
+}<br>
+<br>
+define <4 x i8*> @noalias_vector_param(<4 x i8*> noalias %mask) {<br>
+ ret <4 x i8*> undef<br>
+}<br>
\ No newline at end of file<br>
</div></div></blockquote></div><br></div></div>