History log of /llvm-project/llvm/lib/Transforms/IPO/FunctionSpecialization.cpp (Results 26 – 50 of 118)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 32683b23 27-Jul-2023 Douglas Yung <douglas.yung@sony.com>

Revert "[FuncSpec] Add Phi nodes to the InstCostVisitor."

This reverts commit 96ff464dd3aac255adc52787a1e28487a9cd4c35.

The test in this change was failing on many buildbots:

https://lab.llvm.org/

Revert "[FuncSpec] Add Phi nodes to the InstCostVisitor."

This reverts commit 96ff464dd3aac255adc52787a1e28487a9cd4c35.

The test in this change was failing on many buildbots:

https://lab.llvm.org/buildbot/#/builders/164/builds/41292
https://lab.llvm.org/buildbot/#/builders/258/builds/4491
https://lab.llvm.org/buildbot/#/builders/192/builds/3566
https://lab.llvm.org/buildbot/#/builders/123/builds/20411
https://lab.llvm.org/buildbot/#/builders/58/builds/42553
https://lab.llvm.org/buildbot/#/builders/247/builds/7037
https://lab.llvm.org/buildbot/#/builders/139/builds/46259
https://lab.llvm.org/buildbot/#/builders/216/builds/24650
https://lab.llvm.org/buildbot/#/builders/234/builds/12571
https://lab.llvm.org/buildbot/#/builders/232/builds/12574
https://lab.llvm.org/buildbot/#/builders/235/builds/975

show more ...


# 96ff464d 27-Jul-2023 Alexandros Lamprineas <alexandros.lamprineas@arm.com>

[FuncSpec] Add Phi nodes to the InstCostVisitor.

This patch allows constant folding of PHIs when estimating the user
bonus. Phi nodes are a special case since some of their inputs may
remain unresol

[FuncSpec] Add Phi nodes to the InstCostVisitor.

This patch allows constant folding of PHIs when estimating the user
bonus. Phi nodes are a special case since some of their inputs may
remain unresolved until all the specialization arguments have been
processed by the InstCostVisitor. Therefore, we keep a list of dead
basic blocks and then lazily visit the Phi nodes once the user bonus
has been computed for all the specialization arguments.

In addition to the last revision this one fixes the bug reported on
Phabricator.

Differential Revision: https://reviews.llvm.org/D154852

show more ...


# c52ab9ea 26-Jul-2023 Alexandros Lamprineas <alexandros.lamprineas@arm.com>

Revert "[FuncSpec] Add Phi nodes to the InstCostVisitor."

Reverting due to the crash reported in D154852.

Also reverting the subsequent commit as collateral damage:

"[FuncSpec] Split the specializ

Revert "[FuncSpec] Add Phi nodes to the InstCostVisitor."

Reverting due to the crash reported in D154852.

Also reverting the subsequent commit as collateral damage:

"[FuncSpec] Split the specialization bonus into CodeSize and Latency."

show more ...


Revision tags: llvmorg-18-init
# 20c8f58c 07-Jul-2023 Alexandros Lamprineas <alexandros.lamprineas@arm.com>

[FuncSpec] Split the specialization bonus into CodeSize and Latency.

Currently we use a combined metric TargetTransformInfo::TCK_SizeAndLatency
when estimating the specialization bonus. This is subo

[FuncSpec] Split the specialization bonus into CodeSize and Latency.

Currently we use a combined metric TargetTransformInfo::TCK_SizeAndLatency
when estimating the specialization bonus. This is suboptimal, and in some
cases erroneous. For example we shouldn't be weighting the codesize decrease
attributed to constant propagation by the block frequency of the dead code.
Instead only the latency savings should be weighted by block frequency. The
total codesize savings from all the specialization arguments should be
deducted from the specialization cost.

Differential Revision: https://reviews.llvm.org/D155103

show more ...


# 59a5c582 25-Jul-2023 Alexandros Lamprineas <alexandros.lamprineas@arm.com>

[FuncSpec][NFC] Leave a comment for future improvements.

Adds a TODO for checking inlinining opportunities while traversing
the users of the specialization arguments. This was brought up in
the revi

[FuncSpec][NFC] Leave a comment for future improvements.

Adds a TODO for checking inlinining opportunities while traversing
the users of the specialization arguments. This was brought up in
the review of D154852.

show more ...


# 03f1d09f 06-Jul-2023 Alexandros Lamprineas <alexandros.lamprineas@arm.com>

[FuncSpec] Add Phi nodes to the InstCostVisitor.

This patch allows constant folding of PHIs when estimating the user
bonus. Phi nodes are a special case since some of their inputs may
remain unresol

[FuncSpec] Add Phi nodes to the InstCostVisitor.

This patch allows constant folding of PHIs when estimating the user
bonus. Phi nodes are a special case since some of their inputs may
remain unresolved until all the specialization arguments have been
processed by the InstCostVisitor. Therefore, we keep a list of dead
basic blocks and then lazily visit the Phi nodes once the user bonus
has been computed for all the specialization arguments.

Differential Revision: https://reviews.llvm.org/D154852

show more ...


# bb6d60bf 13-Jul-2023 Alexandros Lamprineas <alexandros.lamprineas@arm.com>

[FuncSpec][NFC] Sink cast into function.

Before looking up a value in the map of known constants we attempt
to dynamically cast it. The code looks cleaner if we move the cast
inside findConstantFor(

[FuncSpec][NFC] Sink cast into function.

Before looking up a value in the map of known constants we attempt
to dynamically cast it. The code looks cleaner if we move the cast
inside findConstantFor(), where the look up happens.

Differential Revision: https://reviews.llvm.org/D155177

show more ...


# 1d0476cb 04-Jul-2023 Alexandros Lamprineas <alexandros.lamprineas@arm.com>

[FuncSpec] Prefer DataLayout-aware constant folding of GEPs.

As shown in D154820, the DataLayout-independent constant folding
interface is not good enough for handling GEPs. Instead we should
be usi

[FuncSpec] Prefer DataLayout-aware constant folding of GEPs.

As shown in D154820, the DataLayout-independent constant folding
interface is not good enough for handling GEPs. Instead we should
be using the DataLayout-aware constant folding interface. Since
there isn't a method to specifically handle GEPs we can use the
one which folds generic instruction operands.

Differential Revision: https://reviews.llvm.org/D154821

show more ...


# 2fc0d17e 29-Jun-2023 Vincent Lee <leevince@fb.com>

[FuncSpec] Avoid crashing when SwitchInst doesn't see ConstantInt

D150464 updated the cost model for function specialization. Unfortunately, this
also crashes when trying to build stage2 LLD with th

[FuncSpec] Avoid crashing when SwitchInst doesn't see ConstantInt

D150464 updated the cost model for function specialization. Unfortunately, this
also crashes when trying to build stage2 LLD with thinLTO and assertions. It looks
like the issue is caused by a mishandling of the Constant in a SwitchInst since the
Constant cannot always be assumed to safely casted to a ConstantInt. In the case
of the crash, Constant was a ConstantExpr which triggered the assertion.

Reviewed By: ChuanqiXu

Differential Revision: https://reviews.llvm.org/D154159

show more ...


# ce9d3f09 19-Jun-2023 Alexandros Lamprineas <alexandros.lamprineas@arm.com>

[FuncSpec] Promote stack values before specialization.

After each iteration of the function specializer, constant stack values
are promoted to constant globals in order to enable recursive function

[FuncSpec] Promote stack values before specialization.

After each iteration of the function specializer, constant stack values
are promoted to constant globals in order to enable recursive function
specialization. This should also be done once before running the
specializer. Enables specialization of _QMbrute_forcePdigits_2 from
SPEC2017:548.exchange2_r.

Differential Revision: https://reviews.llvm.org/D152799

show more ...


# 5400257d 19-Jun-2023 Alexandros Lamprineas <alexandros.lamprineas@arm.com>

[FuncSpec] Add Freeze and CallBase to the InstCostVisitor.

Allows constant folding of such instructions when estimating user bonus.

Differential Revision: https://reviews.llvm.org/D153036


Revision tags: llvmorg-16.0.6, llvmorg-16.0.5, llvmorg-16.0.4
# 4d13896d 11-May-2023 Alexandros Lamprineas <alexandros.lamprineas@arm.com>

Reland "[FuncSpec] Improve the accuracy of the cost model"

Instead of blindly traversing the use-def chain of constant arguments,
compute known constants along the way. Stop as soon as a user cannot

Reland "[FuncSpec] Improve the accuracy of the cost model"

Instead of blindly traversing the use-def chain of constant arguments,
compute known constants along the way. Stop as soon as a user cannot
be replaced by a constant. Keep it light-weight by handling some basic
instruction types.

Differential Revision: https://reviews.llvm.org/D150464

show more ...


# 475ddca5 02-Jun-2023 Alexandros Lamprineas <alexandros.lamprineas@arm.com>

Reland "[FuncSpec] Replace LoopInfo with BlockFrequencyInfo"

Using AvgLoopIters on any loop is too imprecise making the cost model
favor users inside loop nests regardless of the actual tripcount.

Reland "[FuncSpec] Replace LoopInfo with BlockFrequencyInfo"

Using AvgLoopIters on any loop is too imprecise making the cost model
favor users inside loop nests regardless of the actual tripcount.

Differential Revision: https://reviews.llvm.org/D150375

show more ...


# 96a14f38 30-May-2023 Nikita Popov <npopov@redhat.com>

Revert "[FuncSpec] Replace LoopInfo with BlockFrequencyInfo"

As reported on https://reviews.llvm.org/D150375#4367861 and
following, this change causes PDT invalidation issues. Revert
it and dependen

Revert "[FuncSpec] Replace LoopInfo with BlockFrequencyInfo"

As reported on https://reviews.llvm.org/D150375#4367861 and
following, this change causes PDT invalidation issues. Revert
it and dependent commits.

This reverts commit 0524534d5220da5ecb2cd424a46520184d2be366.
This reverts commit ced90d1ff64a89a13479a37a3b17a411a3259f9f.
This reverts commit 9f992cc9350a7f7072a6dbf018ea07142ea7a7ed.
This reverts commit 1b1232047e83b69561fd64b9547cb0a0d374473a.

show more ...


# 0524534d 24-May-2023 Alexandros Lamprineas <alexandros.lamprineas@arm.com>

[FuncSpec] Enable specialization of literal constants.

To do so we have to tweak the cost model such that specialization
does not trigger excessively.

Differential Revision: https://reviews.llvm.or

[FuncSpec] Enable specialization of literal constants.

To do so we have to tweak the cost model such that specialization
does not trigger excessively.

Differential Revision: https://reviews.llvm.org/D150649

show more ...


# ced90d1f 11-May-2023 Alexandros Lamprineas <alexandros.lamprineas@arm.com>

[FuncSpec] Improve the accuracy of the cost model.

Instead of blindly traversing the use-def chain of constant arguments,
compute known constants along the way. Stop as soon as a user cannot
be repl

[FuncSpec] Improve the accuracy of the cost model.

Instead of blindly traversing the use-def chain of constant arguments,
compute known constants along the way. Stop as soon as a user cannot
be replaced by a constant. Keep it light-weight by handling some basic
instruction types.

Differential Revision: https://reviews.llvm.org/D150464

show more ...


# 1b123204 11-May-2023 Alexandros Lamprineas <alexandros.lamprineas@arm.com>

[FuncSpec] Replace LoopInfo with BlockFrequencyInfo.

Using AvgLoopIters on any loop is too imprecise making the cost model
favor users inside loop nests regardless of the actual tripcount.

Differen

[FuncSpec] Replace LoopInfo with BlockFrequencyInfo.

Using AvgLoopIters on any loop is too imprecise making the cost model
favor users inside loop nests regardless of the actual tripcount.

Differential Revision: https://reviews.llvm.org/D150375

show more ...


# 929a8c9f 09-May-2023 Alexandros Lamprineas <alexandros.lamprineas@arm.com>

[FuncSpec][NFC] Rename cryptic variable to better describe it.

UM -> UniqueSpecs

Brought up on the review of D145379. Committing it seperately for now
since the Cost model improvements need rethink.


# 93ac2dbe 09-May-2023 Alexandros Lamprineas <alexandros.lamprineas@arm.com>

[FuncSpec][NFC] Add an alias for InstructionCost.

Split from D145379. I'll rethink the Cost model improvements and
commit separately.


# de24d084 04-May-2023 Momchil Velikov <momchil.velikov@arm.com>

[FuncSpec] Fix inconsistent treatment of global variables

There are a few inaccuracies with how FuncSpec handles global
variables.

When specialisation on non-const global variables is disabled (the

[FuncSpec] Fix inconsistent treatment of global variables

There are a few inaccuracies with how FuncSpec handles global
variables.

When specialisation on non-const global variables is disabled (the
default) the pass could nevertheless perform some specializations,
e.g. on a constant GEP expression, or on a SSA variable, for which the
Solver has determined it has the value of a global variable.

When specialisation on non-const global variables is enabled, the pass
would skip non-scalars, e.g. a global array, but this should be
completely inconsequential, a pointer is a pointer.

Reviewed By: SjoerdMeijer

Differential Revision: https://reviews.llvm.org/D149476

Change-Id: Ic73051b2f8602587306760bf2ec552e5860f8d39

show more ...


Revision tags: llvmorg-16.0.3, llvmorg-16.0.2, llvmorg-16.0.1
# 54e5fb78 28-Mar-2023 Alexandros Lamprineas <alexandros.lamprineas@arm.com>

[FuncSpec] Track the return values of specializations.

To track the return values of specializations, we need to invalidate all
the lattice values across the use-def chain which originates from the

[FuncSpec] Track the return values of specializations.

To track the return values of specializations, we need to invalidate all
the lattice values across the use-def chain which originates from the
callsites, recompute and propagate.

Differential Revision: https://reviews.llvm.org/D146158

show more ...


# cc7bb708 20-Apr-2023 Momchil Velikov <momchil.velikov@arm.com>

[FuncSpec] Relax restrictions on candidates for specialisation

Allow a function to be specialised even if it has its address taken or
it's global. For such functions, consider all of the arguments a

[FuncSpec] Relax restrictions on candidates for specialisation

Allow a function to be specialised even if it has its address taken or
it's global. For such functions, consider all of the arguments as
overdefined. Don't delete the functions even if all the apparent calls
were redirected to specialised instances.

Reviewed By: labrinea, ChuanqiXu

Differential Revision: https://reviews.llvm.org/D148345

show more ...


# 7ea597ea 20-Mar-2023 Alexandros Lamprineas <alexandros.lamprineas@arm.com>

[FuncSpec] Consider constant struct arguments when specializing.

Optionally enabled just like integer and floating point arguments.

Differential Revision: https://reviews.llvm.org/D145374


Revision tags: llvmorg-16.0.0, llvmorg-16.0.0-rc4
# 9627bcde 03-Mar-2023 Alexandros Lamprineas <alexandros.lamprineas@arm.com>

[FuncSpec][NFC] Command line option renaming.

Standardize all options with 'funcspec' prefix and shorter abreviations.

Differential Revision: https://reviews.llvm.org/D145378


# 67fde2b9 22-Feb-2023 Alexandros Lamprineas <alexandros.lamprineas@arm.com>

[FuncSpec] Minor refactoring in statistics and debug messages.

* Remove redundant variable `NbFunctionsSpecialized` as it is no longer
used by the cost model.
* Rename statistic `NumFuncSpecialize

[FuncSpec] Minor refactoring in statistics and debug messages.

* Remove redundant variable `NbFunctionsSpecialized` as it is no longer
used by the cost model.
* Rename statistic `NumFuncSpecialized` to `NumSpecsCreated` as a better
description (the old name confusingly implied number of functions we have
created clones for).
* Same for variable `SpecializedFuncs`. Renamed to `Specializations`.
* Move debug message in the destructor (avoids repetition when MaxIters > 1).

Differential Revision: https://reviews.llvm.org/D145375

show more ...


12345