[GlobalISel] Add combine for (x | mask) -> x when (x | mask) == x
authorMirko Brkusanin <Mirko.Brkusanin@amd.com>
Fri, 6 Nov 2020 14:36:17 +0000 (15:36 +0100)
committerMirko Brkusanin <Mirko.Brkusanin@amd.com>
Tue, 10 Nov 2020 10:32:13 +0000 (11:32 +0100)
commita75d6178b809cf11d54af91e8e1254064d58f6eb
treeba8ebed0cfdc67a15bc7b325a0f740166aa5f9cc
parentfb36ab0a42f4ea8909c19c9e6759be5d617aef55
[GlobalISel] Add combine for (x | mask) -> x when (x | mask) == x

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

Differential Revision: https://reviews.llvm.org/D90952
llvm/include/llvm/CodeGen/GlobalISel/CombinerHelper.h
llvm/include/llvm/Target/GlobalISel/Combine.td
llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp
llvm/lib/Target/AArch64/AArch64Combine.td
llvm/test/CodeGen/AMDGPU/GlobalISel/combine-or-redundant.mir [new file with mode: 0644]
llvm/test/CodeGen/AMDGPU/GlobalISel/combine-shift-of-shifted-logic.ll
llvm/test/CodeGen/AMDGPU/GlobalISel/sdiv.i64.ll
llvm/test/CodeGen/AMDGPU/GlobalISel/srem.i64.ll