Browse Source

* move setting of lnf_testatbegin into tfornode.simplify because it is a simplification

git-svn-id: trunk@26338 -
florian 11 years ago
parent
commit
b0441e1d64
1 changed files with 15 additions and 15 deletions
  1. 15 15
      compiler/nflw.pas

+ 15 - 15
compiler/nflw.pas

@@ -1453,6 +1453,21 @@ implementation
     function tfornode.simplify(forinline : boolean) : tnode;
       begin
         result:=nil;
+         { Can we spare the first comparision? }
+         if (t1.nodetype=ordconstn) and
+            (right.nodetype=ordconstn) and
+            (
+             (
+              (lnf_backward in loopflags) and
+              (Tordconstnode(right).value>=Tordconstnode(t1).value)
+             ) or
+             (
+               not(lnf_backward in loopflags) and
+               (Tordconstnode(right).value<=Tordconstnode(t1).value)
+             )
+            ) then
+           exclude(loopflags,lnf_testatbegin);
+
         if (t1.nodetype=ordconstn) and
            (right.nodetype=ordconstn) and
            (
@@ -1521,21 +1536,6 @@ implementation
                end;
            end;
 
-         { Can we spare the first comparision? }
-         if (t1.nodetype=ordconstn) and
-            (right.nodetype=ordconstn) and
-            (
-             (
-              (lnf_backward in loopflags) and
-              (Tordconstnode(right).value>=Tordconstnode(t1).value)
-             ) or
-             (
-               not(lnf_backward in loopflags) and
-               (Tordconstnode(right).value<=Tordconstnode(t1).value)
-             )
-            ) then
-           exclude(loopflags,lnf_testatbegin);
-
          { Make sure that the loop var and the
            from and to values are compatible types }
          check_ranges(right.fileinfo,right,left.resultdef);