Make unique GVN value for consumer of multi-output insns: Add func multi_out_insn_p, use it in expr_eq.
@@ -2172,6 +2172,12 @@ static int op_eq (gen_ctx_t gen_ctx, MIR_op_t op1, MIR_op_t op2) {
return MIR_op_eq_p (gen_ctx->ctx, op1, op2);
}
+static int multi_out_insn_p (MIR_insn_t insn) {
+ if (!MIR_call_code_p (insn->code)) return FALSE;
+ gen_assert (insn->ops[0].u.ref->item_type == MIR_proto_item);
+ return insn->ops[0].u.ref->u.proto->nres > 1;
+}
+
static int expr_eq (expr_t e1, expr_t e2, void *arg) {
gen_ctx_t gen_ctx = arg;
MIR_context_t ctx = gen_ctx->ctx;
@@ -2191,7 +2197,10 @@ static int expr_eq (expr_t e1, expr_t e2, void *arg) {
ssa_edge1 = insn1->ops[i].data;
ssa_edge2 = insn2->ops[i].data;
if (ssa_edge1 != NULL && ssa_edge2 != NULL
- && ssa_edge1->def->gvn_val != ssa_edge2->def->gvn_val)
+ && (ssa_edge1->def->gvn_val != ssa_edge2->def->gvn_val
+ /* we can not be sure what defition we use in multi-output insn: */
+ || multi_out_insn_p (ssa_edge1->def->insn)
+ || multi_out_insn_p (ssa_edge2->def->insn)))
return FALSE;
}
return TRUE;
