[all-commits] [llvm/llvm-project] 85e07b: [InstructionSimplify] Extend simplifyICmpWithZero ...

Kunqiu Chen via All-commits all-commits at lists.llvm.org
Thu Feb 12 08:06:55 PST 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 85e07bad936360c52599863f0700008f9f304246
      https://github.com/llvm/llvm-project/commit/85e07bad936360c52599863f0700008f9f304246
  Author: Kunqiu Chen <camsyn at foxmail.com>
  Date:   2026-02-13 (Fri, 13 Feb 2026)

  Changed paths:
    M llvm/lib/Analysis/InstructionSimplify.cpp
    A llvm/test/Transforms/InstSimplify/icmp-equiv-zero.ll
    M llvm/test/Transforms/LoopUnroll/runtime-loop-multiple-exits.ll
    M llvm/test/Transforms/LoopVectorize/AArch64/sve-interleaved-accesses.ll

  Log Message:
  -----------
  [InstructionSimplify] Extend simplifyICmpWithZero to handle equivalent zero RHS (#179055)

Add a new helper function `matchEquivZeroRHS()` that recognizes
comparisons with constants that are equivalent to comparisons with zero,
and transforms the predicate accordingly.

This handles the following transformations:
- icmp sgt X, -1 --> icmp sge X, 0
- icmp sle X, -1 --> icmp slt X, 0
- icmp [us]ge X, 1 --> icmp [us]gt X, 0
- icmp [us]lt X, 1 --> icmp [us]le X, 0

This enables more optimization opportunities in `simplifyICmpWithZero`,
such as folding icmp sgt X, -1 when X is known to be non-negative.

---

- IR Impact: https://github.com/dtcxzyw/llvm-opt-benchmark/pull/3414



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