[PATCH] D127273: [GlobalsModRef] Remove check for allocator calls

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 8 01:04:38 PDT 2022


nikic created this revision.
nikic added reviewers: reames, durin42.
Herald added a subscriber: hiraditya.
Herald added a project: All.
nikic requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

As the FIXME already indicates, I don't see why this code would be necessary. If there's a call to an allocator function, that should get treated just like any other function call -- usually it will be a declaration and handled conservatively based on memory attributes only. There should be no need to explicitly force it to be modref. No test failures either, so I think this is just dead code.


https://reviews.llvm.org/D127273

Files:
  llvm/lib/Analysis/GlobalsModRef.cpp


Index: llvm/lib/Analysis/GlobalsModRef.cpp
===================================================================
--- llvm/lib/Analysis/GlobalsModRef.cpp
+++ llvm/lib/Analysis/GlobalsModRef.cpp
@@ -597,12 +597,7 @@
         // We handle calls specially because the graph-relevant aspects are
         // handled above.
         if (auto *Call = dyn_cast<CallBase>(&I)) {
-          auto &TLI = GetTLI(*Node->getFunction());
-          if (isAllocationFn(Call, &TLI) || isFreeCall(Call, &TLI)) {
-            // FIXME: It is completely unclear why this is necessary and not
-            // handled by the above graph code.
-            FI.addModRefInfo(ModRefInfo::ModRef);
-          } else if (Function *Callee = Call->getCalledFunction()) {
+          if (Function *Callee = Call->getCalledFunction()) {
             // The callgraph doesn't include intrinsic calls.
             if (Callee->isIntrinsic()) {
               if (isa<DbgInfoIntrinsic>(Call))


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D127273.435065.patch
Type: text/x-patch
Size: 956 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220608/bca8dde0/attachment.bin>


More information about the llvm-commits mailing list