Like many other targets did. And see RISCV for similar fix. Fix https://github.com/llvm/llvm-project/issues/143239
The optimization level should not be restored into O2.