[all-commits] [llvm/llvm-project] 0b00cd: [X86] selectLEAAddr - relax heuristic to only requ...

Simon Pilgrim via All-commits all-commits at lists.llvm.org
Tue Feb 8 07:09:43 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 0b00cd19e6f3ec168b9930f235bafd5e00253dbf
      https://github.com/llvm/llvm-project/commit/0b00cd19e6f3ec168b9930f235bafd5e00253dbf
  Author: Simon Pilgrim <llvm-dev at redking.me.uk>
  Date:   2022-02-08 (Tue, 08 Feb 2022)

  Changed paths:
    M llvm/lib/Target/X86/X86ISelDAGToDAG.cpp
    M llvm/test/CodeGen/X86/combine-add.ll
    M llvm/test/CodeGen/X86/select-lea.ll

  Log Message:
  -----------
  [X86] selectLEAAddr - relax heuristic to only require one operand to be a MathWithFlags op (PR46809)

As suggested by @craig.topper, relaxing LEA matching to only require the ADD to be fed from a single op with EFLAGS helps avoid duplication when the EFLAGS are consumed in a later, dependent instruction.

There was some concern about whether the heuristic is too simple, not taking into account lost loads that can't fold by using a LEA, but some basic tests (included in select-lea.ll) don't suggest that's really a problem.

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




More information about the All-commits mailing list