This refactoring is done to remove flakyness as described in https://github.com/llvm/llvm-project/pull/89083.