aboutsummaryrefslogtreecommitdiffstats
path: root/lib/VMCore
diff options
context:
space:
mode:
authorJames Molloy <james.molloy@arm.com>2012-12-20 16:04:27 +0000
committerJames Molloy <james.molloy@arm.com>2012-12-20 16:04:27 +0000
commit67ae13575900e8efd056672987249fd0adbf5e73 (patch)
treec297968f698f92b4b2d7b06c6d892a2299061887 /lib/VMCore
parent6af228a92a7b8414fa3c1b3c37ee659d32e66e1b (diff)
downloadexternal_llvm-67ae13575900e8efd056672987249fd0adbf5e73.zip
external_llvm-67ae13575900e8efd056672987249fd0adbf5e73.tar.gz
external_llvm-67ae13575900e8efd056672987249fd0adbf5e73.tar.bz2
Add a new attribute, 'noduplicate'. If a function contains a noduplicate call, the call cannot be duplicated - Jump threading, loop unrolling, loop unswitching, and loop rotation are inhibited if they would duplicate the call.
Similarly inlining of the function is inhibited, if that would duplicate the call (in particular inlining is still allowed when there is only one callsite and the function has internal linkage). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170704 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore')
-rw-r--r--lib/VMCore/Attributes.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/VMCore/Attributes.cpp b/lib/VMCore/Attributes.cpp
index 2782455..5bde563 100644
--- a/lib/VMCore/Attributes.cpp
+++ b/lib/VMCore/Attributes.cpp
@@ -213,6 +213,8 @@ std::string Attribute::getAsString() const {
Result += utostr(getAlignment());
Result += " ";
}
+ if (hasAttribute(Attribute::NoDuplicate))
+ Result += "noduplicate ";
// Trim the trailing space.
assert(!Result.empty() && "Unknown attribute!");
Result.erase(Result.end()-1);
@@ -327,6 +329,7 @@ uint64_t AttributeImpl::getAttrMask(uint64_t Val) {
case Attribute::NonLazyBind: return 1U << 31;
case Attribute::AddressSafety: return 1ULL << 32;
case Attribute::MinSize: return 1ULL << 33;
+ case Attribute::NoDuplicate: return 1ULL << 34;
}
llvm_unreachable("Unsupported attribute type");
}