This is a sub issue for https://github.com/llvm/clangir/issues/589. I think it's similar to https://github.com/llvm/clangir/pull/942. I'll try to implement it these days.