[all-commits] [llvm/llvm-project] 0dafeb: [GIsel] import `(not (add X, -1)) -> (neg X)` to G...

Luisa Cicolini via All-commits all-commits at lists.llvm.org
Thu Feb 19 12:15:22 PST 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 0dafeb97a4687c29f5182fa0239c7fa39ee23091
      https://github.com/llvm/llvm-project/commit/0dafeb97a4687c29f5182fa0239c7fa39ee23091
  Author: Luisa Cicolini <48860705+luisacicolini at users.noreply.github.com>
  Date:   2026-02-19 (Thu, 19 Feb 2026)

  Changed paths:
    M llvm/include/llvm/Target/GlobalISel/Combine.td
    M llvm/test/CodeGen/AArch64/GlobalISel/combine-add.mir
    M llvm/test/CodeGen/AArch64/GlobalISel/combine-addv.mir

  Log Message:
  -----------
  [GIsel] import `(not (add X, -1)) -> (neg X)` to GlobalISel (#181640)

We port the rewrite `(not (add X, -1)) -> (neg X)` from SelectionDAG to
GlobalISel. I contemplated adding a `G_NEG` primitive initially, but
given that the [SelectionDAG pattern rewrites to a
subtraction](https://github.com/llvm/llvm-project/blob/20aff2085c358d3e112b245494161ddb9ffe0410/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp#L1649),
I implemented the rhs of the rewrite as a subtraction directly,
specifying the comment accordingly.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list