Frank Denis c49e4d534f
Improve and remove duplicate doNotOptimizeAway() implementations (#13790)
* Improve and remove duplicate doNotOptimizeAway() implementations

We currently have two doNotOptimizeAway() implementations, one in
std.math and the other one in std.mem.

Maybe we should deprecate one. In the meantime, the std.math one
now just calls the std.mem one.

In a comptime environment, just ignore the value. Previously,
std.mem.doNotOptimizeAway() did not work at comptime.

If the value fits in a CPU register, just tell the compiler we
need that value to be computed, without clobbering anything else.

Only clobber all possibly escaped memory on pointers or large arrays.

Add tests by the way since we didn't had any (we had, but only
indirect ones).
2022-12-09 18:22:50 +01:00
..
2022-12-06 12:15:05 -07:00
2022-10-30 01:09:31 -07:00
2022-11-30 15:42:59 -07:00
2022-10-06 21:22:20 +03:00
2022-11-04 00:09:27 +03:30
2022-12-06 12:15:05 -07:00
2022-01-07 00:06:06 -05:00
2022-12-06 12:27:28 -07:00
2022-09-11 23:18:43 -04:00
2022-11-04 00:09:27 +03:30
2022-11-23 19:17:58 +01:00
2022-11-04 00:09:27 +03:30
2022-04-15 17:01:01 -05:00
2022-11-18 19:22:42 +00:00