[PPL-devel] [GIT] ppl/ppl(master): Reduced the scope of some variables.
Roberto Bagnara
bagnara at cs.unipr.it
Fri Jan 20 19:35:18 CET 2012
Module: ppl/ppl
Branch: master
Commit: 68ee3845682d61e60861d9c9afd9fdb707164c39
URL: http://www.cs.unipr.it/git/gitweb.cgi?p=ppl/ppl.git;a=commit;h=68ee3845682d61e60861d9c9afd9fdb707164c39
Author: Roberto Bagnara <bagnara at cs.unipr.it>
Date: Fri Jan 20 18:46:10 2012 +0100
Reduced the scope of some variables.
Detected by ECLAIR service minscope.
---
src/Grid.templates.hh | 2 +-
src/Grid_Generator_System.cc | 2 +-
src/Grid_public.cc | 5 +++--
3 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/src/Grid.templates.hh b/src/Grid.templates.hh
index be1d9af..94d756f 100644
--- a/src/Grid.templates.hh
+++ b/src/Grid.templates.hh
@@ -66,12 +66,12 @@ Grid::Grid(const Box<Interval>& box,
for (dimension_type k = space_dim; k-- > 0; ) {
// This is declared here because it may be invalidated by the call to
// gen_sys.insert() at the end of the loop.
- Grid_Generator& point = gen_sys[0];
bool closed = false;
// TODO: Consider producing the system(s) in minimized form.
if (box.get_lower_bound(k, closed, l_n, l_d)) {
if (box.get_upper_bound(k, closed, u_n, u_d))
if (l_n * u_d == u_n * l_d) {
+ Grid_Generator& point = gen_sys[0];
// A point interval sets dimension k of every point to a
// single value.
con_sys.insert(l_d * Variable(k) == l_n);
diff --git a/src/Grid_Generator_System.cc b/src/Grid_Generator_System.cc
index 4e9f3ba..534f5e9 100644
--- a/src/Grid_Generator_System.cc
+++ b/src/Grid_Generator_System.cc
@@ -83,10 +83,10 @@ PPL::Grid_Generator_System::recycling_insert(Grid_Generator& g) {
void
PPL::Grid_Generator_System::insert(const Grid_Generator& g) {
- dimension_type g_space_dim = g.space_dimension();
if (g.is_parameter())
if (g.all_homogeneous_terms_are_zero()) {
+ dimension_type g_space_dim = g.space_dimension();
dimension_type initial_space_dim = space_dimension();
if (initial_space_dim < g_space_dim) {
// Adjust the space dimension.
diff --git a/src/Grid_public.cc b/src/Grid_public.cc
index 17b8a9b..1d778b2 100644
--- a/src/Grid_public.cc
+++ b/src/Grid_public.cc
@@ -1059,7 +1059,8 @@ PPL::Grid::OK(bool check_not_empty) const {
goto fail;
Grid tmp_gr = *this;
- Congruence_System cs_copy = tmp_gr.con_sys;
+ // Make a copy here, before changing tmp_gr, to check later.
+ const Congruence_System cs_copy = tmp_gr.con_sys;
// Clear the generators in tmp_gr.
Grid_Generator_System gs(space_dim);
@@ -1643,7 +1644,6 @@ PPL::Grid::simplify_using_context_assign(const Grid& y) {
const Congruence_System& x_cs = x.con_sys;
const dimension_type x_cs_num_rows = x_cs.num_rows();
- const Grid_Generator_System& y_gs = y.gen_sys;
// Record into `redundant_by_y' the info about which congruences of
// `x' are redundant in the context `y'. Count the number of
@@ -1704,6 +1704,7 @@ PPL::Grid::simplify_using_context_assign(const Grid& y) {
const Coefficient& modulus = c.modulus();
div = modulus;
+ const Grid_Generator_System& y_gs = y.gen_sys;
dimension_type num_ruled_out_generators = 0;
for (Grid_Generator_System::const_iterator k = y_gs.begin(),
y_gs_end = y_gs.end(); k != y_gs_end; ++k) {
More information about the PPL-devel
mailing list