/cherry-pick https://github.com/phoebewang/llvm-project/commit/7210a98061d9f6382e8ce4ca7646ec4a5c3f96e6