mirror of
https://github.com/byteworksinc/ORCA-C.git
synced 2024-06-07 19:29:29 +00:00
Don't attempt bogus common subexpression elimination when loading structures on the stack.
Previously, the structure load would be treated as a common subexpression eligible for elimination, but the structure would always be treated as if it had a size of 4 bytes. If it did not, this would generally lead to a crash. (I'm also not sure if dependency analysis was being performed properly for these structures.) The following program illustrates the problem: #pragma optimize 17 struct mystruct { char x; } ms; static void foo(struct mystruct pk) {} int main(void) { struct mystruct *p = &ms; foo(*p); foo(*p); }
This commit is contained in:
parent
c46cf79c79
commit
e242f03501
2
DAG.pas
2
DAG.pas
|
@ -2420,6 +2420,8 @@ var
|
||||||
end {else if}
|
end {else if}
|
||||||
else if opcode = pc_stk then
|
else if opcode = pc_stk then
|
||||||
Block := true
|
Block := true
|
||||||
|
else if opcode = pc_psh then
|
||||||
|
Block := true
|
||||||
else if opcode = pc_cnv then
|
else if opcode = pc_cnv then
|
||||||
if op^.q & $000F = ord(cgVoid) then
|
if op^.q & $000F = ord(cgVoid) then
|
||||||
Block := true;
|
Block := true;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user