During PHI elimination, split critical edges that move copies out of loops.
authorDaniel Jasper <djasper@google.com>
Tue, 3 Mar 2015 10:23:11 +0000 (10:23 +0000)
committerDaniel Jasper <djasper@google.com>
Tue, 3 Mar 2015 10:23:11 +0000 (10:23 +0000)
commitbbaf4fd14c6aa79bf63572e0d1a4d2f7abe9f407
treec595c576aa77b9b1fc25930561403e2f170e2dbb
parent21d54658312f2e83c8f55db64963ac1b0c95fcc9
During PHI elimination, split critical edges that move copies out of loops.

This prevents the behavior observed in llvm.org/PR22369. I am not sure
whether I am reading the code correctly, but the early exit based on
isLiveOutPastPHIs() seems to make the wrong assumption that
RegisterCoalescer won't be able to coalesce those copies later.

This change hides the new behavior behind -no-phi-elim-live-out-early-exit
as it currently breaks four tests:
 * Assertion in:
     CodeGen/Hexagon/hwloop-cleanup.ll
 * Worse code in:
     CodeGen/X86/coalescer-commute4.ll
     CodeGen/X86/phys_subreg_coalesce-2.ll
     CodeGen/X86/zlib-longest-match.ll
   The root cause here seems to be that the heuristic that determines
   the visitation order in RegisterCoalescer gets less lucky.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@231064 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/PHIElimination.cpp
test/CodeGen/X86/phielim-split.ll