[all-commits] [llvm/llvm-project] a5f22f: [NFC][InstCombine] Tests for negation of 'or' with...

Roman Lebedev via All-commits all-commits at lists.llvm.org
Tue Apr 28 09:18:42 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: a5f22f2b0ef26265fec7a23367b2044182d39384
      https://github.com/llvm/llvm-project/commit/a5f22f2b0ef26265fec7a23367b2044182d39384
  Author: Roman Lebedev <lebedev.ri at gmail.com>
  Date:   2020-04-28 (Tue, 28 Apr 2020)

  Changed paths:
    M llvm/test/Transforms/InstCombine/sub-of-negatible.ll

  Log Message:
  -----------
  [NFC][InstCombine] Tests for negation of 'or' with no common bits set


  Commit: a0004358a8e7f6956b8b59998e99f4ea8ee201f3
      https://github.com/llvm/llvm-project/commit/a0004358a8e7f6956b8b59998e99f4ea8ee201f3
  Author: Roman Lebedev <lebedev.ri at gmail.com>
  Date:   2020-04-28 (Tue, 28 Apr 2020)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineInternal.h
    M llvm/lib/Transforms/InstCombine/InstCombineNegator.cpp
    M llvm/test/Transforms/InstCombine/sub-of-negatible.ll

  Log Message:
  -----------
  [InstCombine] Negator: 'or' with no common bits set is just 'add'

In `InstCombiner::visitAdd()`, we have
```
  // A+B --> A|B iff A and B have no bits set in common.
  if (haveNoCommonBitsSet(LHS, RHS, DL, &AC, &I, &DT))
    return BinaryOperator::CreateOr(LHS, RHS);
```
so we should handle such `or`'s here, too.


Compare: https://github.com/llvm/llvm-project/compare/102b4105e3fd...a0004358a8e7


More information about the All-commits mailing list