[X86] Handle COPYs of physregs better (regalloc hints)

Enable enableMultipleCopyHints() on X86.

Original Patch by @jonpa:

While enabling the mischeduler for SystemZ, it was discovered that for some reason a test needed one extra seemingly needless COPY (test/CodeGen/SystemZ/call-03.ll). The handling for that is resulted in this patch, which improves the register coalescing by providing not just one copy hint, but a sorted list of copy hints. On SystemZ, this gives ~12500 less register moves on SPEC, as well as marginally less spilling.

Instead of improving just the SystemZ backend, the improvement has been implemented in common-code (calculateSpillWeightAndHint(). This gives a lot of test failures, but since this should be a general improvement I hope that the involved targets will help and review the test updates.

Differential Revision: https://reviews.llvm.org/D38128

llvm-svn: 342578
diff --git a/llvm/test/CodeGen/X86/sat-add.ll b/llvm/test/CodeGen/X86/sat-add.ll
index 8265a55..5b667d8 100644
--- a/llvm/test/CodeGen/X86/sat-add.ll
+++ b/llvm/test/CodeGen/X86/sat-add.ll
@@ -10,13 +10,14 @@
 define i8 @unsigned_sat_constant_i8_using_min(i8 %x) {
 ; ANY-LABEL: unsigned_sat_constant_i8_using_min:
 ; ANY:       # %bb.0:
-; ANY-NEXT:    cmpb $-43, %dil
+; ANY-NEXT:    movl %edi, %eax
+; ANY-NEXT:    cmpb $-43, %al
 ; ANY-NEXT:    jb .LBB0_2
 ; ANY-NEXT:  # %bb.1:
-; ANY-NEXT:    movb $-43, %dil
+; ANY-NEXT:    movb $-43, %al
 ; ANY-NEXT:  .LBB0_2:
-; ANY-NEXT:    addb $42, %dil
-; ANY-NEXT:    movl %edi, %eax
+; ANY-NEXT:    addb $42, %al
+; ANY-NEXT:    # kill: def $al killed $al killed $eax
 ; ANY-NEXT:    retq
   %c = icmp ult i8 %x, -43
   %s = select i1 %c, i8 %x, i8 -43
@@ -190,15 +191,16 @@
 define i8 @unsigned_sat_variable_i8_using_min(i8 %x, i8 %y) {
 ; ANY-LABEL: unsigned_sat_variable_i8_using_min:
 ; ANY:       # %bb.0:
-; ANY-NEXT:    movl %esi, %eax
-; ANY-NEXT:    notb %al
-; ANY-NEXT:    cmpb %al, %dil
+; ANY-NEXT:    movl %edi, %eax
+; ANY-NEXT:    movl %esi, %ecx
+; ANY-NEXT:    notb %cl
+; ANY-NEXT:    cmpb %cl, %al
 ; ANY-NEXT:    jb .LBB12_2
 ; ANY-NEXT:  # %bb.1:
-; ANY-NEXT:    movl %eax, %edi
+; ANY-NEXT:    movl %ecx, %eax
 ; ANY-NEXT:  .LBB12_2:
-; ANY-NEXT:    addb %sil, %dil
-; ANY-NEXT:    movl %edi, %eax
+; ANY-NEXT:    addb %sil, %al
+; ANY-NEXT:    # kill: def $al killed $al killed $eax
 ; ANY-NEXT:    retq
   %noty = xor i8 %y, -1
   %c = icmp ult i8 %x, %noty