Update of /cvsroot/monetdb/pathfinder/compiler/mil
In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv749/compiler/mil

Modified Files:
      Tag: XQuery_0-16
        milprint_summer.c 
Log Message:
-- Fixing bug 1637867:

   * mps.c: Remove numeric seqcast.

   * coreopt.brg: Replaced typeswitch by an if-then-else whenever we only 
     need to split up empty sequences from the rest. (As a side effect the
     typeswitch testing for type numeric is gone as well.)


Index: milprint_summer.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/mil/milprint_summer.c,v
retrieving revision 1.318.2.13
retrieving revision 1.318.2.14
diff -u -d -r1.318.2.13 -r1.318.2.14
--- milprint_summer.c   20 Feb 2007 09:58:40 -0000      1.318.2.13
+++ milprint_summer.c   21 Feb 2007 13:30:02 -0000      1.318.2.14
@@ -9276,13 +9276,20 @@
                 input_type = TY(R(c));
             }
 
+            /* get rid of unnecessary numeric cast (the only place
+               where this cast is introduced are predicates) */
+            if (c->kind == c_seqcast &&
+                PFty_subtype (input_type, PFty_opt (PFty_numeric ())) &&
+                PFty_subtype (PFty_numeric (), L(c)->sem.type) &&
+                PFty_subtype (L(c)->sem.type, PFty_numeric ()))
+                *c = *(R(c));
+#ifdef USE_DEPRECATED_ACCESS_TO_TYPE_SYSTEM
             /* removes casts which are not necessary:
                - if types are the same
                - if the cast type has only a additional
                  occurence indicator compared to the
                  input type */
-#ifdef USE_DEPRECATED_ACCESS_TO_TYPE_SYSTEM
-            if (TY_EQ (input_type, cast_type) ||
+            else if (TY_EQ (input_type, cast_type) ||
                 TY_EQ (input_type, opt_cast_type) ||
                 ((cast_type.type == ty_opt ||
                   cast_type.type == ty_star) &&
@@ -9292,9 +9299,8 @@
             }
             /* don't cast nodes - node type was only needed
                for static typing */
-            else
 #endif
-                if (c->kind == c_seqcast &&
+            else if (c->kind == c_seqcast &&
                      PFty_subtype (input_type, PFty_xs_anyNode ()) &&
                      PFty_subtype (cast_type, PFty_xs_anyNode ()))
             {
@@ -9309,6 +9315,14 @@
                         PFty_str(cast_type));
             else
             {
+            /* get rid of unnecessary numeric cast (the only place
+               where this cast is introduced are predicates) */
+            if (c->kind == c_seqcast &&
+                PFty_subtype (input_type, PFty_opt (PFty_numeric ())) &&
+                PFty_subtype (PFty_numeric (), L(c)->sem.type) &&
+                PFty_subtype (L(c)->sem.type, PFty_numeric ()))
+                *c = *(R(c));
+#ifdef USE_DEPRECATED_ACCESS_TO_TYPE_SYSTEM
                 *c = *(R(c));
                 /*
                 PFlog ("cast from '%s' to '%s' ignored",
@@ -9323,6 +9337,7 @@
             {
                 unsigned int i = 0;
                 PFcnode_t *tmp = D(c);
+#endif
                 while (i < fun->arity)
                 {
                     simplifyCoreTree (L(tmp));


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Monetdb-pf-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-pf-checkins

Reply via email to