[all-commits] [llvm/llvm-project] 78b16c: [M68k] Instruction selection to choose neg x when ...

Douglas Chen via All-commits all-commits at lists.llvm.org
Thu Jun 2 22:20:55 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 78b16ccf2b5c4ba4ebd7f1e2a2fc1dcad0e1a343
      https://github.com/llvm/llvm-project/commit/78b16ccf2b5c4ba4ebd7f1e2a2fc1dcad0e1a343
  Author: Douglas Chen <dougpuob at gmail.com>
  Date:   2022-06-03 (Fri, 03 Jun 2022)

  Changed paths:
    M llvm/lib/Target/M68k/M68kISelDAGToDAG.cpp
    M llvm/test/CodeGen/M68k/Arith/imul-neg.ll

  Log Message:
  -----------
  [M68k] Instruction selection to choose neg x when mul x -1 (Fix issue 48588)

This patch is trying to fix issue 48588(https://github.com/llvm/llvm-project/issues/48588)

I found the results of Instruction Selection between SelectionDAG and FastISEL for the `%mul = mul i32 %A, 4294967295`:
(seldag-isel) mul --> sub --> SUB32dp
(fast-isel)   mul --> sub --> NEG32d

My patch to fix this issue is by overriding a virtual function M68kDAGToDAGISel::IsProfitableToFold(). Return `false` when it was trying to match with SUB, then it will match with NEG.

Reviewed By: myhsu

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




More information about the All-commits mailing list