mirror of
https://github.com/byteworksinc/ORCA-C.git
synced 2025-04-07 01:39:11 +00:00
Don't invalidly eliminate certain stores of 0 to global/static variables.
This could happen in native-code peephole optimization if two stz instructions targeting different global/static locations occurred consecutively. This was a regression introduced by commit a3170ea7. The following program demonstrates the problem: #pragma optimize 1+2+8+64 int i,j=1; int main (void) { i = 0; j = 0; return j; /* should return 0 */ }
This commit is contained in:
parent
4e7a7e67e7
commit
5312843b93
17
Native.pas
17
Native.pas
@ -1740,13 +1740,16 @@ var
|
||||
|
||||
{ kws }
|
||||
{ stz $xx, stz $xx }
|
||||
m_stz_abs, m_stz_absX, m_stz_dir, m_stz_dirX:
|
||||
if npeep[ns].opcode = npeep[ns+1].opcode then begin
|
||||
if npeep[ns].operand = npeep[ns+1].operand then begin
|
||||
Remove(ns+1)
|
||||
end; {if}
|
||||
|
||||
end; {if}
|
||||
m_stz_abs, m_stz_absX:
|
||||
if npeep[ns].opcode = npeep[ns+1].opcode then
|
||||
if npeep[ns].operand = npeep[ns+1].operand then
|
||||
if npeep[ns].name = npeep[ns+1].name then
|
||||
Remove(ns+1);
|
||||
|
||||
m_stz_dir, m_stz_dirX:
|
||||
if npeep[ns].opcode = npeep[ns+1].opcode then
|
||||
if npeep[ns].operand = npeep[ns+1].operand then
|
||||
Remove(ns+1);
|
||||
|
||||
otherwise: ;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user