Cherry pick https://github.com/llvm/llvm-project/commit/38f34e587d10fcd7d18fd240e41248006faa639e (#11034)
Cherry pick https://github.com/llvm/llvm-project/commit/38f34e587d10fcd7d18fd240e41248006faa639e (#11034)

Fixes #10839
iree-org/iree,iree-org/iree,iree-org/iree,google/iree,google/iree,iree-org/iree,google/iree,iree-org/iree,google/iree,iree-org/iree,google/iree,google/iree,google/iree,iree-org/iree