[PATCH] D121415: [FunctionAttrs] Infer argmemonly .

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 10 14:38:20 PST 2022


fhahn created this revision.
fhahn added reviewers: nikic, jdoerfert, reames, lebedev.ri.
Herald added subscribers: ormris, hiraditya.
Herald added a project: All.
fhahn requested review of this revision.
Herald added a project: LLVM.

This patch adds initial argmemonly inference, by checking the underlying
objects of locations returned by MemoryLocation.

I think this should cover most cases, except function calls to other
argmemonly functions.

I'm not sure if there's a reason why we don't infer those yet.

Additional argmemonly can improve codegen in some cases. It also makes
it easier to come up with a C reproducer for 7662d1687b09 <https://reviews.llvm.org/rG7662d1687b09505106718d412a40a0db8149e0bf> (already fixed,
but I'm trying to see if C/C++ fuzzing could help to uncover similar
issues.)

Compile-time impact:
NewPM-O3: +0.01%
NewPM-ReleaseThinLTO: +0.03%
NewPM-ReleaseLTO+g: +0.05%

https://llvm-compile-time-tracker.com/compare.php?from=067c035012fc061ad6378458774ac2df117283c6&to=fe209d4aab5b593bd62d18c0876732ddcca1614d&stat=instructions


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D121415

Files:
  llvm/lib/Transforms/IPO/FunctionAttrs.cpp
  llvm/test/Transforms/FunctionAttrs/argmemonly.ll
  llvm/test/Transforms/FunctionAttrs/atomic.ll
  llvm/test/Transforms/FunctionAttrs/nofree.ll
  llvm/test/Transforms/FunctionAttrs/nosync.ll
  llvm/test/Transforms/FunctionAttrs/stats.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D121415.414503.patch
Type: text/x-patch
Size: 11041 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220310/3fbf1074/attachment.bin>


More information about the llvm-commits mailing list