[PATCH] D101970: [X86FixupLEAs] Transform the sequence LEA/SUB to SUB/SUB

Guozhi Wei via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 14 14:40:23 PDT 2021


Carrot added a comment.

Thanks for the test case!
The problem is:

  -- Before transformation
    renamable $esi = LEA64_32r renamable $rcx, 1, renamable $rcx, 0, $noreg
    renamable $edi = LEA64_32r renamable $rcx, 2, renamable $rcx, 0, $noreg
    $eax = MOV32rr $ecx, implicit killed $rcx                                                               // $rcx is killed at here 
    renamable $eax = SUB32rr killed renamable $eax(tied-def 0), killed renamable $esi, implicit-def dead $eflags
  
  -- After transformation
    renamable $edi = LEA64_32r renamable $rcx, 2, renamable $rcx, 0, $noreg
    $eax = MOV32rr $ecx, implicit killed $rcx                                                               // $rcx should not be killed at here
    $eax = SUB32rr $eax(tied-def 0), $ecx, implicit-def dead $eflags
    $eax = SUB32rr $eax(tied-def 0), $ecx, implicit-def dead $eflags                         // $rcx should be killed at here

The transformation may extend the life range of original BaseReg and IndexReg like $rcx in this test case, so the original kill flag should be cleared, and new kill flag should be added in new instruction.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D101970/new/

https://reviews.llvm.org/D101970



More information about the llvm-commits mailing list