Watch, Follow, &
Connect with Us
Public Report
Report From: Delphi-BCB/Compiler/Delphi/Code Generation/Optimization    [ Add a report in this area ]  
Report #:  105561   Status: Open
Not complete optimization: constant propagation.
Project:  Delphi Build #:  16.0.4429.46931
Version:    16.4 Submitted By:   Denis Volodarsky
Report Type:  Suggestion / Enhancement Request Date Reported:  5/12/2012 11:17:07 PM
Severity:    Infrequently encountered problem Last Updated: 8/6/2012 12:47:57 PM
Platform:    All versions Internal Tracking #:  
Resolution: None (Resolution Comments) Resolved in Build: : None
Duplicate of:  None
Voting and Rating
Overall Rating: No Ratings Yet
0.00 out of 5
Total Votes: None
Description
Example function:

function test: integer;
begin
  result := 10;
  result := result + 1 + 2 + 3;
  result := result + 1 + 2 + 3;
  result := result + 1 + 2 + 3;
end;

This example generates such asm code (release mode):
mov eax, 10
add eax, 6
add eax, 6
add eax, 6
i.e. it's obviously folds constants at lines, but not propagates result futrher.

final code should be just
mov eax, 28

Steps to Reproduce:
None
Workarounds
None
Attachment
None
Comments

None

Server Response from: ETNACODE01