diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2022-07-28 18:40:30 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2022-07-29 02:35:06 -0700 |
| commit | 1fc24e8d807a489254be46c9fcb951617a04f3b1 (patch) | |
| tree | 48ffbbb3cc12c3234e1c242f146dd2c9ecb5eca7 /src/Module.zig | |
| parent | a48251735787f590491caf4e446dad74c66aa13c (diff) | |
| download | zig-1fc24e8d807a489254be46c9fcb951617a04f3b1.tar.gz zig-1fc24e8d807a489254be46c9fcb951617a04f3b1.zip | |
Sema: enhance `div` instruction analysis
Concrete improvements:
* Added safety for integer overflow (-MAX_INT/-1)
* Omit division by zero safety check when RHS is comptime known to
be non-zero.
* Avoid emitting `_optimized` variants of AIR instructions for integers
(this suffix is intended to be used for floats only).
Subjective changes: I extracted the div logic out from analyzeArithmetic
in order to reduce the amount of branches - not for performance reasons
but for code clarity. It is more lines of code however, and some logic
is duplicated.
Diffstat (limited to 'src/Module.zig')
0 files changed, 0 insertions, 0 deletions
