llvm-6502/lib
Quentin Colombet dcd3cbea54 [PeepholeOptimizer] Refactor the advanced copy optimization to take advantage of
the isRegSequence property.

This is a follow-up of r215394 and r215404, which respectively introduces the
isRegSequence property and uses it for ARM.

Thanks to the property introduced by the previous commits, this patch is able
to optimize the following sequence:
vmov	d0, r2, r3
vmov	d1, r0, r1
vmov	r0, s0
vmov	r1, s2
udiv	r0, r1, r0
vmov	r1, s1
vmov	r2, s3
udiv	r1, r2, r1
vmov.32	d16[0], r0
vmov.32	d16[1], r1
vmov	r0, r1, d16
bx	lr

into:
udiv	r0, r0, r2
udiv	r1, r1, r3
vmov.32	d16[0], r0
vmov.32	d16[1], r1
vmov	r0, r1, d16
bx	lr

This patch refactors how the copy optimizations are done in the peephole
optimizer. Prior to this patch, we had one copy-related optimization that
replaced a copy or bitcast by a generic, more suitable (in terms of register
file), copy.

With this patch, the peephole optimizer features two copy-related optimizations:
1. One for rewriting generic copies to generic copies:
PeepholeOptimizer::optimizeCoalescableCopy.
2. One for replacing non-generic copies with generic copies:
PeepholeOptimizer::optimizeUncoalescableCopy.

The goals of these two optimizations are slightly different: one rewrite the
operand of the instruction (#1), the other kills off the non-generic instruction
and replace it by a (sequence of) generic instruction(s).

Both optimizations rely on the ValueTracker introduced in r212100.

The ValueTracker has been refactored to use the information from the
TargetInstrInfo for non-generic instruction. As part of the refactoring, we
switched the tracking from the index of the definition to the actual register
(virtual or physical). This one change is to provide better consistency with
register related APIs and to ease the use of the TargetInstrInfo.

Moreover, this patch introduces a new helper class CopyRewriter used to ease the
rewriting of generic copies (i.e., #1).

Finally, this patch adds a dead code elimination pass right after the peephole
optimizer to get rid of dead code that may appear after rewriting.

This is related to <rdar://problem/12702965>.

Review: http://reviews.llvm.org/D4874


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216088 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-20 17:41:48 +00:00
..
Analysis Answer to Philip Reames comments 2014-08-18 22:18:14 +00:00
AsmParser Split parseAssembly into parseAssembly and parseAssemblyInto. 2014-08-19 22:05:47 +00:00
Bitcode BitcodeReader: Only create one basic block for each blockaddress 2014-08-16 01:54:37 +00:00
CodeGen [PeepholeOptimizer] Refactor the advanced copy optimization to take advantage of 2014-08-20 17:41:48 +00:00
DebugInfo Don't own the buffer in object::Binary. 2014-08-19 18:44:46 +00:00
ExecutionEngine [MCJIT] Allow '$' characters in symbol names in RuntimeDyldChecker. 2014-08-19 20:04:45 +00:00
IR IR: Implement uselistorder assembly directives 2014-08-19 21:30:15 +00:00
IRReader Modernize the .ll parsing interface. 2014-08-19 16:58:54 +00:00
LineEditor
Linker Set comdats when lazily linking functions. 2014-08-15 20:17:08 +00:00
LTO Silencing a -Wcast-qual warning. NFC. 2014-08-20 12:54:13 +00:00
MC Remove unused field. 2014-08-20 17:33:44 +00:00
Object Fix a pair of use after free. Should bring the bots back. 2014-08-19 18:59:14 +00:00
Option [Option] Support MultiArg in --help 2014-08-15 21:35:07 +00:00
ProfileData Don't own the buffer in object::Binary. 2014-08-19 18:44:46 +00:00
Support Fix an off by 1 bug that prevented SmallPtrSet from using all of its 'small' capacity. Then fix the early return in the move constructor that prevented 'small' moves from clearing the NumElements in the moved from object. The directed test missed this because it was always testing large moves due to the off by 1 bug. 2014-08-20 04:41:36 +00:00
TableGen Canonicalize header guards into a common format. 2014-08-13 16:26:38 +00:00
Target [FastISel][AArch64] Don't fold the sign-/zero-extend from i1 into the compare. 2014-08-20 16:34:15 +00:00
Transforms InstCombine: Annotate sub with nuw when we prove it's safe 2014-08-20 07:17:31 +00:00
CMakeLists.txt ProfileData: Introduce the InstrProfReader interface and a text reader 2014-03-21 17:24:48 +00:00
LLVMBuild.txt ProfileData: Introduce the InstrProfReader interface and a text reader 2014-03-21 17:24:48 +00:00
Makefile ProfileData: Introduce the InstrProfReader interface and a text reader 2014-03-21 17:24:48 +00:00