peter.smith added a comment. I've committed https://reviews.llvm.org/D52594 and https://reviews.llvm.org/D52595. I can't abandon this revision as I didn't start it, but logically this review is closed. https://reviews.llvm.org/D18086