Skip to content

Commit

Permalink
only call ssautil.AllFunctions once (#130)
Browse files Browse the repository at this point in the history
Not very impactful but we're recomputing the same result twice for no
reasons.
  • Loading branch information
achille-roussel authored Dec 14, 2023
2 parents 83d5568 + adf8dc8 commit b379c8b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions compiler/compile.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b379c8b

Please sign in to comment.