This includes a change in optimiser policy, such that optimising a
run-time error into a compile-time error is considered a bug (which
probably should have been the rule all along); the documentation was
inconsistent on this before now. This is also needed for the
testsuite to work with the optimiser.
The specific bugs: constant folding could make a mingle guaranteed
to overflow at runtime if the line was ever reached into a compile-
time error; and folding an and into an or was occasionally an
unchecked no-op, which causes the optimiser to enter an infinite
loop (it's now checked that it's not a no-op in advance).
Make sure that the optimizer doesn't change a statement from a run-time
error into something that silently succeeds@! Checking which bits can
and can't be 1 is one good way to avoid this, especially with mingles.
-(At present, there are some idioms that can turn run-time errors into
-compile-time errors, such as with the expression
-@code{''#65535$#65535'$#0'}; this could be avoided, but for the time
-being it isn't.)
+Likewise, don't optimise a run-time error into a compile-time error
+(although creating a compile-time warning in this situation is fine).
@item
You can help@! If you find an idiom that the optimizer isn't optimizing
; Constant folding
[minglefold]
-(#{1}1$#{1}2)->(#{mingle(x1,x2)}0)
+(#{x<=65535}1$#{x<=65535}2)->(#{mingle(x1,x2)}0)
[selectfold]
(#{1}1~#{1}2)->(#{iselect(x1,x2)}0)
[and32fold]
; Reducing constants inside a C or operation can help to recognize idioms
[cfoldintoorinand]
-(((_1) | #{1}2) & #{1}3)->(((_1) | #{x2 & x3}0) & _3)
+(((_1) | #{(x != x & x3)}2) & #{1}3)->(((_1) | #{x2 & x3}0) & _3)
; Binary bitwise optimizations
[cbinand]