[llvm] [X86] Fold ADC(SHL(X, 1), 0, Carry) to ADC(X, X, Carry) (PR #219512)

via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 28 09:32:43 PDT 2026


================
@@ -254,17 +254,15 @@ define i32 @adc_shl(i32 %a, i32 %b) {
 ; X86-LABEL: adc_shl:
 ; X86:       # %bb.0:
 ; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
-; X86-NEXT:    addl %eax, %eax
 ; X86-NEXT:    cmpl $70, {{[0-9]+}}(%esp)
-; X86-NEXT:    adcl $0, %eax
+; X86-NEXT:    adcl %eax, %eax
 ; X86-NEXT:    retl
 ;
 ; X64-LABEL: adc_shl:
 ; X64:       # %bb.0:
-; X64-NEXT:    # kill: def $edi killed $edi def $rdi
-; X64-NEXT:    leal (%rdi,%rdi), %eax
+; X64-NEXT:    movl %edi, %eax
 ; X64-NEXT:    cmpl $70, %esi
-; X64-NEXT:    adcl $0, %eax
+; X64-NEXT:    adcl %edi, %eax
----------------
AZero13 wrote:

Because the function has to return the result in the %eax register.

https://github.com/llvm/llvm-project/pull/219512


More information about the llvm-commits mailing list