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