Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Avoid optimization that beam_validator might consider unsafe
Eliminating a repeated `=:=` test can result in code that beam_validator doesn't consider safe. This commit makes the optimization keep the `=:=` if it seems to be significant, that is, if one or both operands will gain type information from it. That makes it possible to compile code from erlang#6599 such as: f(X, X) when is_integer(X) -> ok; f(Y, Y = #{}) -> Y#{ok := ok}. (Seven other examples from erlang#6599 can now also be compiled.) Running `scripts/diffable` shows that this fix prevented the optimization in 14 modules (out of about 1000).
- Loading branch information