You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
bugc: the optimizer's fixpoint loop compares JSON that leaves out every block #386
optimizeIr (packages/bugc/src/optimizer/simple-optimizer.ts) repeats the pipeline at -O2 and up "until fixpoint", and it compares rounds by JSON.stringify(current). But a function's blocks are a Map, and so is module.functions, and JSON.stringify writes a Map as {}. The comparison does not see the code at all.
Counting the rounds (a counter in the loop), every program I tried at -O3 runs exactly two: the first round changes something outside the Maps, the second does not, and the loop stops. Whether the second round changed the code, and whether a third would, makes no difference.
So the passes run twice, not to a fixpoint. An optimization that needs a third round (one pass's result enabling another's, two rounds down) does not happen. And tests that count on the fixpoint may test less than they say.
A fix is to compare something that includes the blocks: for example, a serialization that writes Maps as entries, or a "changed" flag from each pass.
Activity