Implement support for using modeling implicit-zero-extension on x86-64
authorDan Gohman <gohman@apple.com>
Wed, 8 Apr 2009 00:15:30 +0000 (00:15 +0000)
committerDan Gohman <gohman@apple.com>
Wed, 8 Apr 2009 00:15:30 +0000 (00:15 +0000)
commit97121ba2afb8d566ff1bf5c4e8fc5d4077940a7f
treeb530d1fd94181f009f5d7ff1d760c88336a67def
parenta49a671efe24aa6e2e9e2280cf714ef97a40f177
Implement support for using modeling implicit-zero-extension on x86-64
with SUBREG_TO_REG, teach SimpleRegisterCoalescing to coalesce
SUBREG_TO_REG instructions (which are similar to INSERT_SUBREG
instructions), and teach the DAGCombiner to take advantage of this on
targets which support it. This eliminates many redundant
zero-extension operations on x86-64.

This adds a new TargetLowering hook, isZExtFree. It's similar to
isTruncateFree, except it only applies to actual definitions, and not
no-op truncates which may not zero the high bits.

Also, this adds a new optimization to SimplifyDemandedBits: transform
operations like x+y into (zext (add (trunc x), (trunc y))) on targets
where all the casts are no-ops. In contexts where the high part of the
add is explicitly masked off, this allows the mask operation to be
eliminated. Fix the DAGCombiner to avoid undoing these transformations
to eliminate casts on targets where the casts are no-ops.

Also, this adds a new two-address lowering heuristic. Since
two-address lowering runs before coalescing, it helps to be able to
look through copies when deciding whether commuting and/or
three-address conversion are profitable.

Also, fix a bug in LiveInterval::MergeInClobberRanges. It didn't handle
the case that a clobber range extended both before and beyond an
existing live range. In that case, multiple live ranges need to be
added. This was exposed by the new subreg coalescing code.

Remove 2008-05-06-SpillerBug.ll. It was bugpoint-reduced, and the
spiller behavior it was looking for no longer occurrs with the new
instruction selection.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68576 91177308-0d34-0410-b5e6-96231b3b80d8
19 files changed:
include/llvm/Target/TargetLowering.h
lib/CodeGen/LiveInterval.cpp
lib/CodeGen/LiveIntervalAnalysis.cpp
lib/CodeGen/SelectionDAG/DAGCombiner.cpp
lib/CodeGen/SelectionDAG/TargetLowering.cpp
lib/CodeGen/SimpleRegisterCoalescing.cpp
lib/CodeGen/TwoAddressInstructionPass.cpp
lib/Target/X86/X86ISelLowering.cpp
lib/Target/X86/X86ISelLowering.h
lib/Target/X86/X86Instr64bit.td
test/CodeGen/X86/2008-05-06-SpillerBug.ll [deleted file]
test/CodeGen/X86/byval7.ll
test/CodeGen/X86/iv-users-in-other-loops.ll
test/CodeGen/X86/subreg-to-reg-1.ll
test/CodeGen/X86/subreg-to-reg-3.ll [new file with mode: 0644]
test/CodeGen/X86/subreg-to-reg-4.ll [new file with mode: 0644]
test/CodeGen/X86/subreg-to-reg-5.ll [new file with mode: 0644]
test/CodeGen/X86/subreg-to-reg-6.ll [new file with mode: 0644]
test/CodeGen/X86/twoaddr-coalesce.ll