From be91f1d1cc18c6a96899bfd5096cb0cd7c7fbd8a Mon Sep 17 00:00:00 2001 From: Stephen Heumann Date: Mon, 21 Dec 2015 00:11:23 -0600 Subject: [PATCH] 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. --- DAG.pas | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/DAG.pas b/DAG.pas index 171bdbb..3379b57 100644 --- a/DAG.pas +++ b/DAG.pas @@ -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}