return rr_transitive_table[r1 - VREL_FIRST][r2 - VREL_FIRST];
}
+// Given an equivalence set EQUIV, set all the bits in B that are still valid
+// members of EQUIV in basic block BB.
+
+void
+relation_oracle::valid_equivs (bitmap b, const_bitmap equivs, basic_block bb)
+{
+ unsigned i;
+ bitmap_iterator bi;
+ EXECUTE_IF_SET_IN_BITMAP (equivs, 0, i, bi)
+ {
+ tree ssa = ssa_name (i);
+ const_bitmap ssa_equiv = equiv_set (ssa, bb);
+ if (ssa_equiv == equivs)
+ bitmap_set_bit (b, i);
+ }
+}
+
// -------------------------------------------------------------------------
// The very first element in the m_equiv chain is actually just a summary
// Otherwise create an equivalence for this block which is a copy
// of equiv, the add V to the set.
bitmap b = BITMAP_ALLOC (&m_bitmaps);
- bitmap_copy (b, equiv->m_names);
+ valid_equivs (b, equiv->m_names, bb);
bitmap_set_bit (b, v);
return b;
}
equiv_oracle::register_equiv (basic_block bb, equiv_chain *equiv_1,
equiv_chain *equiv_2)
{
- // If equiv_1 is alreayd in BB, use it as the combined set.
+ // If equiv_1 is already in BB, use it as the combined set.
if (equiv_1->m_bb == bb)
{
- bitmap_ior_into (equiv_1->m_names, equiv_2->m_names);
+ valid_equivs (equiv_1->m_names, equiv_2->m_names, bb);
// Its hard to delete from a single linked list, so
// just clear the second one.
if (equiv_2->m_bb == bb)
bitmap_clear (equiv_2->m_names);
else
- // Ensure equiv_2s names are in the summary for BB.
- bitmap_ior_into (m_equiv[bb->index]->m_names, equiv_2->m_names);
+ // Ensure the new names are in the summary for BB.
+ bitmap_ior_into (m_equiv[bb->index]->m_names, equiv_1->m_names);
return NULL;
}
// If equiv_2 is in BB, use it for the combined set.
if (equiv_2->m_bb == bb)
{
- bitmap_ior_into (equiv_2->m_names, equiv_1->m_names);
- // Add equiv_1 names into the summary.
- bitmap_ior_into (m_equiv[bb->index]->m_names, equiv_1->m_names);
+ valid_equivs (equiv_2->m_names, equiv_1->m_names, bb);
+ // Ensure the new names are in the summary.
+ bitmap_ior_into (m_equiv[bb->index]->m_names, equiv_2->m_names);
return NULL;
}
// At this point, neither equivalence is from this block.
bitmap b = BITMAP_ALLOC (&m_bitmaps);
- bitmap_copy (b, equiv_1->m_names);
- bitmap_ior_into (b, equiv_2->m_names);
+ valid_equivs (b, equiv_1->m_names, bb);
+ valid_equivs (b, equiv_2->m_names, bb);
return b;
}
// Don't mess around, simply create a new record and insert it first.
bitmap b = BITMAP_ALLOC (&m_bitmaps);
- bitmap_copy (b, equiv_1);
- bitmap_ior_into (b, equiv_2);
+ valid_equivs (b, equiv_1, bb);
+ valid_equivs (b, equiv_2, bb);
equiv_chain *ptr = (equiv_chain *) obstack_alloc (&m_chain_obstack,
sizeof (equiv_chain));