diff options
| author | 2019-06-23 21:36:31 +0000 | |
|---|---|---|
| committer | 2019-06-23 21:36:31 +0000 | |
| commit | 23f101f37937a1bd4a29726cab2f76e0fb038b35 (patch) | |
| tree | f7da7d6b32c2e07114da399150bfa88d72187012 /gnu/llvm/lib/IR/Attributes.cpp | |
| parent | sort previous; ok deraadt (diff) | |
| download | wireguard-openbsd-23f101f37937a1bd4a29726cab2f76e0fb038b35.tar.xz wireguard-openbsd-23f101f37937a1bd4a29726cab2f76e0fb038b35.zip | |
Import LLVM 8.0.0 release including clang, lld and lldb.
Diffstat (limited to 'gnu/llvm/lib/IR/Attributes.cpp')
| -rw-r--r-- | gnu/llvm/lib/IR/Attributes.cpp | 36 |
1 files changed, 21 insertions, 15 deletions
diff --git a/gnu/llvm/lib/IR/Attributes.cpp b/gnu/llvm/lib/IR/Attributes.cpp index d87187481be..ff46debb7a9 100644 --- a/gnu/llvm/lib/IR/Attributes.cpp +++ b/gnu/llvm/lib/IR/Attributes.cpp @@ -323,6 +323,8 @@ std::string Attribute::getAsString(bool InAttrGrp) const { return "returns_twice"; if (hasAttribute(Attribute::SExt)) return "signext"; + if (hasAttribute(Attribute::SpeculativeLoadHardening)) + return "speculative_load_hardening"; if (hasAttribute(Attribute::Speculatable)) return "speculatable"; if (hasAttribute(Attribute::StackProtect)) @@ -637,7 +639,7 @@ LLVM_DUMP_METHOD void AttributeSet::dump() const { AttributeSetNode::AttributeSetNode(ArrayRef<Attribute> Attrs) : AvailableAttrs(0), NumAttrs(Attrs.size()) { // There's memory after the node where we can store the entries in. - std::copy(Attrs.begin(), Attrs.end(), getTrailingObjects<Attribute>()); + llvm::copy(Attrs, getTrailingObjects<Attribute>()); for (const auto I : *this) { if (!I.isStringAttribute()) { @@ -656,7 +658,7 @@ AttributeSetNode *AttributeSetNode::get(LLVMContext &C, FoldingSetNodeID ID; SmallVector<Attribute, 8> SortedAttrs(Attrs.begin(), Attrs.end()); - llvm::sort(SortedAttrs.begin(), SortedAttrs.end()); + llvm::sort(SortedAttrs); for (const auto Attr : SortedAttrs) Attr.Profile(ID); @@ -807,7 +809,7 @@ AttributeListImpl::AttributeListImpl(LLVMContext &C, assert(!Sets.empty() && "pointless AttributeListImpl"); // There's memory after the node where we can store the entries in. - std::copy(Sets.begin(), Sets.end(), getTrailingObjects<AttributeSet>()); + llvm::copy(Sets, getTrailingObjects<AttributeSet>()); // Initialize AvailableFunctionAttrs summary bitset. static_assert(Attribute::EndAttrKinds <= @@ -1683,28 +1685,32 @@ adjustCallerStackProbeSize(Function &Caller, const Function &Callee) { } /// If the inlined function defines a min legal vector width, then ensure -/// the calling function has the same or larger min legal vector width. This -/// function is called after the inlining decision has been made so we have to -/// merge the attribute this way. Heuristics that would use +/// the calling function has the same or larger min legal vector width. If the +/// caller has the attribute, but the callee doesn't, we need to remove the +/// attribute from the caller since we can't make any guarantees about the +/// caller's requirements. +/// This function is called after the inlining decision has been made so we have +/// to merge the attribute this way. Heuristics that would use /// min-legal-vector-width to determine inline compatibility would need to be /// handled as part of inline cost analysis. static void adjustMinLegalVectorWidth(Function &Caller, const Function &Callee) { - if (Callee.hasFnAttribute("min-legal-vector-width")) { - uint64_t CalleeVectorWidth; - Callee.getFnAttribute("min-legal-vector-width") - .getValueAsString() - .getAsInteger(0, CalleeVectorWidth); - if (Caller.hasFnAttribute("min-legal-vector-width")) { + if (Caller.hasFnAttribute("min-legal-vector-width")) { + if (Callee.hasFnAttribute("min-legal-vector-width")) { uint64_t CallerVectorWidth; Caller.getFnAttribute("min-legal-vector-width") .getValueAsString() .getAsInteger(0, CallerVectorWidth); - if (CallerVectorWidth < CalleeVectorWidth) { + uint64_t CalleeVectorWidth; + Callee.getFnAttribute("min-legal-vector-width") + .getValueAsString() + .getAsInteger(0, CalleeVectorWidth); + if (CallerVectorWidth < CalleeVectorWidth) Caller.addFnAttr(Callee.getFnAttribute("min-legal-vector-width")); - } } else { - Caller.addFnAttr(Callee.getFnAttribute("min-legal-vector-width")); + // If the callee doesn't have the attribute then we don't know anything + // and must drop the attribute from the caller. + Caller.removeFnAttr("min-legal-vector-width"); } } } |
