[PATCH] D126455: [FuncSpec] Make the Function Specializer part of the IPSCCP pass.

Alexandros Lamprineas via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 19 14:50:18 PDT 2022


labrinea updated this revision to Diff 469041.
labrinea added a reviewer: momchil.velikov.
labrinea added a comment.

I have moved the invocation of the specializer earlier in the ipsccp pass, such that no instructions get deleted until all the solving is done. This essentially makes all of D128822 <https://reviews.llvm.org/D128822>, D128823 <https://reviews.llvm.org/D128823>, D128824 <https://reviews.llvm.org/D128824>, D128825 <https://reviews.llvm.org/D128825>, D126456 <https://reviews.llvm.org/D126456> and D128827 <https://reviews.llvm.org/D128827> obsolete. There is one thing I couldn't get working, which is to update the lattice value of the callsites to specialized functions. Unfortunately the semantics of the solver do not allow lattices to move from a generic to a more specific state (i.e. from a wider to a narrower constant range). That said the zapping of returned values won't work on specialized functions, neither we can propagate a constant returned value to the function body where the callsite resides. On another note, the function analysis information which is provided to the pass (predication info, dominator tree) cannot be used on the specialized functions; not sure if that's a problem though.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D126455

Files:
  llvm/include/llvm/InitializePasses.h
  llvm/include/llvm/LinkAllPasses.h
  llvm/include/llvm/Transforms/IPO.h
  llvm/include/llvm/Transforms/IPO/FunctionSpecialization.h
  llvm/include/llvm/Transforms/IPO/SCCP.h
  llvm/include/llvm/Transforms/Scalar/SCCP.h
  llvm/lib/Passes/PassBuilderPipelines.cpp
  llvm/lib/Passes/PassRegistry.def
  llvm/lib/Transforms/IPO/FunctionSpecialization.cpp
  llvm/lib/Transforms/IPO/IPO.cpp
  llvm/lib/Transforms/IPO/PassManagerBuilder.cpp
  llvm/lib/Transforms/IPO/SCCP.cpp
  llvm/lib/Transforms/Scalar/CMakeLists.txt
  llvm/lib/Transforms/Scalar/SCCP.cpp
  llvm/test/Transforms/FunctionSpecialization/bug52821-use-after-free.ll
  llvm/test/Transforms/FunctionSpecialization/bug55000-read-uninitialized-value.ll
  llvm/test/Transforms/FunctionSpecialization/function-specialization-always-inline.ll
  llvm/test/Transforms/FunctionSpecialization/function-specialization-constant-expression.ll
  llvm/test/Transforms/FunctionSpecialization/function-specialization-constant-expression2.ll
  llvm/test/Transforms/FunctionSpecialization/function-specialization-constant-expression3.ll
  llvm/test/Transforms/FunctionSpecialization/function-specialization-constant-expression4.ll
  llvm/test/Transforms/FunctionSpecialization/function-specialization-constant-expression5.ll
  llvm/test/Transforms/FunctionSpecialization/function-specialization-constant-integers.ll
  llvm/test/Transforms/FunctionSpecialization/function-specialization-loop.ll
  llvm/test/Transforms/FunctionSpecialization/function-specialization-minsize.ll
  llvm/test/Transforms/FunctionSpecialization/function-specialization-minsize2.ll
  llvm/test/Transforms/FunctionSpecialization/function-specialization-minsize3.ll
  llvm/test/Transforms/FunctionSpecialization/function-specialization-nodup.ll
  llvm/test/Transforms/FunctionSpecialization/function-specialization-nodup2.ll
  llvm/test/Transforms/FunctionSpecialization/function-specialization-noexec.ll
  llvm/test/Transforms/FunctionSpecialization/function-specialization-nonconst-glob.ll
  llvm/test/Transforms/FunctionSpecialization/function-specialization-nothing-todo.ll
  llvm/test/Transforms/FunctionSpecialization/function-specialization-poison.ll
  llvm/test/Transforms/FunctionSpecialization/function-specialization-recursive.ll
  llvm/test/Transforms/FunctionSpecialization/function-specialization-recursive2.ll
  llvm/test/Transforms/FunctionSpecialization/function-specialization-recursive3.ll
  llvm/test/Transforms/FunctionSpecialization/function-specialization-recursive4.ll
  llvm/test/Transforms/FunctionSpecialization/function-specialization-stats.ll
  llvm/test/Transforms/FunctionSpecialization/function-specialization.ll
  llvm/test/Transforms/FunctionSpecialization/function-specialization2.ll
  llvm/test/Transforms/FunctionSpecialization/function-specialization3.ll
  llvm/test/Transforms/FunctionSpecialization/function-specialization4.ll
  llvm/test/Transforms/FunctionSpecialization/function-specialization5.ll
  llvm/test/Transforms/FunctionSpecialization/identical-specializations.ll
  llvm/test/Transforms/FunctionSpecialization/remove-dead-recursive-function.ll
  llvm/test/Transforms/FunctionSpecialization/specialize-multiple-arguments.ll
  llvm/utils/gn/secondary/llvm/lib/Transforms/Scalar/BUILD.gn

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D126455.469041.patch
Type: text/x-patch
Size: 115812 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221019/378dc29e/attachment-0001.bin>


More information about the llvm-commits mailing list