Page MenuHomePhabricator

[GlobalISel] Add combine for (x | mask) -> x when (x | mask) == x
ClosedPublic

Authored by mbrkusanin on Nov 6 2020, 8:50 AM.

Details

Summary

If we have a mask, and a value x, where (x | mask) == x, we can drop the OR
and just use x.

Diff Detail

Event Timeline

mbrkusanin created this revision.Nov 6 2020, 8:50 AM
mbrkusanin requested review of this revision.Nov 6 2020, 8:50 AM
foad accepted this revision.Nov 9 2020, 2:05 AM
foad added a reviewer: paquette.

LGTM modulo minor comments inline.

llvm/include/llvm/CodeGen/GlobalISel/CombinerHelper.h
441

matchRedundantOr?

llvm/include/llvm/Target/GlobalISel/Combine.td
393

Update comment to say that (x | y) could be simplified to either x or y.

This revision is now accepted and ready to land.Nov 9 2020, 2:05 AM
  • Rename
  • Updated comments