[PATCH] D115302: GlobalsModRef should treat functions w/o nosync conservatively.

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 8 14:32:26 PST 2021


efriedma added a comment.

> What's supposed to be the source of nosync attribute? Is it expected to be set explicitly by the user, or does LLVM relies on automatically inferring it?

Generally, we expect to infer it in attributor/function-attrs.  Adding nosync to the tests is fine.



================
Comment at: llvm/include/llvm/IR/Intrinsics.td:419
+def int_objc_autoreleasePoolPop             : Intrinsic<[], [llvm_ptr_ty], [IntrNoSync]>;
+def int_objc_autoreleasePoolPush            : Intrinsic<[llvm_ptr_ty], [], [IntrNoSync]>;
 def int_objc_autoreleaseReturnValue         : Intrinsic<[llvm_ptr_ty],
----------------
I don't think this is right.  Among other issues, refcounting on objc objects can run arbitrary code.


================
Comment at: llvm/lib/Analysis/GlobalsModRef.cpp:916
 
+  if (Function *F = Call->getCalledFunction())
+    if (!F->hasNoSync())
----------------
This isn't the right way to query an attribute on a call.  Should be something like `Call->hasFnAttr(Attribute::NoSync)`.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D115302/new/

https://reviews.llvm.org/D115302



More information about the llvm-commits mailing list