| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
This change also implements 2 optimizations Removes code that is conservatively widening empty use into [UseGeneral] Adds cleanDead which attempts to clean whatever that is not needed keeping only the effectful code needed.
Extract the BeginLoop handling in doClean into a shared cleanBeginLoop called by both doClean and cleanDead.
Uses the same logic in doClean case, lifted out to cleanEval. This requires adding support for UseApply([], args) to cleanLambda
Structural refactor only. Replace the per-scope state that cleanProc captured implicitly through its closure with a context instead.
|
@dcjm supposing you approve of this changes I don't mind running a full build of HOL building all the examples + CakeML proofs to test this before you merge this change. |
Sorry, something went wrong.
|
Another side note @dcjm I suspect the dead argument removal in this pass, RemoveRedundant is potentially buggy. polyml/mlsource/MLCompiler/CodeTree/CodetreeRemoveRedundant.ML Lines 347 to 394 in d615dad Consider you have (arg1,arg2,arg3) where all the args are effectful and arg2 is dead. The effect of arg2 would be executed before arg1. I don't think it's buggy rn because there's isn't any inlining so args for Loops are always locals/ args /closures etc. but could be a potential bug. I haven't tried to fix this potential bug in this PR. |
Sorry, something went wrong.
|
I suspect for the potential bug highlighted above should be done in the optimizer anyway since this doesn't do the detupling of loop args too. |
Sorry, something went wrong.
|
I might get rid of d48249d I tried implementing the TODO i added here and it seems like extending removeRedundant with a more precise liveness analysis is hard and going to be inefficient compared to a additional liveness analysis pass |
Sorry, something went wrong.
fun k (a,b) = a + b; fun f g x = k (let fun r y = y in r (g x handle e => (r 0; raise e)) end); This raises an internal error |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Improves the DCE focusing on handling the case when codeUse = [].