llvm-project
0dafeb97 - [GIsel] import `(not (add X, -1)) -> (neg X)` to GlobalISel (#181640)

Commit
35 days ago
[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.
Author
Parents
Loading