[PATCH] D107897: [FuncSpec] Don't specialize function which are easy to inline

Chuanqi Xu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 11 05:40:11 PDT 2021


ChuanqiXu created this revision.
ChuanqiXu added reviewers: SjoerdMeijer, fhahn, xbolva00.
Herald added subscribers: snehasish, ormris, hiraditya.
ChuanqiXu requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

It would waste time to specialize a function which would inline finally. 
This patch did two things:

- Don't specialize functions which are always-inline.
- Don't spescialize functions whose lines of code are less than threshold (100 by default).

For spec2017int, this patch could reduce the number of specialized functions  by 33%. Then the compile time didn't increase for every benchmark.

Test Plan: check-llvm, spec2017


https://reviews.llvm.org/D107897

Files:
  llvm/lib/Transforms/IPO/FunctionSpecialization.cpp
  llvm/test/Transforms/FunctionSpecialization/function-specialization-always-inline.ll
  llvm/test/Transforms/FunctionSpecialization/function-specialization-constant-integers.ll
  llvm/test/Transforms/FunctionSpecialization/function-specialization-loop.ll
  llvm/test/Transforms/FunctionSpecialization/function-specialization2.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D107897.365727.patch
Type: text/x-patch
Size: 6312 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210811/15e9df56/attachment.bin>


More information about the llvm-commits mailing list