[PATCH] D105108: [InstructionCost] Add saturation support.
Sander de Smalen via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 29 06:08:34 PDT 2021
sdesmalen created this revision.
Herald added a subscriber: dexonsmith.
sdesmalen requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
This patch makes the operations on InstructionCost saturate, so that when
costs are accumulated they saturate to <max value>.
One of the compelling reasons for wanting to have saturation support
is because in various places, arbitrary values are used to represent
a 'high' cost, but when accumulating the cost of some set of operations
or a loop, overflow is not taken into account, which may lead to unexpected
results. By defining the operations to saturate, we can express the cost
of something 'very expensive' as InstructionCost::getMax().
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D105108
Files:
llvm/include/llvm/Support/InstructionCost.h
llvm/unittests/Support/InstructionCostTest.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D105108.355198.patch
Type: text/x-patch
Size: 4240 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210629/7068afd1/attachment.bin>
More information about the llvm-commits
mailing list