degen: return input if it is already degeneralized

* src/tgbaalgos/degen.cc (degeneralize, degeneralize_tba): Shortcut
degeneralization if the automaton is already degeneralized.
This commit is contained in:
Alexandre Duret-Lutz 2014-08-15 11:24:41 +02:00
parent bf6c906772
commit e3b5119f25

View file

@ -622,6 +622,12 @@ namespace spot
bool use_z_lvl, bool use_cust_acc_orders,
int use_lvl_cache, bool skip_levels)
{
// If this already a degeneralized digraph, there is nothing we
// can improve.
if (auto d = std::dynamic_pointer_cast<const tgba_digraph>(a))
if (d->get_bprop(tgba_digraph::SBA))
return std::const_pointer_cast<tgba_digraph>(d);
return degeneralize_aux<true>(a, use_z_lvl, use_cust_acc_orders,
use_lvl_cache, skip_levels);
}
@ -631,6 +637,12 @@ namespace spot
bool use_z_lvl, bool use_cust_acc_orders,
int use_lvl_cache, bool skip_levels)
{
// If this already a degeneralized digraph, there is nothing we
// can improve.
if (auto d = std::dynamic_pointer_cast<const tgba_digraph>(a))
if (d->get_bprop(tgba_digraph::SingleAccSet))
return std::const_pointer_cast<tgba_digraph>(d);
return degeneralize_aux<false>(a, use_z_lvl, use_cust_acc_orders,
use_lvl_cache, skip_levels);
}