Added a late machine instruction copy propagation pass. This catches
authorEvan Cheng <evan.cheng@apple.com>
Sat, 7 Jan 2012 03:02:36 +0000 (03:02 +0000)
committerEvan Cheng <evan.cheng@apple.com>
Sat, 7 Jan 2012 03:02:36 +0000 (03:02 +0000)
commit977679d6034791fd48a344e5b990503ba50fc242
treea53e7c18e92d71fe32a7df3f76f4231433bc08eb
parentccec74738d0fc34f4bc2ac6909324e62705f1c38
Added a late machine instruction copy propagation pass. This catches
opportunities that only present themselves after late optimizations
such as tail duplication .e.g.
## BB#1:
        movl    %eax, %ecx
        movl    %ecx, %eax
        ret

The register allocator also leaves some of them around (due to false
dep between copies from phi-elimination, etc.)

This required some changes in codegen passes. Post-ra scheduler and the
pseudo-instruction expansion passes have been moved after branch folding
and tail merging. They were before branch folding before because it did
not always update block livein's. That's fixed now. The pass change makes
independently since we want to properly schedule instructions after
branch folding / tail duplication.

rdar://10428165
rdar://10640363

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147716 91177308-0d34-0410-b5e6-96231b3b80d8
13 files changed:
include/llvm/CodeGen/Passes.h
include/llvm/InitializePasses.h
lib/CodeGen/AggressiveAntiDepBreaker.cpp
lib/CodeGen/BranchFolding.cpp
lib/CodeGen/CMakeLists.txt
lib/CodeGen/CriticalAntiDepBreaker.cpp
lib/CodeGen/LLVMTargetMachine.cpp
lib/CodeGen/MachineCopyPropagation.cpp [new file with mode: 0644]
lib/CodeGen/RegisterScavenging.cpp
lib/CodeGen/ScheduleDAGInstrs.cpp
lib/CodeGen/ScheduleDAGInstrs.h
test/CodeGen/ARM/code-placement.ll
test/CodeGen/X86/machine-cp.ll [new file with mode: 0644]