[PATCH] D123531: [GlobalsModRef][FIX] Ensure we honor synchronizing effects of intrinsics

Johannes Doerfert via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 11 12:13:11 PDT 2022


jdoerfert updated this revision to Diff 421999.
jdoerfert added a comment.

Add nocallback check and improve comment


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D123531

Files:
  llvm/lib/Analysis/GlobalsModRef.cpp


Index: llvm/lib/Analysis/GlobalsModRef.cpp
===================================================================
--- llvm/lib/Analysis/GlobalsModRef.cpp
+++ llvm/lib/Analysis/GlobalsModRef.cpp
@@ -533,7 +533,13 @@
           FI.addModRefInfo(ModRefInfo::ModRef);
           if (!F->onlyAccessesArgMemory())
             FI.setMayReadAnyGlobal();
-          if (!F->isIntrinsic()) {
+          // Intrinsics, like any other synchronizing function, can make effects
+          // of other threads visible. Without nosync we know nothing really.
+          // Similarly, if `nocallback` is missing the function, or intrinsic,
+          // can call into the module arbitrarily. If both are set the function
+          // has an effect but will not interact with accesses of internal
+          // globals inside the module.
+          if (!F->hasNoSync() || !F->hasFnAttribute(Attribute::NoCallback)) {
             KnowNothing = true;
             break;
           }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D123531.421999.patch
Type: text/x-patch
Size: 964 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220411/5f1cb415/attachment.bin>


More information about the llvm-commits mailing list