Index: lib/CodeGen/RegisterPressure.cpp =================================================================== --- lib/CodeGen/RegisterPressure.cpp +++ lib/CodeGen/RegisterPressure.cpp @@ -681,8 +681,7 @@ PressureDiff::iterator J; for (J = std::next(I); J != E && J->isValid(); ++J, ++I) *I = *J; - if (J != E) - *I = *J; + *I = PressureChange(); } } } Index: test/CodeGen/X86/divrem.ll =================================================================== --- test/CodeGen/X86/divrem.ll +++ test/CodeGen/X86/divrem.ll @@ -57,11 +57,11 @@ ; X32-LABEL: si32: ; X32: # %bb.0: ; X32-NEXT: pushl %esi -; X32-NEXT: movl {{[0-9]+}}(%esp), %ecx -; X32-NEXT: movl {{[0-9]+}}(%esp), %esi ; X32-NEXT: movl {{[0-9]+}}(%esp), %eax ; X32-NEXT: cltd ; X32-NEXT: idivl {{[0-9]+}}(%esp) +; X32-NEXT: movl {{[0-9]+}}(%esp), %ecx +; X32-NEXT: movl {{[0-9]+}}(%esp), %esi ; X32-NEXT: movl %eax, (%esi) ; X32-NEXT: movl %edx, (%ecx) ; X32-NEXT: popl %esi @@ -87,11 +87,11 @@ ; X32-LABEL: si16: ; X32: # %bb.0: ; X32-NEXT: pushl %esi -; X32-NEXT: movl {{[0-9]+}}(%esp), %ecx -; X32-NEXT: movl {{[0-9]+}}(%esp), %esi ; X32-NEXT: movzwl {{[0-9]+}}(%esp), %eax ; X32-NEXT: cwtd ; X32-NEXT: idivw {{[0-9]+}}(%esp) +; X32-NEXT: movl {{[0-9]+}}(%esp), %ecx +; X32-NEXT: movl {{[0-9]+}}(%esp), %esi ; X32-NEXT: movw %ax, (%esi) ; X32-NEXT: movw %dx, (%ecx) ; X32-NEXT: popl %esi @@ -118,11 +118,11 @@ ; X32-LABEL: si8: ; X32: # %bb.0: ; X32-NEXT: pushl %ebx -; X32-NEXT: movl {{[0-9]+}}(%esp), %ecx -; X32-NEXT: movl {{[0-9]+}}(%esp), %edx ; X32-NEXT: movb {{[0-9]+}}(%esp), %al ; X32-NEXT: cbtw ; X32-NEXT: idivb {{[0-9]+}}(%esp) +; X32-NEXT: movl {{[0-9]+}}(%esp), %ecx +; X32-NEXT: movl {{[0-9]+}}(%esp), %edx ; X32-NEXT: movsbl %ah, %ebx ; X32-NEXT: movb %al, (%edx) ; X32-NEXT: movb %bl, (%ecx) @@ -201,11 +201,11 @@ ; X32-LABEL: ui32: ; X32: # %bb.0: ; X32-NEXT: pushl %esi -; X32-NEXT: movl {{[0-9]+}}(%esp), %ecx -; X32-NEXT: movl {{[0-9]+}}(%esp), %esi ; X32-NEXT: movl {{[0-9]+}}(%esp), %eax ; X32-NEXT: xorl %edx, %edx ; X32-NEXT: divl {{[0-9]+}}(%esp) +; X32-NEXT: movl {{[0-9]+}}(%esp), %ecx +; X32-NEXT: movl {{[0-9]+}}(%esp), %esi ; X32-NEXT: movl %eax, (%esi) ; X32-NEXT: movl %edx, (%ecx) ; X32-NEXT: popl %esi @@ -231,11 +231,11 @@ ; X32-LABEL: ui16: ; X32: # %bb.0: ; X32-NEXT: pushl %esi -; X32-NEXT: movl {{[0-9]+}}(%esp), %ecx -; X32-NEXT: movl {{[0-9]+}}(%esp), %esi ; X32-NEXT: movzwl {{[0-9]+}}(%esp), %eax ; X32-NEXT: xorl %edx, %edx ; X32-NEXT: divw {{[0-9]+}}(%esp) +; X32-NEXT: movl {{[0-9]+}}(%esp), %ecx +; X32-NEXT: movl {{[0-9]+}}(%esp), %esi ; X32-NEXT: movw %ax, (%esi) ; X32-NEXT: movw %dx, (%ecx) ; X32-NEXT: popl %esi @@ -262,11 +262,11 @@ ; X32-LABEL: ui8: ; X32: # %bb.0: ; X32-NEXT: pushl %ebx -; X32-NEXT: movl {{[0-9]+}}(%esp), %ecx -; X32-NEXT: movl {{[0-9]+}}(%esp), %edx ; X32-NEXT: movzbl {{[0-9]+}}(%esp), %eax ; X32-NEXT: # kill: def $eax killed $eax def $ax ; X32-NEXT: divb {{[0-9]+}}(%esp) +; X32-NEXT: movl {{[0-9]+}}(%esp), %ecx +; X32-NEXT: movl {{[0-9]+}}(%esp), %edx ; X32-NEXT: movzbl %ah, %ebx ; X32-NEXT: movb %al, (%edx) ; X32-NEXT: movb %bl, (%ecx) Index: test/CodeGen/X86/divrem8_ext.ll =================================================================== --- test/CodeGen/X86/divrem8_ext.ll +++ test/CodeGen/X86/divrem8_ext.ll @@ -152,8 +152,8 @@ ; X32-LABEL: test_srem_noext_ah: ; X32: # %bb.0: ; X32-NEXT: movb {{[0-9]+}}(%esp), %al -; X32-NEXT: movb {{[0-9]+}}(%esp), %cl ; X32-NEXT: cbtw +; X32-NEXT: movb {{[0-9]+}}(%esp), %cl ; X32-NEXT: idivb %cl ; X32-NEXT: movsbl %ah, %eax ; X32-NEXT: addb %cl, %al Index: test/CodeGen/X86/musttail-varargs.ll =================================================================== --- test/CodeGen/X86/musttail-varargs.ll +++ test/CodeGen/X86/musttail-varargs.ll @@ -83,6 +83,7 @@ ; LINUX-NEXT: movq %rbp, %rdx ; LINUX-NEXT: movq %r13, %rcx ; LINUX-NEXT: movq %r12, %r8 +; LINUX-NEXT: movb {{[-0-9]+}}(%r{{[sb]}}p), %al # 1-byte Reload ; LINUX-NEXT: movq %r15, %r9 ; LINUX-NEXT: movaps {{[-0-9]+}}(%r{{[sb]}}p), %xmm0 # 16-byte Reload ; LINUX-NEXT: movaps {{[-0-9]+}}(%r{{[sb]}}p), %xmm1 # 16-byte Reload @@ -92,7 +93,6 @@ ; LINUX-NEXT: movaps {{[-0-9]+}}(%r{{[sb]}}p), %xmm5 # 16-byte Reload ; LINUX-NEXT: movaps {{[-0-9]+}}(%r{{[sb]}}p), %xmm6 # 16-byte Reload ; LINUX-NEXT: movaps {{[-0-9]+}}(%r{{[sb]}}p), %xmm7 # 16-byte Reload -; LINUX-NEXT: movb {{[-0-9]+}}(%r{{[sb]}}p), %al # 1-byte Reload ; LINUX-NEXT: addq $360, %rsp # imm = 0x168 ; LINUX-NEXT: .cfi_def_cfa_offset 56 ; LINUX-NEXT: popq %rbx @@ -177,6 +177,7 @@ ; LINUX-X32-NEXT: movq %rbp, %rdx ; LINUX-X32-NEXT: movq %r13, %rcx ; LINUX-X32-NEXT: movq %r12, %r8 +; LINUX-X32-NEXT: movb {{[-0-9]+}}(%e{{[sb]}}p), %al # 1-byte Reload ; LINUX-X32-NEXT: movq %r15, %r9 ; LINUX-X32-NEXT: movaps {{[-0-9]+}}(%e{{[sb]}}p), %xmm0 # 16-byte Reload ; LINUX-X32-NEXT: movaps {{[-0-9]+}}(%e{{[sb]}}p), %xmm1 # 16-byte Reload @@ -186,7 +187,6 @@ ; LINUX-X32-NEXT: movaps {{[-0-9]+}}(%e{{[sb]}}p), %xmm5 # 16-byte Reload ; LINUX-X32-NEXT: movaps {{[-0-9]+}}(%e{{[sb]}}p), %xmm6 # 16-byte Reload ; LINUX-X32-NEXT: movaps {{[-0-9]+}}(%e{{[sb]}}p), %xmm7 # 16-byte Reload -; LINUX-X32-NEXT: movb {{[-0-9]+}}(%e{{[sb]}}p), %al # 1-byte Reload ; LINUX-X32-NEXT: addl $344, %esp # imm = 0x158 ; LINUX-X32-NEXT: .cfi_def_cfa_offset 56 ; LINUX-X32-NEXT: popq %rbx Index: test/CodeGen/X86/pr38539.ll =================================================================== --- test/CodeGen/X86/pr38539.ll +++ test/CodeGen/X86/pr38539.ll @@ -18,15 +18,15 @@ ; X64-NEXT: .cfi_offset %r14, -24 ; X64-NEXT: .cfi_offset %rbp, -16 ; X64-NEXT: movzbl {{[0-9]+}}(%rsp), %ebp -; X64-NEXT: movq %rbp, %rcx -; X64-NEXT: shlq $62, %rcx -; X64-NEXT: sarq $62, %rcx ; X64-NEXT: movq (%rsp), %rbx ; X64-NEXT: movb (%rax), %al ; X64-NEXT: movzbl %al, %eax ; X64-NEXT: # kill: def $eax killed $eax def $ax ; X64-NEXT: divb (%rax) ; X64-NEXT: movl %eax, %r14d +; X64-NEXT: movq %rbp, %rcx +; X64-NEXT: shlq $62, %rcx +; X64-NEXT: sarq $62, %rcx ; X64-NEXT: xorl %edi, %edi ; X64-NEXT: xorl %esi, %esi ; X64-NEXT: movq %rbx, %rdx @@ -86,11 +86,6 @@ ; X86-NEXT: .cfi_offset %edi, -16 ; X86-NEXT: .cfi_offset %ebx, -12 ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %esi -; X86-NEXT: movl %esi, %ecx -; X86-NEXT: shll $30, %ecx -; X86-NEXT: movl %ecx, %edx -; X86-NEXT: sarl $30, %edx -; X86-NEXT: sarl $31, %ecx ; X86-NEXT: movl {{[0-9]+}}(%esp), %edi ; X86-NEXT: movl {{[0-9]+}}(%esp), %ebx ; X86-NEXT: movb (%eax), %al @@ -98,16 +93,21 @@ ; X86-NEXT: # kill: def $eax killed $eax def $ax ; X86-NEXT: divb (%eax) ; X86-NEXT: movb %al, {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Spill -; X86-NEXT: leal {{[0-9]+}}(%esp), %eax +; X86-NEXT: movl %esi, %eax +; X86-NEXT: shll $30, %eax +; X86-NEXT: movl %eax, %ecx +; X86-NEXT: sarl $30, %ecx +; X86-NEXT: sarl $31, %eax +; X86-NEXT: leal {{[0-9]+}}(%esp), %edx +; X86-NEXT: pushl %eax ; X86-NEXT: pushl %ecx -; X86-NEXT: pushl %edx ; X86-NEXT: pushl %ebx ; X86-NEXT: pushl %edi ; X86-NEXT: pushl $0 ; X86-NEXT: pushl $0 ; X86-NEXT: pushl $0 ; X86-NEXT: pushl $0 -; X86-NEXT: pushl %eax +; X86-NEXT: pushl %edx ; X86-NEXT: calll __modti3 ; X86-NEXT: addl $32, %esp ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax @@ -239,16 +239,16 @@ ; X86-NEXT: .cfi_offset %edi, -16 ; X86-NEXT: .cfi_offset %ebx, -12 ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %esi -; X86-NEXT: movl %esi, %ecx -; X86-NEXT: shll $30, %ecx -; X86-NEXT: sarl $30, %ecx ; X86-NEXT: movl (%esp), %edi ; X86-NEXT: movb (%eax), %al ; X86-NEXT: movzbl %al, %eax ; X86-NEXT: # kill: def $eax killed $eax def $ax ; X86-NEXT: divb (%eax) ; X86-NEXT: movl %eax, %ebx -; X86-NEXT: pushl %ecx +; X86-NEXT: movl %esi, %eax +; X86-NEXT: shll $30, %eax +; X86-NEXT: sarl $30, %eax +; X86-NEXT: pushl %eax ; X86-NEXT: pushl %edi ; X86-NEXT: pushl $0 ; X86-NEXT: pushl $0