Disable an invalid optimization that would suppress stores of address values when they appeared to the left of the comma operator.

This fixes the compca22.c test case.

This optimization could be fixed and re-enabled, but to do so, you would have to check if the stored value is ever used subsequently, which is not information that's readily available in the peephole optimization pass. It would also be necessary to check if there are any stores to the same location within the right-side expression, which could kill the optimization.
This commit is contained in:
Stephen Heumann 2015-12-21 00:11:23 -06:00
parent b9446a28a7
commit be91f1d1cc
1 changed files with 3 additions and 2 deletions

View File

@ -934,11 +934,12 @@ case op^.opcode of {check for optimizations of this node}
end; {case pc_bnl}
pc_bno: begin {pc_bno}
if op^.left^.opcode = pc_str then
{Invalid optimization disabled}
{if op^.left^.opcode = pc_str then
if op^.left^.left^.opcode in [pc_lda,pc_lao] then begin
ReplaceLoads(op^.left^.left, op^.left, op^.right);
opv := op^.right;
end; {if}
end;} {if}
end; {case pc_bno}
pc_bnt: begin {pc_bnt}