diff --git a/llvm/include/llvm/IR/Argument.h b/llvm/include/llvm/IR/Argument.h index 76d780485ea0b..e8ca8a6e81b92 100644 --- a/llvm/include/llvm/IR/Argument.h +++ b/llvm/include/llvm/IR/Argument.h @@ -120,6 +120,9 @@ class Argument final : public Value { /// Return true if this argument has the nocapture attribute. bool hasNoCaptureAttr() const; + /// Return true if this argument has the nofree attribute. + bool hasNoFreeAttr() const; + /// Return true if this argument has the sret attribute. bool hasStructRetAttr() const; diff --git a/llvm/include/llvm/IR/Function.h b/llvm/include/llvm/IR/Function.h index b1ef3b1131908..b3a1b6c036187 100644 --- a/llvm/include/llvm/IR/Function.h +++ b/llvm/include/llvm/IR/Function.h @@ -624,6 +624,14 @@ class Function : public GlobalObject, public ilist_node { addFnAttr(Attribute::NoFree); } + /// Determine if the call can synchroize with other threads + bool hasNoSync() const { + return hasFnAttribute(Attribute::NoSync); + } + void setNoSync() { + addFnAttr(Attribute::NoSync); + } + /// Determine if the function is known not to recurse, directly or /// indirectly. bool doesNotRecurse() const { diff --git a/llvm/lib/IR/Function.cpp b/llvm/lib/IR/Function.cpp index 553db4e8f3f18..46aec72945720 100644 --- a/llvm/lib/IR/Function.cpp +++ b/llvm/lib/IR/Function.cpp @@ -240,6 +240,11 @@ bool Argument::hasNoCaptureAttr() const { return hasAttribute(Attribute::NoCapture); } +bool Argument::hasNoFreeAttr() const { + if (!getType()->isPointerTy()) return false; + return hasAttribute(Attribute::NoFree); +} + bool Argument::hasStructRetAttr() const { if (!getType()->isPointerTy()) return false; return hasAttribute(Attribute::StructRet);