Do not delete code of functions marked for zero-alloc check#1378
Do not delete code of functions marked for zero-alloc check#1378mshinwell merged 1 commit intooxcaml:mainfrom
Conversation
Gbury
left a comment
There was a problem hiding this comment.
Looks fine to me, but I'm not very knowledgeable about simplify_set_of_closures.ml so another review for that file might be useful.
At the moment, there is a special flag |
This PR should now handle that correctly. |
it works! I tested it on a bunch of functions that previously failed the check with Warning 199. Now they either pass or fail as expected. would it be hard to do the same for flambda? |
It's not trivial with flambda1, because while flambda2 has actual functions stored separately from closures, in flambda1 they are stored together. So if we keep unused functions annotated with let[@zero_alloc] f x =
let[@zero_alloc][@inline] g y = x + y in
g 1If we keep |
makes sense, thanks. |
9f083c7 to
9c46b05
Compare
lthls
left a comment
There was a problem hiding this comment.
Approving the changes in simplify_set_of_closures.ml
This should fix #1273. It currently only works for Flambda 2. @gretay-js could you please test to see if this suffices?
Here is an interesting example to try:
What should happen for the annotation to check the zero-alloc property for all functions in a file? Do all functions in
Lambdaend up annotated with attributes as normal, or does a different flag need to be tested?