Reduce the size of formatted SemIR. (#4534)

- Do not include entities imported from files that we are not dumping.
- Do not include constants and import_refs that are not referenced by
something that we are including in the formatted output.

---------

Co-authored-by: Jon Ross-Perkins <jperkins@google.com>
Co-authored-by: Carbon Infra Bot <carbon-external-infra@google.com>
This commit is contained in:
Richard Smith
2024-11-15 21:00:26 +00:00
committed by GitHub
co-authored by Jon Ross-Perkins Carbon Infra Bot
parent 3c18a6c477
commit 4ee65ef58a
557 changed files with 319 additions and 11200 deletions
@@ -31,19 +31,13 @@ fn TestOp(a: C) -> C {
// CHECK:STDOUT: %.1: type = struct_type {} [template]
// CHECK:STDOUT: %.2: <witness> = complete_type_witness %.1 [template]
// CHECK:STDOUT: %BitComplement.type: type = facet_type <@BitComplement> [template]
// CHECK:STDOUT: %Self: %BitComplement.type = bind_symbolic_name Self, 0 [symbolic]
// CHECK:STDOUT: %Op.type.1: type = fn_type @Op.1 [template]
// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [template]
// CHECK:STDOUT: %Op.1: %Op.type.1 = struct_value () [template]
// CHECK:STDOUT: %Op.type.2: type = fn_type @Op.2 [template]
// CHECK:STDOUT: %Op.2: %Op.type.2 = struct_value () [template]
// CHECK:STDOUT: %.3: <witness> = interface_witness (%Op.1) [template]
// CHECK:STDOUT: %.4: type = ptr_type %.1 [template]
// CHECK:STDOUT: %struct: %C = struct_value () [template]
// CHECK:STDOUT: %TestOp.type: type = fn_type @TestOp [template]
// CHECK:STDOUT: %TestOp: %TestOp.type = struct_value () [template]
// CHECK:STDOUT: %.5: type = assoc_entity_type %BitComplement.type, %Op.type.2 [template]
// CHECK:STDOUT: %.6: %.5 = assoc_entity element0, imports.%import_ref.5 [template]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: imports {
@@ -53,10 +47,6 @@ fn TestOp(a: C) -> C {
// CHECK:STDOUT: import Core//prelude/...
// CHECK:STDOUT: }
// CHECK:STDOUT: %import_ref.1: type = import_ref Core//prelude/operators/bitwise, inst+1, loaded [template = constants.%BitComplement.type]
// CHECK:STDOUT: %import_ref.2 = import_ref Core//prelude/operators/bitwise, inst+3, unloaded
// CHECK:STDOUT: %import_ref.3: %.5 = import_ref Core//prelude/operators/bitwise, inst+25, loaded [template = constants.%.6]
// CHECK:STDOUT: %import_ref.4: %Op.type.2 = import_ref Core//prelude/operators/bitwise, inst+19, loaded [template = constants.%Op.2]
// CHECK:STDOUT: %import_ref.5 = import_ref Core//prelude/operators/bitwise, inst+19, unloaded
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: file {
@@ -87,13 +77,6 @@ fn TestOp(a: C) -> C {
// CHECK:STDOUT: }
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: interface @BitComplement {
// CHECK:STDOUT: !members:
// CHECK:STDOUT: .Self = imports.%import_ref.2
// CHECK:STDOUT: .Op = imports.%import_ref.3
// CHECK:STDOUT: witness = (imports.%import_ref.4)
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: impl @impl: %C.ref as %BitComplement.ref {
// CHECK:STDOUT: %Op.decl: %Op.type.1 = fn_decl @Op.1 [template = constants.%Op.1] {
// CHECK:STDOUT: %self.patt: %C = binding_pattern self
@@ -130,12 +113,6 @@ fn TestOp(a: C) -> C {
// CHECK:STDOUT: return %.loc19_14 to %return
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: generic fn @Op.2(constants.%Self: %BitComplement.type) {
// CHECK:STDOUT: %Self: %BitComplement.type = bind_symbolic_name Self, 0 [symbolic = %Self (constants.%Self)]
// CHECK:STDOUT:
// CHECK:STDOUT: fn[%self.param_patt: @Op.2.%Self (%Self)]() -> @Op.2.%Self (%Self);
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @TestOp(%a.param_patt: %C) -> %return: %C {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %a.ref: %C = name_ref a, %a
@@ -146,11 +123,3 @@ fn TestOp(a: C) -> C {
// CHECK:STDOUT: return %Op.call to %return
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: specific @Op.2(constants.%Self) {
// CHECK:STDOUT: %Self => constants.%Self
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: specific @Op.2(constants.%C) {
// CHECK:STDOUT: %Self => constants.%C
// CHECK:STDOUT: }
// CHECK:STDOUT: