- For case bcmp9, there is extras AND and EXTEND int the chain of OR/XOR, which prevent the transform, so enable the optimize before legalization.
- The key IR frag related:
t37: i32,ch = load<(load (s8) from %ir.4), anyext from i8> t0, t11, undef:i64
t12: i64 = add t4, Constant:i64<8>
t38: i32,ch = load<(load (s8) from %ir.5), anyext from i8> t0, t12, undef:i64
t39: i32 = xor t37, t38
t40: i64 = any_extend t39
t42: i64 = and t40, Constant:i64<255>Depends on D138398 to fix combine_setcc_glue
It looks this can continue to be simplified to
unsigned LogicOp = (Cond == ISD::SETEQ) ? ISD::AND : ISD::OR; SDValue Cmp = DAG.getSetCC(DL, VT, XOR0, XOR1, Cond); for (unsigned I = 1; I < WorkList.size(); I++) { std::tie(XOR0, XOR1) = WorkList[I]; SDValue CmpChain = DAG.getSetCC(DL, VT, XOR0, XOR1, Cond); Cmp = DAG.getNode(LogicOp, DL, VT, Cmp, CmpChain); } return Cmp;Looks more cases can get benefit from it.