[DAG] Allow folding AND of anyext masked_load with >1 user to zext version
authorBenjamin Maxwell <benjamin.maxwell@arm.com>
Fri, 18 Nov 2022 10:14:55 +0000 (10:14 +0000)
committerCullen Rhodes <cullen.rhodes@arm.com>
Fri, 18 Nov 2022 10:38:09 +0000 (10:38 +0000)
commit34d88cf6cfe9f878e6330f157f178c2b104c3949
tree38637c5af327d0c4b682bfa50d465fcb1e0dde04
parent326393ae653189023b251f05009d86215ad30caf
[DAG] Allow folding AND of anyext masked_load with >1 user to zext version

This now allows folding an AND of a anyext masked_load to a
zext_masked_load even if the masked load has multiple users.  Doing is
eliminates some redundant ANDs/MOVs for certain AArch64 SVE code.

I'm not sure if there's any cases where doing this could negatively the
other users of the masked_load.  Looking at other optimizations of
masked loads, most don't apply if the load is used more than once, so it
doesn't look like this would interfere.

Reviewed By: c-rhodes

Differential Revision: https://reviews.llvm.org/D137844
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
llvm/test/CodeGen/AArch64/sve-load-compare-store.ll
llvm/test/CodeGen/Thumb2/mve-masked-load.ll