chore: make inferVisibility LCNF pass style match others (#9558)

This commit is contained in:
Cameron Zwarich 2025-07-25 17:49:52 -07:00 committed by GitHub
parent 737105fd78
commit aa769e7677
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 13 additions and 17 deletions

View file

@ -64,14 +64,6 @@ def saveMono : Pass where
return decl
shouldAlwaysRunCheck := true
def inferVisibility (phase : Phase) : Pass where
occurrence := 0
phase
name := `inferVisibility
run decls := do
LCNF.inferVisibility phase decls
return decls
end Pass
open Pass
@ -99,7 +91,7 @@ def builtinPassManager : PassManager := {
saveBase, -- End of base phase
-- should come last so it can see all created decls
-- pass must be run for each phase; see `base/monoTransparentDeclsExt`
Pass.inferVisibility .base,
inferVisibility (phase := .base),
toMono,
simp (occurrence := 3) (phase := .mono),
reduceJpArity (phase := .mono),
@ -116,7 +108,7 @@ def builtinPassManager : PassManager := {
simp (occurrence := 5) (phase := .mono),
cse (occurrence := 2) (phase := .mono),
saveMono, -- End of mono phase
Pass.inferVisibility .mono,
inferVisibility (phase := .mono),
extractClosed,
]
}

View file

@ -51,13 +51,17 @@ partial def markDeclPublicRec (phase : Phase) (decl : Decl) : CompilerM Unit :=
trace[Compiler.inferVisibility] m!"Marking {ref} as opaque because it is used by transparent {decl.name}"
markDeclPublicRec phase refDecl
def inferVisibility (phase : Phase) (decls : Array Decl) : CompilerM Unit := do
if !(← getEnv).header.isModule then
return
for decl in decls do
if (← getEnv).setExporting true |>.contains decl.name then
trace[Compiler.inferVisibility] m!"Marking {decl.name} as opaque because it is a public def"
markDeclPublicRec phase decl
def inferVisibility (phase : Phase) : Pass where
occurrence := 0
phase
name := `inferVisibility
run decls := do
if (← getEnv).header.isModule then
for decl in decls do
if (← getEnv).setExporting true |>.contains decl.name then
trace[Compiler.inferVisibility] m!"Marking {decl.name} as opaque because it is a public def"
markDeclPublicRec phase decl
return decls
builtin_initialize
registerTraceClass `Compiler.inferVisibility