Do not sink instruction, if it is not profitable.
authorDevang Patel <dpatel@apple.com>
Wed, 14 Dec 2011 23:20:38 +0000 (23:20 +0000)
committerDevang Patel <dpatel@apple.com>
Wed, 14 Dec 2011 23:20:38 +0000 (23:20 +0000)
commit5211134fbd35bf0befc60888860010b23c27ee5a
treeb4544143078d57fccbe59783eb43d6024f61bf42
parent28681863af743cb83a49d5e1aadb57ab52bc73e8
Do not sink instruction, if it is not profitable.

On ARM, peephole optimization for ABS creates a trivial cfg triangle which tempts machine sink to sink instructions in code which is really straight line code. Sometimes this sinking may alter register allocator input such that use and def of a reg is divided by a branch in between, which may result in extra spills. Now mahine sink avoids sinking if final sink destination is post dominator.

Radar 10266272.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@146604 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/MachineSink.cpp
test/CodeGen/ARM/2011-12-14-machine-sink.ll [new file with mode: 0644]