[all-commits] [llvm/llvm-project] cc9c54: [InstCombine] generalize subtract with 'not' opera...

RotateRight via All-commits all-commits at lists.llvm.org
Mon Aug 23 14:14:26 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: cc9c545fb42107fdba94e242178c4acc964ca18b
      https://github.com/llvm/llvm-project/commit/cc9c545fb42107fdba94e242178c4acc964ca18b
  Author: Sanjay Patel <spatel at rotateright.com>
  Date:   2021-08-23 (Mon, 23 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; 2nd try

This is a re-try of 3aa009cc87e3 which was reverted at
9577fac0fddf because it caused an infinite loop.

For the extra test case, either re-ordering the transforms
or adding the extra clause to avoid sub-of-sub is enough
to prevent the infinite compile, but I'm doing both to be
safer.

Original commit message:
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