[PPL-devel] [GIT] ppl/ppl(floating_point): It is NECESSARY to delay the update of unary constraints on var.

Fabio Bossi bossi at cs.unipr.it
Tue Sep 15 09:24:56 CEST 2009


Module: ppl/ppl
Branch: floating_point
Commit: a1e7e39e58515de6438993797f5041b1ae4067c2
URL:    http://www.cs.unipr.it/git/gitweb.cgi?p=ppl/ppl.git;a=commit;h=a1e7e39e58515de6438993797f5041b1ae4067c2

Author: Fabio Bossi <bossi at cs.unipr.it>
Date:   Tue Sep 15 09:26:44 2009 +0200

It is NECESSARY to delay the update of unary constraints on var.

---

 src/Octagonal_Shape.templates.hh |   23 +++++++++++------------
 1 files changed, 11 insertions(+), 12 deletions(-)

diff --git a/src/Octagonal_Shape.templates.hh b/src/Octagonal_Shape.templates.hh
index 5729793..c63676f 100644
--- a/src/Octagonal_Shape.templates.hh
+++ b/src/Octagonal_Shape.templates.hh
@@ -4872,17 +4872,6 @@ Octagonal_Shape<T>::affine_image(Variable var,
 
   Linear_Form<FP_Interval_Type> minus_lf(-lf);
 
-  PPL_DIRTY_TEMP(N, lf_ub);
-  linear_form_upper_bound(lf, lf_ub);
-  PPL_DIRTY_TEMP(N, minus_lf_ub);
-  linear_form_upper_bound(minus_lf, minus_lf_ub);
-
-  // Update unary constraints on var.
-  mul_2exp_assign_r(lf_ub, lf_ub, 1, ROUND_IGNORE);
-  assign_r(matrix[n_var+1][n_var], lf_ub, ROUND_NOT_NEEDED);
-  mul_2exp_assign_r(minus_lf_ub, minus_lf_ub, 1, ROUND_IGNORE);
-  assign_r(matrix[n_var][n_var+1], minus_lf_ub, ROUND_NOT_NEEDED);
-
   // Declare temporaries outside the loop.
   PPL_DIRTY_TEMP(N, lf_plus_var_ub);
   PPL_DIRTY_TEMP(N, lf_minus_var_ub);
@@ -4897,7 +4886,7 @@ Octagonal_Shape<T>::affine_image(Variable var,
   ++m_iter;
   Row_Iterator m_end = matrix.row_end();
 
-  // Update binary constraints on var.
+  // Update binary constraints on var FIRST.
   for (dimension_type curr_var = var_id, n_curr_var = n_var - 2;
        curr_var-- > 0; ) {
     Variable current(curr_var);
@@ -4927,6 +4916,16 @@ Octagonal_Shape<T>::affine_image(Variable var,
     ++curr_var;
   }
 
+  // Finally, update unary constraints on var.
+  PPL_DIRTY_TEMP(N, lf_ub);
+  linear_form_upper_bound(lf, lf_ub);
+  PPL_DIRTY_TEMP(N, minus_lf_ub);
+  linear_form_upper_bound(minus_lf, minus_lf_ub);
+  mul_2exp_assign_r(lf_ub, lf_ub, 1, ROUND_IGNORE);
+  assign_r(matrix[n_var+1][n_var], lf_ub, ROUND_NOT_NEEDED);
+  mul_2exp_assign_r(minus_lf_ub, minus_lf_ub, 1, ROUND_IGNORE);
+  assign_r(matrix[n_var][n_var+1], minus_lf_ub, ROUND_NOT_NEEDED);
+
 }
 
 template <typename T>




More information about the PPL-devel mailing list