Disable InstNamer in lowering unless we're emitting textual llvm IR (#7878)

`InstNamer` takes O(N^2) time to resolve N colliding inst names, so it
should be limited to textual dumps (where we can presumably prioritize
readability over performance). Without this change, compiling 200,000
destructor calls took hours. With this change, compiling 1,000,000
destructor calls takes about 30 seconds.
This commit is contained in:
Geoff Romer
2026-10-01 00:10:11 +00:00
committed by GitHub
parent c0bd9606de
commit fd9200ebc3
3 changed files with 12 additions and 4 deletions
+2
View File
@@ -191,6 +191,8 @@ auto CompilationUnit::RunLower() -> void {
options.vlog_stream = vlog_stream_;
options.opt_level = options_->opt_level;
options.mangle_string_fingerprint = options_->mangle_string_fingerprint;
// Only generate inst names if the llvm IR needs to be human-readable.
options.generate_inst_names = options_->dump_llvm_ir;
module_ = Lower::LowerToLLVM(*llvm_context_, driver_env_->fs,
cache_->tree_and_subtrees_getters(), *sem_ir_,
total_ir_count_, options);