HomePhabricator

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

Authored by lebedev.ri on Apr 28 2020, 3:20 AM.

Description

[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.

Details

Committed
lebedev.riApr 28 2020, 9:16 AM
Parents
rGa5f22f2b0ef2: [NFC][InstCombine] Tests for negation of 'or' with no common bits set
Branches
Unknown
Tags
Unknown