From ff90151e771208a6767566be5eb045f9ab5770db Mon Sep 17 00:00:00 2001 From: Stephen Heumann Date: Sat, 28 Oct 2017 22:16:10 -0500 Subject: [PATCH] Block invalid movement of bitfield accesses in common subexpression elimination. This fixes the problem in #44 for the case of using common subexpression elimination only. (Loop invariant removal still causes the problem.) --- DAG.pas | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/DAG.pas b/DAG.pas index 7616ac9..88777e0 100644 --- a/DAG.pas +++ b/DAG.pas @@ -2593,9 +2593,9 @@ var {kill indirect accesses on stores} {to indirectly-accessible locations} else if op1^.opcode in [pc_sto,pc_cpi,pc_iil,pc_ili,pc_idl,pc_ild, - pc_cup,pc_cui,pc_tl1,pc_ind] then begin + pc_cup,pc_cui,pc_tl1,pc_ind,pc_sbf,pc_cbf] then begin if list^.opcode in [pc_sto,pc_cpi,pc_iil,pc_ili,pc_idl,pc_ild, - pc_cup,pc_cui,pc_tl1] then begin + pc_cup,pc_cui,pc_tl1,pc_sbf,pc_cbf] then begin kill := true; stop := true; end {if} @@ -2614,8 +2614,9 @@ var end {if} end {else if} else if list^.opcode in [pc_sto,pc_cpi,pc_iil,pc_ili,pc_idl,pc_ild, - pc_cup,pc_cui,pc_tl1] then - if Member(op1, c_ind) then begin + pc_cup,pc_cui,pc_tl1,pc_sbf,pc_cbf] then + if Member(op1, c_ind) or (op1^.opcode in [pc_lbf,pc_lbu]) then + begin kill := true; stop := true; end; {if}