mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-04 15:51:04 +01:00
Some trivial check-phase inlining. (#4362)
When profiling, these jumped out as good inline candidates that happened to be out-of-line, this just moves them inline so that they're available. I think as much as 10% improvement in check-phase from this, but I haven't run detailed before/after measurements as these changes seemed minimally disruptive. Also switched from `CHECK` to `DCHECK` in one place that seems especially hot and where the check itself seems reasonable to only do in debug builds. Left a comment since we rarely need to remove these any more.
This commit is contained in:
@@ -150,20 +150,6 @@ auto Context::CheckCompatibleImportedNodeKind(
|
||||
kind, imported_kind);
|
||||
}
|
||||
|
||||
auto Context::AddInstInNoBlock(SemIR::LocIdAndInst loc_id_and_inst)
|
||||
-> SemIR::InstId {
|
||||
auto inst_id = sem_ir().insts().AddInNoBlock(loc_id_and_inst);
|
||||
CARBON_VLOG("AddInst: {0}\n", loc_id_and_inst.inst);
|
||||
FinishInst(inst_id, loc_id_and_inst.inst);
|
||||
return inst_id;
|
||||
}
|
||||
|
||||
auto Context::AddInst(SemIR::LocIdAndInst loc_id_and_inst) -> SemIR::InstId {
|
||||
auto inst_id = AddInstInNoBlock(loc_id_and_inst);
|
||||
inst_block_stack_.AddInstId(inst_id);
|
||||
return inst_id;
|
||||
}
|
||||
|
||||
auto Context::AddPlaceholderInstInNoBlock(SemIR::LocIdAndInst loc_id_and_inst)
|
||||
-> SemIR::InstId {
|
||||
auto inst_id = sem_ir().insts().AddInNoBlock(loc_id_and_inst);
|
||||
@@ -179,20 +165,6 @@ auto Context::AddPlaceholderInst(SemIR::LocIdAndInst loc_id_and_inst)
|
||||
return inst_id;
|
||||
}
|
||||
|
||||
auto Context::AddPatternInst(SemIR::LocIdAndInst loc_id_and_inst)
|
||||
-> SemIR::InstId {
|
||||
auto inst_id = AddInstInNoBlock(loc_id_and_inst);
|
||||
pattern_block_stack_.AddInstId(inst_id);
|
||||
return inst_id;
|
||||
}
|
||||
|
||||
auto Context::AddConstant(SemIR::Inst inst, bool is_symbolic)
|
||||
-> SemIR::ConstantId {
|
||||
auto const_id = constants().GetOrAdd(inst, is_symbolic);
|
||||
CARBON_VLOG("AddConstant: {0}\n", inst);
|
||||
return const_id;
|
||||
}
|
||||
|
||||
auto Context::ReplaceLocIdAndInstBeforeConstantUse(
|
||||
SemIR::InstId inst_id, SemIR::LocIdAndInst loc_id_and_inst) -> void {
|
||||
sem_ir().insts().SetLocIdAndInst(inst_id, loc_id_and_inst);
|
||||
|
||||
Reference in New Issue
Block a user