+ also check the register type when checking for specific integer registers in

i386's TCpuAsmOptimizer.RegReadByInstruction. Previously, the lack of this
  check could generate false reads on some other register types (e.g. mmx/xmm/
  flags, etc.), and this could worsen optimizations.

git-svn-id: trunk@35957 -
This commit is contained in:
nickysn 2017-04-26 15:25:38 +00:00
parent 618b6292ee
commit 916c09af55

View File

@ -170,7 +170,7 @@ unit aoptcpu;
A_IDIV,A_DIV,A_MUL: A_IDIV,A_DIV,A_MUL:
begin begin
regReadByInstruction := regReadByInstruction :=
RegInOp(reg,p.oper[0]^) or (getsupreg(reg) in [RS_EAX,RS_EDX]); RegInOp(reg,p.oper[0]^) or ((getregtype(reg)=R_INTREGISTER) and (getsupreg(reg) in [RS_EAX,RS_EDX]));
end; end;
else else
begin begin
@ -182,6 +182,8 @@ unit aoptcpu;
exit exit
end; end;
with insprop[p.opcode] do with insprop[p.opcode] do
begin
if getregtype(reg)=R_INTREGISTER then
begin begin
case getsupreg(reg) of case getsupreg(reg) of
RS_EAX: RS_EAX:
@ -233,6 +235,7 @@ unit aoptcpu;
exit exit
end; end;
end; end;
end;
if SuperRegistersEqual(reg,NR_DEFAULTFLAGS) then if SuperRegistersEqual(reg,NR_DEFAULTFLAGS) then
begin begin
case getsubreg(reg) of case getsubreg(reg) of