[PATCH] D152081: [Attributor] Add lightweight version for attribute deduction only. (WIP)

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Jun 3 13:21:32 PDT 2023


fhahn created this revision.
fhahn added reviewers: jdoerfert, nikic, reames, efriedma, RKSimon.
Herald added subscribers: hoy, ormris, StephenFan, okura, kuter, hiraditya.
Herald added a reviewer: homerdin.
Herald added a project: All.
fhahn requested review of this revision.
Herald added a reviewer: sstefan1.
Herald added a project: LLVM.

This patch adds a lightweight instance of Attributor that only deduces
attributes.

This is just an initial version and I might be missing some attributes,
but the goal is to have a version that only focuses on attributes to
replace the function-attrs pass. Please let me know if I am missing
any important knobs for the Attributor.

The initial version, has a few open issues, the main one probably being
compile time. I'd like get a conversation going on how to best move
forward here. The main additional functionality I'd like to see in
general is propagating attributes to call sites. There's an instcombine
patch D151943 <https://reviews.llvm.org/D151943> that attempts to extend InstCombine to do that. IMO it
would probably preferable to do it directly when deriving the
attributes. That means either switching to attributor or extending
FunctionAttrs.

Open issues:

- compile time The current version increase O3 <https://reviews.llvm.org/owners/package/3/> +0.66% and LTO +1.10% when only replacing the module version of FunctionAttrs. https://llvm-compile-time-tracker.com/compare.php?from=2fef38f82dc39af42390e216ce2ab3873ab12c20&to=9f94b2739fc445754c9e0cdbc91853197c287874&stat=instructions%3Au Also replacing the CGSCC instances causes a much larger increase (O3 <https://reviews.llvm.org/owners/package/3/> +4.28%, LTO +4.77%) https://llvm-compile-time-tracker.com/compare.php?from=2fef38f82dc39af42390e216ce2ab3873ab12c20&to=243f33f6c59951f934faf1f56163d2ad4b8cb505&stat=instructions%3Au Both are with an additional change to preserve more analysis, like FunctionAttrs

- missed attribute inference (mustprogress missing but looks like this is covered by D94740 <https://reviews.llvm.org/D94740>, missed argmem/inaccessible4 memory effects in some cases)


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D152081

Files:
  llvm/include/llvm/Transforms/IPO/Attributor.h
  llvm/lib/Passes/PassBuilderPipelines.cpp
  llvm/lib/Passes/PassRegistry.def
  llvm/lib/Transforms/IPO/Attributor.cpp
  llvm/test/Transforms/FunctionAttrs/nocapture.ll
  llvm/test/Transforms/FunctionAttrs/readattrs.ll
  llvm/test/Transforms/FunctionAttrs/willreturn.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D152081.528152.patch
Type: text/x-patch
Size: 34310 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230603/e0a810d2/attachment.bin>


More information about the llvm-commits mailing list