[all-commits] [llvm/llvm-project] ed9108: [InstCombine] Test cases for D154565

Dhruv Chawla via All-commits all-commits at lists.llvm.org
Sat Jul 8 01:04:50 PDT 2023


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

  Changed paths:
    A llvm/test/Transforms/InstCombine/icmp-uadd-sat.ll

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

Create test cases to test the fold for the expression pattern
'uadd_sat(X, C) pred C2'.

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


  Commit: 23f0f061c399a51b9c846a7aaab1c15ce039e1a3
      https://github.com/llvm/llvm-project/commit/23f0f061c399a51b9c846a7aaab1c15ce039e1a3
  Author: Dhruv Chawla <44582521+dc03 at users.noreply.github.com>
  Date:   2023-07-08 (Sat, 08 Jul 2023)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
    M llvm/test/Transforms/InstCombine/icmp-uadd-sat.ll
    M llvm/test/Transforms/InstCombine/icmp-usub-sat.ll

  Log Message:
  -----------
  [InstCombine] Fold icmps comparing uadd_sat with a constant

This patch is a continuation of D154206. It introduces a fold for the
operation "uadd_sat(X, C) pred C2" where "C" and "C2" are constants. The
fold is:

uadd_sat(X, C) pred C2
=> (X >= ~C) || ((X + C) pred C2) -> when (UINT_MAX pred C2) is true
=> (X < ~C)  && ((X + C) pred C2) -> when (UINT_MAX pred C2) is false

This patch also generalizes the fold to work with any saturating
intrinsic as long as the saturating value is known.

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

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


Compare: https://github.com/llvm/llvm-project/compare/681cb54a54bb...23f0f061c399


More information about the All-commits mailing list