Index: llvm/lib/Analysis/InlineCost.cpp =================================================================== --- llvm/lib/Analysis/InlineCost.cpp +++ llvm/lib/Analysis/InlineCost.cpp @@ -732,8 +732,10 @@ // The cost of inlining of the given instruction is printed always. // The threshold delta is printed only when it is non-zero. It happens // when we decided to give a bonus at a particular instruction. - assert(CostThresholdMap.count(I) > 0 && - "Expected each instruction to have an instruction annotation"); + if (CostThresholdMap.count(I) == 0) { + OS << "; No analysis for the instruction\n"; + return ; + } const auto &Record = CostThresholdMap[I]; OS << "; cost before = " << Record.CostBefore << ", cost after = " << Record.CostAfter Index: llvm/test/Transforms/Inline/print-instructions-deltas-unfinished.ll =================================================================== --- /dev/null +++ llvm/test/Transforms/Inline/print-instructions-deltas-unfinished.ll @@ -0,0 +1,16 @@ +; RUN: opt < %s -inline -debug-only=inline-cost -disable-output -print-instruction-deltas -inline-threshold=0 2>&1 | FileCheck %s + +; CHECK: No analysis for the instruction +; CHECK: ret void + +declare void @callee1() + +define void @bar() { + call void @callee1() + ret void +} + +define void @foo() { + call void @bar() + ret void +}