[PATCH] D77762: [llvm][nfc] InstructionCostDetail encapsulation
Mircea Trofin via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 16 11:08:54 PDT 2020
mtrofin marked an inline comment as done.
mtrofin added inline comments.
================
Comment at: llvm/lib/Analysis/InlineCost.cpp:731-732
// when we decided to give a bonus at a particular instruction.
- OS << "; cost before = " << CostThresholdMap[I].CostBefore <<
- ", cost after = " << CostThresholdMap[I].CostAfter <<
- ", threshold before = " << CostThresholdMap[I].ThresholdBefore <<
- ", threshold after = " << CostThresholdMap[I].ThresholdAfter <<
- ", ";
- OS << "cost delta = " << CostThresholdMap[I].CostAfter -
- CostThresholdMap[I].CostBefore;
- if (CostThresholdMap[I].ThresholdAfter != CostThresholdMap[I].ThresholdBefore)
- OS << ", threshold delta = " << CostThresholdMap[I].ThresholdAfter -
- CostThresholdMap[I].ThresholdBefore;
+ assert(CostThresholdMap.count(I) > 0 &&
+ "Expected each instruction to have an instruction annotation");
+ const auto &Record = CostThresholdMap[I];
----------------
apilipenko wrote:
> It's possible that we don't analyze all instructions. The analysis can stop early if we exceed the threshold. The original code had a problem with this scenario as well.
>
> We just need to have an early exit.
Can you share the repro, so we can add a regression test as well?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D77762/new/
https://reviews.llvm.org/D77762
More information about the llvm-commits
mailing list