[all-commits] [llvm/llvm-project] 3aa009: [InstCombine] generalize subtract with 'not' operands

RotateRight via All-commits all-commits at lists.llvm.org
Sun Aug 22 04:30:42 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 3aa009cc87e3789ac44bbb98b04846736373e08f
      https://github.com/llvm/llvm-project/commit/3aa009cc87e3789ac44bbb98b04846736373e08f
  Author: Sanjay Patel <spatel at rotateright.com>
  Date:   2021-08-22 (Sun, 22 Aug 2021)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp
    M llvm/test/Transforms/InstCombine/minmax-intrinsics.ll
    M llvm/test/Transforms/InstCombine/reassociate-nuw.ll
    M llvm/test/Transforms/InstCombine/sub.ll

  Log Message:
  -----------
  [InstCombine] generalize subtract with 'not' operands

The motivation was to get min/max intrinsics to parity
with cmp+select idioms, but this unlocks a few more
folds because isFreeToInvert recognizes add/sub with
constants too.

In the min/max example, we have too many extra uses
for smaller folds to improve things, but this fold
is able to eliminate uses even though we can't reduce
the number of instructions.




More information about the All-commits mailing list