View Issue Details

IDProjectCategoryView StatusLast Update
0037972FPCCompilerpublic2020-10-23 22:05
ReporterJ. Gareth Moreton Assigned ToFlorian  
PrioritylowSeveritytrivialReproducibilityN/A
Status resolvedResolutionfixed 
PlatformCross-platformOSMicrosoft Windows 
Product Version3.3.1 
Fixed in Version3.3.1 
Summary0037972: [Patch] Minor refactor of reduced iterations of pass 1
DescriptionThis patch just removes a branch where the compiler checks to see if -O4 is selected in the peephole optimizer when deciding the maximum number of iterations for Pass 1, since -O3 and-O4 are now set to the same value.
Steps To ReproduceApply patch and confirm pure refactor (no difference in output).
Additional InformationGenerated binaries should not change - any differences are indictive of a bug.

Speed should be a fraction of a second faster, but we're only talking about a handful of CPU cycles.
Tagscompiler, optimizations, patch
Fixed in Revision47163
FPCOldBugId
FPCTarget-
Attached Files

Relationships

child of 0037959 resolvedFlorian [Patch] Peephole Optimizer pass reduction 

Activities

J. Gareth Moreton

2020-10-23 17:05

developer  

pass-fixup.patch (1,175 bytes)   
Index: compiler/aoptobj.pas
===================================================================
--- compiler/aoptobj.pas	(revision 47157)
+++ compiler/aoptobj.pas	(working copy)
@@ -2465,7 +2465,7 @@
 
     procedure TAOptObj.PeepHoleOptPass1;
       const
-        MaxPasses: array[1..4] of Cardinal = (1, 2, 8, 8);
+        MaxPasses: array[1..3] of Cardinal = (1, 2, 8);
       var
         p : tai;
         stoploop, FirstInstruction, JumpOptsAvailable: boolean;
@@ -2477,10 +2477,8 @@
         PassCount := 0;
 
         { Determine the maximum number of passes allowed based on the compiler switches }
-        if (cs_opt_level4 in current_settings.optimizerswitches) then
+        if (cs_opt_level3 in current_settings.optimizerswitches) then
           { it should never take more than 8 passes, but the limit is finite to protect against faulty optimisations }
-          MaxCount := MaxPasses[4]
-        else if (cs_opt_level3 in current_settings.optimizerswitches) then
           MaxCount := MaxPasses[3]
         else if (cs_opt_level2 in current_settings.optimizerswitches) then
           MaxCount := MaxPasses[2] { The original double run of Pass 1 }
pass-fixup.patch (1,175 bytes)   

Florian

2020-10-23 22:05

administrator   ~0126498

Thanks, applied.

Issue History

Date Modified Username Field Change
2020-10-23 17:05 J. Gareth Moreton New Issue
2020-10-23 17:05 J. Gareth Moreton File Added: pass-fixup.patch
2020-10-23 17:05 J. Gareth Moreton Relationship added child of 0037959
2020-10-23 17:06 J. Gareth Moreton Priority normal => low
2020-10-23 17:06 J. Gareth Moreton Severity minor => trivial
2020-10-23 17:06 J. Gareth Moreton FPCTarget => -
2020-10-23 17:06 J. Gareth Moreton Tag Attached: optimizations
2020-10-23 17:06 J. Gareth Moreton Tag Attached: patch.compiler
2020-10-23 17:07 J. Gareth Moreton Tag Detached: patch.compiler
2020-10-23 17:07 J. Gareth Moreton Tag Attached: patch
2020-10-23 17:07 J. Gareth Moreton Tag Attached: compiler
2020-10-23 17:07 J. Gareth Moreton Summary [Patch] Minor clean-up of reduced iterations of pass 1 => [Patch] Minor refactor of reduced iterations of pass 1
2020-10-23 22:05 Florian Assigned To => Florian
2020-10-23 22:05 Florian Status new => resolved
2020-10-23 22:05 Florian Resolution open => fixed
2020-10-23 22:05 Florian Fixed in Version => 3.3.1
2020-10-23 22:05 Florian Fixed in Revision => 47163
2020-10-23 22:05 Florian Note Added: 0126498