[llvm] bfc6d8b - [NFC][SimplifyCFG] Formatting and variable rename
Sam Parker via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 21 05:11:33 PDT 2020
Author: Sam Parker
Date: 2020-08-21T13:11:17+01:00
New Revision: bfc6d8b59b7b3f736f43ba16666c1f7ed9c780e4
URL: https://github.com/llvm/llvm-project/commit/bfc6d8b59b7b3f736f43ba16666c1f7ed9c780e4
DIFF: https://github.com/llvm/llvm-project/commit/bfc6d8b59b7b3f736f43ba16666c1f7ed9c780e4.diff
LOG: [NFC][SimplifyCFG] Formatting and variable rename
Added:
Modified:
llvm/lib/Transforms/Utils/SimplifyCFG.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
index 1f9e73f02cfd..2e41ccce2ab9 100644
--- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
+++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
@@ -2043,22 +2043,23 @@ bool SimplifyCFGOpt::SpeculativelyExecuteBB(BranchInst *BI, BasicBlock *ThenBB,
BasicBlock *EndBB = ThenBB->getTerminator()->getSuccessor(0);
TargetTransformInfo::TargetCostKind CostKind =
- BI->getFunction()->hasMinSize() ?
- TargetTransformInfo::TCK_CodeSize :
- TargetTransformInfo::TCK_SizeAndLatency;
+ BI->getFunction()->hasMinSize()
+ ? TargetTransformInfo::TCK_CodeSize
+ : TargetTransformInfo::TCK_SizeAndLatency;
// Check how expensive it will be to insert the necessary selects.
- unsigned CostOfSelects = 0;
+ int BudgetRemaining =
+ PHINodeFoldingThreshold * TargetTransformInfo::TCC_Basic;
for (PHINode &PN : EndBB->phis()) {
unsigned OrigI = PN.getBasicBlockIndex(BB);
unsigned ThenI = PN.getBasicBlockIndex(ThenBB);
Value *OrigV = PN.getIncomingValue(OrigI);
Value *ThenV = PN.getIncomingValue(ThenI);
if (OrigV != ThenV)
- CostOfSelects +=
+ BudgetRemaining -=
TTI.getCmpSelInstrCost(Instruction::Select, PN.getType(), nullptr,
CostKind);
}
- if (CostOfSelects > PHINodeFoldingThreshold * TargetTransformInfo::TCC_Basic)
+ if (BudgetRemaining < 0)
return false;
// If ThenBB is actually on the false edge of the conditional branch, remember
More information about the llvm-commits
mailing list