The goal of this patch is to optimize away the test instruction in the following pattern
%reg = and ... EFLAGS set
... EFLAGS not changed.
%extended_reg = subreg_to_reg 0, %reg, %subreg.sub_index. EFLAGS not changed
testrr %extended_reg, %extended_reg, implicit-def $eflags. This could be optimized away.
Before this patch, the optimization wasn't carried out, since extended_reg is defined by SUBREG_TO_REG, which is not handled by isDefConvertible in X86InstrInfo.cpp.
The implementation optimize away the test if the bits used by TEST readers are already set by AND.