[all-commits] [llvm/llvm-project] 2fb51f: [FuncSpec] Update function specialization to handl...

Mats Petersson via All-commits all-commits at lists.llvm.org
Wed Nov 22 02:41:15 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 2fb51fba8ca904a6d3ddf30ae94228ecf9e6a231
      https://github.com/llvm/llvm-project/commit/2fb51fba8ca904a6d3ddf30ae94228ecf9e6a231
  Author: Mats Petersson <mats.petersson at arm.com>
  Date:   2023-11-22 (Wed, 22 Nov 2023)

  Changed paths:
    M llvm/include/llvm/Transforms/IPO/FunctionSpecialization.h
    M llvm/lib/Transforms/IPO/FunctionSpecialization.cpp
    A llvm/test/Transforms/FunctionSpecialization/discover-transitive-phis.ll
    A llvm/test/Transforms/FunctionSpecialization/phi-nodes-can-constfold.ll
    A llvm/test/Transforms/FunctionSpecialization/phi-nodes-non-constfoldable.ll

  Log Message:
  -----------
  [FuncSpec] Update function specialization to handle phi-chains (#72903)

When using the LLVM flang compiler with alias analysis (AA) enabled,
SPEC2017:548.exchange2_r was running significantly slower than wihtout
the AA.

This was caused by the GVN pass replacing many of the loads in the
pre-AA code with phi-nodes that form a long chain of dependencies, which
the function specialization was unable to follow.

This adds a function to discover phi-nodes in a transitive set, with
some limitations to avoid spending ages analysing phi-nodes.

The minimum latency savings also had to be lowered - fewer load
instructions means less saving.

Adding some more prints to help debugging the isProfitable decision.

No significant change in compile time or generated code-size.

(A previous attempt to fix this was abandoned: https://github.com/llvm/llvm-project/pull/71442)

---------

Co-authored-by: Alexandros Lamprineas <alexandros.lamprineas at arm.com>




More information about the All-commits mailing list