This fixes a miscompile in the presence of reserved registers. This is not a regression though (the bug was already present in 3.9) however the fix is simple and low risk.
To code owner for 4.0 branch review.
Approved by mail (see llvm-commits).
NFC commit r294630 for preparation, actual change cherry picked to r294631