[llvm] 9907746 - Move Function Specialization to its correct location. NFC.
Sjoerd Meijer via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 11 07:01:07 PDT 2021
Author: Sjoerd Meijer
Date: 2021-06-11T15:00:10+01:00
New Revision: 9907746f5db7c2a91917fa7b312136f7bf03d2f5
URL: https://github.com/llvm/llvm-project/commit/9907746f5db7c2a91917fa7b312136f7bf03d2f5
DIFF: https://github.com/llvm/llvm-project/commit/9907746f5db7c2a91917fa7b312136f7bf03d2f5.diff
LOG: Move Function Specialization to its correct location. NFC.
As a follow up of rGc4a0969b9c14, and as part of D104102, move it to
the IPO transformations directory.
Added:
llvm/lib/Transforms/IPO/FunctionSpecialization.cpp
Modified:
llvm/lib/Transforms/IPO/CMakeLists.txt
llvm/lib/Transforms/Scalar/CMakeLists.txt
Removed:
llvm/lib/Transforms/Scalar/FunctionSpecialization.cpp
################################################################################
diff --git a/llvm/lib/Transforms/IPO/CMakeLists.txt b/llvm/lib/Transforms/IPO/CMakeLists.txt
index 34788bc10f012..2392b13b33a0e 100644
--- a/llvm/lib/Transforms/IPO/CMakeLists.txt
+++ b/llvm/lib/Transforms/IPO/CMakeLists.txt
@@ -15,6 +15,7 @@ add_llvm_component_library(LLVMipo
ForceFunctionAttrs.cpp
FunctionAttrs.cpp
FunctionImport.cpp
+ FunctionSpecialization.cpp
GlobalDCE.cpp
GlobalOpt.cpp
GlobalSplit.cpp
diff --git a/llvm/lib/Transforms/Scalar/FunctionSpecialization.cpp b/llvm/lib/Transforms/IPO/FunctionSpecialization.cpp
similarity index 99%
rename from llvm/lib/Transforms/Scalar/FunctionSpecialization.cpp
rename to llvm/lib/Transforms/IPO/FunctionSpecialization.cpp
index 4639f416d78ad..0f6b135058166 100644
--- a/llvm/lib/Transforms/Scalar/FunctionSpecialization.cpp
+++ b/llvm/lib/Transforms/IPO/FunctionSpecialization.cpp
@@ -247,7 +247,7 @@ class FunctionSpecializer {
// Otherwise, set the specialization cost to be the cost of all the
// instructions in the function and penalty for specializing more functions.
- unsigned Penalty = (NumFuncSpecialized + 1);
+ unsigned Penalty = NumFuncSpecialized + 1;
return Metrics.NumInsts * InlineConstants::InstrCost * Penalty;
}
@@ -506,7 +506,6 @@ class FunctionSpecializer {
CallSitesToRewrite.push_back(&CS);
}
for (auto *CS : CallSitesToRewrite) {
-
if ((CS->getFunction() == Clone && CS->getArgOperand(ArgNo) == &Arg) ||
CS->getArgOperand(ArgNo) == C) {
CS->setCalledFunction(Clone);
diff --git a/llvm/lib/Transforms/Scalar/CMakeLists.txt b/llvm/lib/Transforms/Scalar/CMakeLists.txt
index 99ae122840eed..45619c4c3cd38 100644
--- a/llvm/lib/Transforms/Scalar/CMakeLists.txt
+++ b/llvm/lib/Transforms/Scalar/CMakeLists.txt
@@ -13,7 +13,6 @@ add_llvm_component_library(LLVMScalarOpts
EarlyCSE.cpp
FlattenCFGPass.cpp
Float2Int.cpp
- FunctionSpecialization.cpp
GuardWidening.cpp
GVN.cpp
GVNHoist.cpp
More information about the llvm-commits
mailing list