This is a succeeding patch for https://reviews.llvm.org/D22840 to address the issue when a value to be merged into an int64 pair is in a different BB. The issue was originally described here: http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20160912/390582.html (Sorry to delay the patch for a long time, because I took a long vacation).
The fix is to redo the store splitting in CodeGenPrepare, so we can match the pattern across multiple BBs or move some instructions into the same BB.
The patch changing the target query interface was put separately here: https://reviews.llvm.org/D24707
This looks wrong. Shouldn't it be getTypeStoreSizeInBits instead of getTypeSizeInBits?