[X86] Teach PostprocessISelDAG to fold ANDrm+TESTrr when chain result is used.
authorCraig Topper <craig.topper@sifive.com>
Thu, 4 Aug 2022 04:00:21 +0000 (21:00 -0700)
committerCraig Topper <craig.topper@sifive.com>
Thu, 4 Aug 2022 04:00:22 +0000 (21:00 -0700)
commit91e8079cd535a736cb6aabd24fc310a8ec46a07f
treef90bb0513c4812a39058e5ca44a9175db467211f
parentc988c267cf6e302ceda1edc5c7c679ecb64eab75
[X86] Teach PostprocessISelDAG to fold ANDrm+TESTrr when chain result is used.

The isOnlyUserOf prevented the fold if the chain result had any
users. What we really care about is the the data result from the
AND is only used by the TEST, and the flags results from the ANDs
aren't used at all. It's ok if the chain has users, we just need
to replace those users with the chain from the TESTrm.

Reviewed By: LuoYuanke

Differential Revision: https://reviews.llvm.org/D131117
llvm/lib/Target/X86/X86ISelDAGToDAG.cpp
llvm/test/CodeGen/X86/cmp.ll