[globalisel][combine] Improve the truncate placement for the extending-loads combine

This brings the extending loads patch back to the original intent but minus the
PHI bug and with another small improvement to de-dupe truncates that are
inserted into the same block.

The truncates are sunk to their uses unless this would require inserting before a
phi in which case it sinks to the _beginning_ of the predecessor block for that
path (but no earlier than the def).

The reason for choosing the beginning of the predecessor is that it makes de-duping
multiple truncates in the same block simple, and optimized code is going to run a
scheduler at some point which will likely change the position anyway.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@343804 91177308-0d34-0410-b5e6-96231b3b80d8
3 files changed