diff options
author | Yingwei Zheng <dtcxzyw2333@gmail.com> | 2025-04-03 14:47:47 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-04-03 14:47:47 +0800 |
commit | b6c0ce0bb67d822fac1e3b42461f66c261c1157c (patch) | |
tree | cb19a11893f4a43ecb1cbbf7676c262251c3144b /llvm/lib/Analysis/InlineCost.cpp | |
parent | 3295970d846b0d820b863f9eeac559b80239297e (diff) | |
download | llvm-b6c0ce0bb67d822fac1e3b42461f66c261c1157c.zip llvm-b6c0ce0bb67d822fac1e3b42461f66c261c1157c.tar.gz llvm-b6c0ce0bb67d822fac1e3b42461f66c261c1157c.tar.bz2 |
[IR][NFC] Use `SwitchInst::defaultDestUnreachable` (#134199)
Diffstat (limited to 'llvm/lib/Analysis/InlineCost.cpp')
-rw-r--r-- | llvm/lib/Analysis/InlineCost.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/llvm/lib/Analysis/InlineCost.cpp b/llvm/lib/Analysis/InlineCost.cpp index 9f193b6..30e1af6 100644 --- a/llvm/lib/Analysis/InlineCost.cpp +++ b/llvm/lib/Analysis/InlineCost.cpp @@ -344,7 +344,7 @@ protected: /// Called at the end of processing a switch instruction, with the given /// number of case clusters. virtual void onFinalizeSwitch(unsigned JumpTableSize, unsigned NumCaseCluster, - bool DefaultDestUndefined) {} + bool DefaultDestUnreachable) {} /// Called to account for any other instruction not specifically accounted /// for. @@ -722,14 +722,14 @@ class InlineCostCallAnalyzer final : public CallAnalyzer { } void onFinalizeSwitch(unsigned JumpTableSize, unsigned NumCaseCluster, - bool DefaultDestUndefined) override { + bool DefaultDestUnreachable) override { // If suitable for a jump table, consider the cost for the table size and // branch to destination. // Maximum valid cost increased in this function. if (JumpTableSize) { // Suppose a default branch includes one compare and one conditional // branch if it's reachable. - if (!DefaultDestUndefined) + if (!DefaultDestUnreachable) addCost(2 * InstrCost); // Suppose a jump table requires one load and one jump instruction. int64_t JTCost = @@ -742,7 +742,7 @@ class InlineCostCallAnalyzer final : public CallAnalyzer { // Suppose a comparison includes one compare and one conditional branch. // We can reduce a set of instructions if the default branch is // undefined. - addCost((NumCaseCluster - DefaultDestUndefined) * 2 * InstrCost); + addCost((NumCaseCluster - DefaultDestUnreachable) * 2 * InstrCost); return; } @@ -1268,9 +1268,9 @@ private: } void onFinalizeSwitch(unsigned JumpTableSize, unsigned NumCaseCluster, - bool DefaultDestUndefined) override { + bool DefaultDestUnreachable) override { if (JumpTableSize) { - if (!DefaultDestUndefined) + if (!DefaultDestUnreachable) increment(InlineCostFeatureIndex::switch_default_dest_penalty, SwitchDefaultDestCostMultiplier * InstrCost); int64_t JTCost = static_cast<int64_t>(JumpTableSize) * InstrCost + @@ -1281,7 +1281,7 @@ private: if (NumCaseCluster <= 3) { increment(InlineCostFeatureIndex::case_cluster_penalty, - (NumCaseCluster - DefaultDestUndefined) * + (NumCaseCluster - DefaultDestUnreachable) * CaseClusterCostMultiplier * InstrCost); return; } @@ -2508,7 +2508,7 @@ bool CallAnalyzer::visitSwitchInst(SwitchInst &SI) { unsigned NumCaseCluster = TTI.getEstimatedNumberOfCaseClusters(SI, JumpTableSize, PSI, BFI); - onFinalizeSwitch(JumpTableSize, NumCaseCluster, SI.defaultDestUndefined()); + onFinalizeSwitch(JumpTableSize, NumCaseCluster, SI.defaultDestUnreachable()); return false; } |