Reapply with r182909 with a fix to the calculation of the new indices for
insertelement instructions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182976 91177308-0d34-0410-b5e6-96231b3b80d8
Fix wrong comment. Null is not acceptable.

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