瀏覽代碼

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

git-svn-id: trunk@26338 -
florian 11 年之前
父節點
當前提交
b0441e1d64
共有 1 個文件被更改,包括 15 次插入15 次删除
  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);