Allow MachineCSE to coalesce trivial subregister copies the same way
authorAndrew Trick <atrick@apple.com>
Mon, 16 Dec 2013 19:36:21 +0000 (19:36 +0000)
committerAndrew Trick <atrick@apple.com>
Mon, 16 Dec 2013 19:36:21 +0000 (19:36 +0000)
commitb961a26cec1e7b7b96edc200ef8d09fc12c11088
treee2f6dc4804d7c618b50746a266e9b1e606aef016
parent86d28968fda14c884dc5bdebb9d0bd5b416f136f
Allow MachineCSE to coalesce trivial subregister copies the same way
that it coalesces normal copies.

Without this, MachineCSE is powerless to handle redundant operations
with truncated source operands.

This required fixing the 2-addr pass to handle tied subregisters. It
isn't clear what combinations of subregisters can legally be tied, but
the simple case of truncated source operands is now safely handled:

     %vreg11<def> = COPY %vreg1:sub_32bit; GR32:%vreg11 GR64:%vreg1
     %vreg12<def> = COPY %vreg2:sub_32bit; GR32:%vreg12 GR64:%vreg2
     %vreg13<def,tied1> = ADD32rr %vreg11<tied0>, %vreg12<kill>, %EFLAGS<imp-def>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197414 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/MachineCSE.cpp
lib/CodeGen/TwoAddressInstructionPass.cpp
test/CodeGen/X86/cmov.ll
test/CodeGen/X86/cse-add-with-overflow.ll [new file with mode: 0644]