DAG type Legalizer bug?

The following looks like a bug in the legalizer to me.

DAGTypeLegalizer::SplitRes_MERGE_VALUES(SDNode*N, unsigned ResNo, SDValue& Lo, SDValue& Hi) {

SDValue Op = DisintegrateMERGE_VALUES(N, ResNo);

GetSplitOp(Op, Lo, Hi);

}

DisintegrateMERGE_VALUE() returns SDValue(N, ResNo), where N is the MERGE_VALUE node itself.

Then GetSplitOp() tries to retrieve split result for N from the SplitVectors cache and hit assert because split result is for N is not in the cache yet.

Seems to me that DisintegrateMERGE_VALUES() should return the corresponding operand for the given ResNo, not the defined value.

Please confirm if it’s a bug, or if I’m missing something.

Thanks,

Xiaoyi