[all-commits] [llvm/llvm-project] 0e71bb: [InstCombine] Test cases for D154206

Dhruv Chawla via All-commits all-commits at lists.llvm.org
Wed Jul 5 06:27:54 PDT 2023


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

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

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

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

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


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

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

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

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

usub_sat(X, C) pred C2
=> (X < C)  || ((X - C) pred C2) -> when (0 pred C2) is true
=> (X >= C) && ((X - C) pred C2) -> when (0 pred C2) is false

These expressions can generally be folded into a simpler expression. As
they can sometimes emit more than one instruction, they are limited to
cases where the "usub_sat" has only one user.

Fixes #58342.

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

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


Compare: https://github.com/llvm/llvm-project/compare/4a49226537ab...b66006fbf789


More information about the All-commits mailing list