[llvm] [X86] Fold an LEA into a following memory operand's addressing mode (PR #221863)

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 9 03:23:38 PDT 2026


================
@@ -268,6 +281,40 @@ bool FixupLEAsImpl::runOnMachineFunction(MachineFunction &MF) {
     }
   }
 
+  // Fold each LEA whose only use is the base register of the immediately
+  // following memory instruction into that instruction's addressing mode,
+  // deleting the LEA:
+  //
+  //     lea  rax, [rdi + rdx*4]        movl (%rdi,%rdx,4), %eax
+  //     mov  eax, [rax]          -->
----------------
RKSimon wrote:

chose one asm syntax :) 

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


More information about the llvm-commits mailing list