From a8e003bdce815dac503c6b7b38c31bcd533ab9f0 Mon Sep 17 00:00:00 2001 From: Achille Roussel Date: Wed, 13 Dec 2023 22:43:43 -0800 Subject: [PATCH] only call ssautil.AllFunctions once Signed-off-by: Achille Roussel --- compiler/compile.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/compiler/compile.go b/compiler/compile.go index a380fac..a38c35d 100644 --- a/compiler/compile.go +++ b/compiler/compile.go @@ -117,11 +117,12 @@ func (c *compiler) compile(path string) error { c.prog.Build() log.Printf("building call graph") - cg := vta.CallGraph(ssautil.AllFunctions(c.prog), cha.CallGraph(c.prog)) + functions := ssautil.AllFunctions(c.prog) + cg := vta.CallGraph(functions, cha.CallGraph(c.prog)) log.Printf("collecting generic instances") c.generics = map[*ssa.Function][]*ssa.Function{} - for fn := range ssautil.AllFunctions(c.prog) { + for fn := range functions { if fn.Signature.TypeParams() != nil { if _, ok := c.generics[fn]; !ok { c.generics[fn] = nil