[all-commits] [llvm/llvm-project] b336f9: [InstCombine] Test cases for D154937

Dhruv Chawla via All-commits all-commits at lists.llvm.org
Tue Jul 11 22:44:45 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: b336f9deeba2e1559d398a4fc2a00254c865953f
      https://github.com/llvm/llvm-project/commit/b336f9deeba2e1559d398a4fc2a00254c865953f
  Author: Dhruv Chawla <44582521+dc03 at users.noreply.github.com>
  Date:   2023-07-12 (Wed, 12 Jul 2023)

  Changed paths:
    A llvm/test/Transforms/InstCombine/and-or-icmp-const-icmp.ll

  Log Message:
  -----------
  [InstCombine] Test cases for D154937

Create test cases for the following two folds:

(icmp eq X, C) | (icmp ult Other, (X - C)) -> (icmp ule Other, (X - (C + 1)))
(icmp ne X, C) & (icmp uge Other, (X - C)) -> (icmp ugt Other, (X - (C + 1)))

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


  Commit: 20ae2d200dc94b051757174ec0f3a03103b8e1e2
      https://github.com/llvm/llvm-project/commit/20ae2d200dc94b051757174ec0f3a03103b8e1e2
  Author: Dhruv Chawla <44582521+dc03 at users.noreply.github.com>
  Date:   2023-07-12 (Wed, 12 Jul 2023)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
    M llvm/test/Transforms/InstCombine/and-or-icmp-const-icmp.ll

  Log Message:
  -----------
  [InstCombine] Generalize foldAndOrOfICmpEqZeroAndICmp

This patch generalizes the fold implemented by foldAndOrOfICmpEqZeroAndICmp,
which are:

(icmp eq X, 0) | (icmp ult Other, X) -> (icmp ule Other, X-1)
(icmp ne X, 0) & (icmp uge Other, X) -> (icmp ugt Other, X-1)

to the following:

(icmp eq X, C) | (icmp ult Other, (X - C)) -> (icmp ule Other, (X - (C + 1)))
(icmp ne X, C) & (icmp uge Other, (X - C)) -> (icmp ugt Other, (X - (C + 1)))

The function foldAndOrOfICmpEqZeroAndICmp is also renamed to
foldAndOrOfICmpEqConstantAndICmp to reflect the changes.

Proofs: https://alive2.llvm.org/ce/z/yXGv6q

Fixes #63749.

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


Compare: https://github.com/llvm/llvm-project/compare/65ef4d43577d...20ae2d200dc9


More information about the All-commits mailing list