[all-commits] [llvm/llvm-project] 670329: [InstCombine] fold `sub + and` pattern with specif...

chenglin.bi via All-commits all-commits at lists.llvm.org
Fri Nov 4 21:59:02 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 670329036189040edb6c21e4fd1d98c0c979a9e2
      https://github.com/llvm/llvm-project/commit/670329036189040edb6c21e4fd1d98c0c979a9e2
  Author: chenglin.bi <chenglin.bi at linaro.org>
  Date:   2022-11-05 (Sat, 05 Nov 2022)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp
    M llvm/test/Transforms/InstCombine/sub.ll

  Log Message:
  -----------
  [InstCombine] fold `sub + and` pattern with specific const value

`C1 - ((C3 - X) & C2) --> (X & C2) + (C1 - (C2 & C3))`
when:
    (C3 - ((C2 & C3) - 1)) is pow2 &&
    ((C2 + C3) & ((C2 & C3) - 1)) == ((C2 & C3) - 1) &&
    C2 is negative pow2 || (C3 - X) is nuw

https://alive2.llvm.org/ce/z/HXQJV-

Fix: #58523

Reviewed By: spatel

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




More information about the All-commits mailing list