[GlobalISel] Fix insertion point of new instructions to be after PHIs.
authorAmara Emerson <aemerson@apple.com>
Fri, 13 Sep 2019 21:49:24 +0000 (21:49 +0000)
committerAmara Emerson <aemerson@apple.com>
Fri, 13 Sep 2019 21:49:24 +0000 (21:49 +0000)
commit02bcc86b08dc1f50be401240307d6819483ca822
tree739d9cd180facdc9940fa1c8d845d0aaafb958b6
parentaa89c5ffc30f5a45f3766b8e787a4deb38741e94
[GlobalISel] Fix insertion point of new instructions to be after PHIs.

For some reason we sometimes insert new instructions one instruction before
the first non-PHI when legalizing. This can result in having non-PHI
instructions before PHIs, which mean that PHI elimination doesn't catch them.

Differential Revision: https://reviews.llvm.org/D67570

llvm-svn: 371901
llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp
llvm/test/CodeGen/AArch64/GlobalISel/legalize-phi.mir
llvm/test/CodeGen/AMDGPU/GlobalISel/legalize-phi.mir