/** * Does the current state of the algorithm optimistically assume that two nodes are congruent? * Note: this can return false even if the value numbers are currently the same. * * @param v1 first vertex * @param v2 second vertex */ private boolean checkCongruence(OPT_ValueGraphVertex v1, OPT_ValueGraphVertex v2) { if (v1 == v2) return true; // make sure the two nodes have the same label if (v1.getLabel() != v2.getLabel()) return false; // make sure that the operands match int arity = v1.getArity(); for (int i = 0; i < arity; i++) { OPT_ValueGraphVertex target1 = v1.getTarget(i); OPT_ValueGraphVertex target2 = v2.getTarget(i); // if either target is null, then that particular control // flow path is never realized, so assume TOP if ((target1 == null) || (target2 == null)) continue; if (target1.getValueNumber() != target2.getValueNumber()) return false; } return true; }