[all-commits] [llvm/llvm-project] 4a24c6: [DAGCombiner] Fold (or (seteq X, 0), (seteq X, -1)...

Jim Lin via All-commits all-commits at lists.llvm.org
Wed Apr 15 17:45:09 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 4a24c685fe4433e86c1022c7fd0b5d5fa3c40e18
      https://github.com/llvm/llvm-project/commit/4a24c685fe4433e86c1022c7fd0b5d5fa3c40e18
  Author: Jim Lin <jim at andestech.com>
  Date:   2026-04-16 (Thu, 16 Apr 2026)

  Changed paths:
    M llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
    M llvm/test/CodeGen/ARM/setcc-logic.ll

  Log Message:
  -----------
  [DAGCombiner] Fold (or (seteq X, 0), (seteq X, -1)) to (setult (add X, 1), 2) (#192183)

This is the De Morgan dual of the existing fold:
    (and (setne X, 0), (setne X, -1)) --> (setuge (add X, 1), 2)

The or-of-equalities version checks if X is either 0 or -1, which is
equivalent to (X+1) < 2 (unsigned). This reduces two comparisons and
an or to one add and one comparison.

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply at anthropic.com>



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