ソースを参照

* include loop unrolling in -O3, as it is done carefully, it is beneficial on average

git-svn-id: trunk@38687 -
florian 7 年 前
コミット
512328deee
2 ファイル変更6 行追加2 行削除
  1. 1 1
      compiler/globtype.pas
  2. 5 1
      compiler/optloop.pas

+ 1 - 1
compiler/globtype.pas

@@ -369,7 +369,7 @@ interface
        { switches being applied to all CPUs at the given level }
        { switches being applied to all CPUs at the given level }
        genericlevel1optimizerswitches = [cs_opt_level1,cs_opt_peephole];
        genericlevel1optimizerswitches = [cs_opt_level1,cs_opt_peephole];
        genericlevel2optimizerswitches = [cs_opt_level2,cs_opt_remove_emtpy_proc];
        genericlevel2optimizerswitches = [cs_opt_level2,cs_opt_remove_emtpy_proc];
-       genericlevel3optimizerswitches = [cs_opt_level3,cs_opt_constant_propagate,cs_opt_nodedfa,cs_opt_use_load_modify_store];
+       genericlevel3optimizerswitches = [cs_opt_level3,cs_opt_constant_propagate,cs_opt_nodedfa,cs_opt_use_load_modify_store,cs_opt_loopunroll];
        genericlevel4optimizerswitches = [cs_opt_level4,cs_opt_reorder_fields,cs_opt_dead_values,cs_opt_fastmath];
        genericlevel4optimizerswitches = [cs_opt_level4,cs_opt_reorder_fields,cs_opt_dead_values,cs_opt_fastmath];
 
 
        { whole program optimizations whose information generation requires
        { whole program optimizations whose information generation requires

+ 5 - 1
compiler/optloop.pas

@@ -141,7 +141,11 @@ unit optloop;
                   begin
                   begin
                     replaceinfo.node:=tfornode(node).left;
                     replaceinfo.node:=tfornode(node).left;
                     replaceinfo.value:=tordconstnode(tfornode(node).right).value;
                     replaceinfo.value:=tordconstnode(tfornode(node).right).value;
-                  end;
+                  end
+                else
+                  { we consider currently unrolling not beneficial, if we cannot get rid of the for completely, this
+                    might change if a more sophisticated heuristics is used (FK) }
+                  exit;
 
 
                 { let's unroll (and rock of course) }
                 { let's unroll (and rock of course) }
                 for i:=1 to unrolls do
                 for i:=1 to unrolls do