https://github.com/artagnon commented: I had a similar patch at https://github.com/llvm/llvm-project/pull/162340, but @fhahn pointed out the regression. I now see your follow-up, and probably we can merge that with tweaks? https://github.com/llvm/llvm-project/pull/143552