diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2022-07-04 19:20:19 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2023-02-08 19:02:26 +0000 |
commit | 81ad626541db97eb356e2c1d4a20eb2a26a766ab (patch) | |
tree | 311b6a8987c32b1e1dcbab65c54cfac3fdb56175 /contrib/llvm-project/llvm/lib/Analysis/CodeMetrics.cpp | |
parent | 5fff09660e06a66bed6482da9c70df328e16bbb6 (diff) | |
parent | 145449b1e420787bb99721a429341fa6be3adfb6 (diff) |
Diffstat (limited to 'contrib/llvm-project/llvm/lib/Analysis/CodeMetrics.cpp')
-rw-r--r-- | contrib/llvm-project/llvm/lib/Analysis/CodeMetrics.cpp | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/contrib/llvm-project/llvm/lib/Analysis/CodeMetrics.cpp b/contrib/llvm-project/llvm/lib/Analysis/CodeMetrics.cpp index 27c52506352f..6d9084215dee 100644 --- a/contrib/llvm-project/llvm/lib/Analysis/CodeMetrics.cpp +++ b/contrib/llvm-project/llvm/lib/Analysis/CodeMetrics.cpp @@ -15,7 +15,6 @@ #include "llvm/Analysis/AssumptionCache.h" #include "llvm/Analysis/LoopInfo.h" #include "llvm/Analysis/TargetTransformInfo.h" -#include "llvm/Analysis/ValueTracking.h" #include "llvm/IR/Function.h" #include "llvm/Support/Debug.h" #include "llvm/Support/InstructionCost.h" @@ -118,13 +117,6 @@ void CodeMetrics::analyzeBasicBlock( const BasicBlock *BB, const TargetTransformInfo &TTI, const SmallPtrSetImpl<const Value *> &EphValues, bool PrepareForLTO) { ++NumBlocks; - // Use a proxy variable for NumInsts of type InstructionCost, so that it can - // use InstructionCost's arithmetic properties such as saturation when this - // feature is added to InstructionCost. - // When storing the value back to NumInsts, we can assume all costs are Valid - // because the IR should not contain any nodes that cannot be costed. If that - // happens the cost-model is broken. - InstructionCost NumInstsProxy = NumInsts; InstructionCost NumInstsBeforeThisBB = NumInsts; for (const Instruction &I : *BB) { // Skip ephemeral values. @@ -184,8 +176,7 @@ void CodeMetrics::analyzeBasicBlock( if (InvI->cannotDuplicate()) notDuplicatable = true; - NumInstsProxy += TTI.getUserCost(&I, TargetTransformInfo::TCK_CodeSize); - NumInsts = *NumInstsProxy.getValue(); + NumInsts += TTI.getUserCost(&I, TargetTransformInfo::TCK_CodeSize); } if (isa<ReturnInst>(BB->getTerminator())) @@ -205,6 +196,6 @@ void CodeMetrics::analyzeBasicBlock( notDuplicatable |= isa<IndirectBrInst>(BB->getTerminator()); // Remember NumInsts for this BB. - InstructionCost NumInstsThisBB = NumInstsProxy - NumInstsBeforeThisBB; - NumBBInsts[BB] = *NumInstsThisBB.getValue(); + InstructionCost NumInstsThisBB = NumInsts - NumInstsBeforeThisBB; + NumBBInsts[BB] = NumInstsThisBB; } |