[all-commits] [llvm/llvm-project] 9606c6: [InstCombine] Fold sub(Y, and(lshr(X, C), 1)) --> add...

Simon Pilgrim via All-commits all-commits at lists.llvm.org
Tue Feb 15 05:24:42 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 9606c690873fab93d895b2b763d8e2ed781c05af
      https://github.com/llvm/llvm-project/commit/9606c690873fab93d895b2b763d8e2ed781c05af
  Author: Simon Pilgrim <llvm-dev at redking.me.uk>
  Date:   2022-02-15 (Tue, 15 Feb 2022)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineNegator.cpp
    M llvm/test/Transforms/InstCombine/negated-bitmask.ll

  Log Message:
  -----------
  [InstCombine] Fold sub(Y,and(lshr(X,C),1)) --> add(ashr(shl(X,(BW-1)-C),BW-1),Y) (PR53610)

As noted on PR53610, we can fold a 'bit splat' negation of a shifted bitmask pattern into a pair of shifts.

https://alive2.llvm.org/ce/z/eGrsoN

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




More information about the All-commits mailing list