Split loop exiting edges more aggressively.
authorJakob Stoklund Olesen <stoklund@2pi.dk>
Fri, 20 Jul 2012 20:49:53 +0000 (20:49 +0000)
committerJakob Stoklund Olesen <stoklund@2pi.dk>
Fri, 20 Jul 2012 20:49:53 +0000 (20:49 +0000)
commitc321a20b2e250a755bd06f36d896d00d9fd396ad
treeaa1d4f77549e271874c4c217414b2e40a699d5a3
parentbb3c4fab45689162ac319bb2eeeb2bafa035ae31
Split loop exiting edges more aggressively.

PHIElimination splits critical edges when it predicts it can resolve
interference and eliminate copies. It doesn't split the edge if the
interference wouldn't be resolved anyway because the phi-use register is
live in the critical edge anyway.

Teach PHIElimination to split loop exiting edges with interference, even
if it wouldn't resolve the interference. This removes the necessary
copies from the loop, which is still an improvement from injecting the
copies into the loop.

The test case demonstrates the improvement. Before:

LBB0_1:
  cmpb  $0, (%rdx)
  leaq  1(%rdx), %rdx
  movl  %esi, %eax
  je  LBB0_1

After:

LBB0_1:
  cmpb  $0, (%rdx)
  leaq  1(%rdx), %rdx
  je  LBB0_1

  movl  %esi, %eax

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160571 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/PHIElimination.cpp
test/CodeGen/X86/phielim-split.ll [new file with mode: 0644]