[PATCH] D95356: NFC: Migrate SpeculativeExecution to work on InstructionCost
Sander de Smalen via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 1 04:13:48 PST 2021
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG3b8a1d581e6e: NFC: Migrate SpeculativeExecution to work on InstructionCost (authored by sdesmalen).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D95356/new/
https://reviews.llvm.org/D95356
Files:
llvm/lib/Transforms/Scalar/SpeculativeExecution.cpp
Index: llvm/lib/Transforms/Scalar/SpeculativeExecution.cpp
===================================================================
--- llvm/lib/Transforms/Scalar/SpeculativeExecution.cpp
+++ llvm/lib/Transforms/Scalar/SpeculativeExecution.cpp
@@ -210,8 +210,8 @@
return false;
}
-static unsigned ComputeSpeculationCost(const Instruction *I,
- const TargetTransformInfo &TTI) {
+static InstructionCost ComputeSpeculationCost(const Instruction *I,
+ const TargetTransformInfo &TTI) {
switch (Operator::getOpcode(I)) {
case Instruction::GetElementPtr:
case Instruction::Add:
@@ -255,7 +255,8 @@
return TTI.getUserCost(I, TargetTransformInfo::TCK_SizeAndLatency);
default:
- return UINT_MAX; // Disallow anything not explicitly listed.
+ return InstructionCost::getInvalid(); // Disallow anything not explicitly
+ // listed.
}
}
@@ -288,11 +289,11 @@
return true;
};
- unsigned TotalSpeculationCost = 0;
+ InstructionCost TotalSpeculationCost = 0;
unsigned NotHoistedInstCount = 0;
for (const auto &I : FromBlock) {
- const unsigned Cost = ComputeSpeculationCost(&I, *TTI);
- if (Cost != UINT_MAX && isSafeToSpeculativelyExecute(&I) &&
+ const InstructionCost Cost = ComputeSpeculationCost(&I, *TTI);
+ if (Cost.isValid() && isSafeToSpeculativelyExecute(&I) &&
AllPrecedingUsesFromBlockHoisted(&I)) {
TotalSpeculationCost += Cost;
if (TotalSpeculationCost > SpecExecMaxSpeculationCost)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D95356.320435.patch
Type: text/x-patch
Size: 1606 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210201/0b622936/attachment.bin>
More information about the llvm-commits
mailing list