Merge "Revert "Use DoNotOptimize rather than rely on a volatile."" into main