luau/CodeGen
Arseny Kapoulkine 434c8f2c42 CodeGen: Optimize arithmetics for basic multiplicative identities
This change folds:

	a * 1 => a
	a / 1 => a
	a * -1 => -a
	a / -1 => -a
	a * 2 => a + a
	a / 2^k => a * 2^-k

Note that the following folds are all invalid:

	a + 0 => a (breaks for negative zero)
	a - (-0) => a (breaks for negative zero)
	a - a => 0 (breaks for NaN)

a - 0 could be folded into a but that doesn't happen in benchmarks.

Various cases of UNM_NUM could be optimized (eg (-a) * (-b) = a * b),
but that doesn't happen in benchmarks either.
2024-11-26 21:03:32 +09:00
..
include Sync to upstream/release/653 (#1541) 2024-11-22 13:00:51 -08:00
src CodeGen: Optimize arithmetics for basic multiplicative identities 2024-11-26 21:03:32 +09:00