[all-commits] [llvm/llvm-project] a35add: [MIPS] Correct the implementation of the msub opti...

sdardis via All-commits all-commits at lists.llvm.org
Thu May 12 14:33:42 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: a35add4c54be96a42fefc01ae1d74a23e3c16030
      https://github.com/llvm/llvm-project/commit/a35add4c54be96a42fefc01ae1d74a23e3c16030
  Author: Simon Dardis <simon.dardis at gmail.com>
  Date:   2022-05-12 (Thu, 12 May 2022)

  Changed paths:
    M llvm/lib/Target/Mips/MipsISelLowering.cpp
    M llvm/test/CodeGen/Mips/madd-msub.ll

  Log Message:
  -----------
  [MIPS] Correct the implementation of the msub optimization

The MIPS backend attempts to combine integer multiply and addition or
subtraction into a madd or msub operation. This optimization is
heavily restricted due to its utility in many cases.

PR/51114 highlighted that the optimization was performed on an
associative basis which is correct in the `add` case but not in
the `sub` case.

Resolve this bug by performing an early exit in the case where the
multiply is the LHS operand of the subtraction.

This resolves PR/51114.

Thanks to digitalseraphim for reporting the issue!

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




More information about the All-commits mailing list