mypy
mypy copied to clipboard
[mypyc] Generate faster code for bool comparisons and arithmetic
Generate specialized, efficient IR for various operations on bools. These are covered:
- Bool comparisons
- Mixed bool/integer comparisons
- Bool arithmetic (binary and unary)
- Mixed bool/integer arithmetic and bitwise ops
Mixed operations where the left operand is a bool and the right operand is a native int still have some unnecessary conversions between native int and int. This would be a bit trickier to fix and is seems rare, so it doesn't seem urgent to fix this.
Fixes mypyc/mypyc#968.