mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-28 21:40:34 +02:00
Fix interaction between peephole optimizers on ARM
Up until now DataMov2Data could be run on an strb generated by AndStrb2Strb. Code like this: and reg0, reg1, #255 strb reg0, [r13] mov reg2,reg1 would get transformed into: strb reg2, [r13] which is clearly wrong. The problem was that DataMov2Data expected that it's first parameter is an instruction which loads new data into oper[0]. With the introduction of AndStrb2Strb this wasn't true anymore. This fix now checks if the first register is actually written to, this is done by using regLoadedWithNewValue. git-svn-id: trunk@22622 -
This commit is contained in:
parent
5f3f7d862b
commit
29bac200dd
@ -321,7 +321,15 @@ Implementation
|
||||
not (
|
||||
(taicpu(p).opcode in [A_MLA, A_MUL]) and
|
||||
(taicpu(p).oper[1]^.reg = taicpu(movp).oper[0]^.reg)
|
||||
) then
|
||||
) and
|
||||
{ Take care to only do this for instructions which REALLY load to the first register.
|
||||
Otherwise
|
||||
str reg0, [reg1]
|
||||
mov reg2, reg0
|
||||
will be optimized to
|
||||
str reg2, [reg1]
|
||||
}
|
||||
not (regLoadedWithNewValue(taicpu(p).oper[0]^.reg, p)) then
|
||||
begin
|
||||
dealloc:=FindRegDeAlloc(taicpu(p).oper[0]^.reg,tai(movp.Next));
|
||||
if assigned(dealloc) then
|
||||
|
Loading…
Reference in New Issue
Block a user