[globalisel][combines] Don't sink G_TRUNC down to use if that use is a G_PHI
authorDaniel Sanders <daniel_l_sanders@apple.com>
Wed, 3 Oct 2018 15:43:39 +0000 (15:43 +0000)
committerDaniel Sanders <daniel_l_sanders@apple.com>
Wed, 3 Oct 2018 15:43:39 +0000 (15:43 +0000)
commitfb9b99b26e984f0f03b8535dae9116fbc549c035
tree4a5e2ffa5768183eca9771ea8da7655b36e8f5d9
parent79dceb2903f8b6ad049b763922843dca26c6aa05
[globalisel][combines] Don't sink G_TRUNC down to use if that use is a G_PHI

This fixes a problem where the register allocator fails to eliminate a PHI
because there's a non-PHI in the middle of the PHI instructions at the start
of a BB.

This G_TRUNC can be better placed but this at least fixes the correctness issue
quickly. I'll follow up with a patch to the verifier to catch this kind of bug
in future.

llvm-svn: 343693
llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp
llvm/test/CodeGen/AArch64/GlobalISel/prelegalizercombiner-extending-loads-cornercases.mir [new file with mode: 0644]