Skip to content

Commit

Permalink
* added const-folding+dealiasing optimization
Browse files Browse the repository at this point in the history
* fixed tiny bug in const-folding that made it run run in O(N^2) time instead of O(N)
  • Loading branch information
vpisarev committed Mar 21, 2021
1 parent cdb9483 commit f3b0f5d
Show file tree
Hide file tree
Showing 3 changed files with 484 additions and 4 deletions.
6 changes: 3 additions & 3 deletions compiler/Compiler.fx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import Filename, Sys, Map
import Ast, AstPP, Lexer, Parser, Options
import AstTypeChecker
import KForm, KPP, KNormalize, KAnnotate, KMangle
import KRemoveUnused, KLiftSimple, KFlatten, KTailRec, KLift
import KRemoveUnused, KLiftSimple, KFlatten, KTailRec, KConstFold, KLift

exception CumulativeParseError

Expand Down Expand Up @@ -163,8 +163,8 @@ fun k_optimize_all(kmods: kmodule_t list): (kmodule_t list, bool) {
//temp_kmods = KFuseLoops.fuse_loops_all(temp_kmods)
//prf("fast idx")
//temp_kmods = KFastIdx.optimize_idx_checks_all(temp_kmods)
//prf("const folding")
//temp_kmods = KConstFold.cfold_dealias(temp_kmods)
prf("const folding")
temp_kmods = KConstFold.cfold_dealias(temp_kmods)
prf("dead code elim")
temp_kmods = KRemoveUnused.remove_unused(temp_kmods, false)
}
Expand Down
Loading

0 comments on commit f3b0f5d

Please sign in to comment.