Backport an LLVM fix to close #9117