HomePhabricator

[GlobalISel] Expand combine for (x & mask) -> x when (x & mask) == x

Authored by mbrkusanin on Nov 6 2020, 5:15 AM.

Description

[GlobalISel] Expand combine for (x & mask) -> x when (x & mask) == x

We can use KnownBitsAnalysis to cover cases when mask is not trivial. It can
also help with cases when mask is not constant but can still be folded into
one. Since 'and' is comutative we should treat both operands as possible
replacements.

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