summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 120cf57)
raw | patch | inline | side by side (parent: 120cf57)
author | Stephen Lin <stephenwlin@gmail.com> | |
Tue, 23 Apr 2013 16:31:56 +0000 (16:31 +0000) | ||
committer | Stephen Lin <stephenwlin@gmail.com> | |
Tue, 23 Apr 2013 16:31:56 +0000 (16:31 +0000) |
1) Disallow 'returned' on parameter that is also 'sret' (no sensible semantics, as far as I can tell).
2) Conservatively disallow tail calls through 'returned' parameters that also are 'zext' or 'sext' (for consistency with treatment of other zero-extending and sign-extending operations in tail call position detection...can be revised later to handle situations that can be determined to be safe).
This is a new attribute that is not yet used, so there is no impact.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@180118 91177308-0d34-0410-b5e6-96231b3b80d8
2) Conservatively disallow tail calls through 'returned' parameters that also are 'zext' or 'sext' (for consistency with treatment of other zero-extending and sign-extending operations in tail call position detection...can be revised later to handle situations that can be determined to be safe).
This is a new attribute that is not yet used, so there is no impact.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@180118 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/Analysis.cpp | patch | blob | history | |
lib/IR/Verifier.cpp | patch | blob | history |
index 4731af5089ac3927fc942cc0a6a23d68ac069195..e2b2067b0c65c68450cfcf7b0618d00c64abe023 100644 (file)
--- a/lib/CodeGen/Analysis.cpp
+++ b/lib/CodeGen/Analysis.cpp
i != e; ++i) {
unsigned attrInd = i - I->op_begin() + 1;
if (cast<CallInst>(I)->paramHasAttr(attrInd, Attribute::Returned) &&
+ !cast<CallInst>(I)->paramHasAttr(attrInd, Attribute::ZExt) &&
+ !cast<CallInst>(I)->paramHasAttr(attrInd, Attribute::SExt) &&
isNoopBitcast((*i)->getType(), I->getType(), TLI)) {
NoopInput = *i;
break;
i != e; ++i) {
unsigned attrInd = i - I->op_begin() + 1;
if (cast<InvokeInst>(I)->paramHasAttr(attrInd, Attribute::Returned) &&
+ !cast<InvokeInst>(I)->paramHasAttr(attrInd, Attribute::ZExt) &&
+ !cast<InvokeInst>(I)->paramHasAttr(attrInd, Attribute::SExt) &&
isNoopBitcast((*i)->getType(), I->getType(), TLI)) {
NoopInput = *i;
break;
diff --git a/lib/IR/Verifier.cpp b/lib/IR/Verifier.cpp
index 888090db61e08dfe52cad0dd90adcd6634c491a1..d106173b5212ac7dbe2992658165d32dbefd76e1 100644 (file)
--- a/lib/IR/Verifier.cpp
+++ b/lib/IR/Verifier.cpp
@@ -740,6 +740,10 @@ void Verifier::VerifyParameterAttrs(AttributeSet Attrs, unsigned Idx, Type *Ty,
Attrs.hasAttribute(Idx, Attribute::InReg))), "Attributes "
"'byval, nest, and inreg' are incompatible!", V);
+ Assert1(!(Attrs.hasAttribute(Idx, Attribute::StructRet) &&
+ Attrs.hasAttribute(Idx, Attribute::Returned)), "Attributes "
+ "'sret and returned' are incompatible!", V);
+
Assert1(!(Attrs.hasAttribute(Idx, Attribute::ZExt) &&
Attrs.hasAttribute(Idx, Attribute::SExt)), "Attributes "
"'zeroext and signext' are incompatible!", V);