mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-24 16:09:21 +02:00
* patch by J. Gareth Moreton: deadstore removal improvement, resolves #36669
git-svn-id: trunk@44147 -
This commit is contained in:
parent
b1900bae9e
commit
e7d2c93ca7
@ -2578,11 +2578,24 @@ unit aoptx86;
|
|||||||
result)
|
result)
|
||||||
}
|
}
|
||||||
if IsExitCode(hp1) and
|
if IsExitCode(hp1) and
|
||||||
MatchOpType(taicpu(p),top_reg,top_ref) and
|
(taicpu(p).oper[1]^.typ = top_ref) and
|
||||||
|
(taicpu(p).oper[1]^.ref^.index = NR_NO) and
|
||||||
|
(
|
||||||
|
(
|
||||||
(taicpu(p).oper[1]^.ref^.base = current_procinfo.FramePointer) and
|
(taicpu(p).oper[1]^.ref^.base = current_procinfo.FramePointer) and
|
||||||
not(assigned(current_procinfo.procdef.funcretsym) and
|
not (
|
||||||
(taicpu(p).oper[1]^.ref^.offset < tabstractnormalvarsym(current_procinfo.procdef.funcretsym).localloc.reference.offset)) and
|
assigned(current_procinfo.procdef.funcretsym) and
|
||||||
(taicpu(p).oper[1]^.ref^.index = NR_NO) then
|
(taicpu(p).oper[1]^.ref^.offset <= tabstractnormalvarsym(current_procinfo.procdef.funcretsym).localloc.reference.offset)
|
||||||
|
)
|
||||||
|
) or
|
||||||
|
{ Also discard writes to the stack that are below the base pointer,
|
||||||
|
as this is temporary storage rather than a function result on the
|
||||||
|
stack, say. }
|
||||||
|
(
|
||||||
|
(taicpu(p).oper[1]^.ref^.base = NR_STACK_POINTER_REG) and
|
||||||
|
(taicpu(p).oper[1]^.ref^.offset < current_procinfo.final_localsize)
|
||||||
|
)
|
||||||
|
) then
|
||||||
begin
|
begin
|
||||||
asml.remove(p);
|
asml.remove(p);
|
||||||
p.free;
|
p.free;
|
||||||
|
Loading…
Reference in New Issue
Block a user