From 20206500aaddf4c4fe99b9d76b19b92efa8474db Mon Sep 17 00:00:00 2001 From: Jonas Maebe Date: Mon, 14 May 2007 20:37:42 +0000 Subject: [PATCH] * don't change a sequence of shifts and sub/adds into a lea() in case the flags are read afterwards (broke shldl/sub/sbb sequence generated for 64 bit "*2", which appears in bitpacked size calculation) git-svn-id: trunk@7336 - --- .gitattributes | 1 + compiler/i386/popt386.pas | 4 +++- tests/test/tprec14.pp | 9 +++++++++ 3 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 tests/test/tprec14.pp diff --git a/.gitattributes b/.gitattributes index 165d241674..03fc400540 100644 --- a/.gitattributes +++ b/.gitattributes @@ -6879,6 +6879,7 @@ tests/test/tprec10.pp svneol=native#text/plain tests/test/tprec11.pp svneol=native#text/plain tests/test/tprec12.pp svneol=native#text/plain tests/test/tprec13.pp svneol=native#text/plain +tests/test/tprec14.pp svneol=native#text/plain tests/test/tprec2.pp svneol=native#text/plain tests/test/tprec3.pp svneol=native#text/plain tests/test/tprec4.pp svneol=native#text/plain diff --git a/compiler/i386/popt386.pas b/compiler/i386/popt386.pas index 2f411f6619..cb91f6053b 100644 --- a/compiler/i386/popt386.pas +++ b/compiler/i386/popt386.pas @@ -1497,7 +1497,9 @@ begin (((taicpu(hp1).opcode = A_INC) or (taicpu(hp1).opcode = A_DEC)) and (taicpu(hp1).oper[0]^.typ = Top_Reg) and - (taicpu(hp1).oper[0]^.reg = taicpu(p).oper[1]^.reg))) Do + (taicpu(hp1).oper[0]^.reg = taicpu(p).oper[1]^.reg))) and + (not GetNextInstruction(hp1,hp2) or + not instrReadsFlags(hp2)) Do begin TmpBool1 := False; if (taicpu(hp1).oper[0]^.typ = Top_Const) then diff --git a/tests/test/tprec14.pp b/tests/test/tprec14.pp new file mode 100644 index 0000000000..77e01ecf7f --- /dev/null +++ b/tests/test/tprec14.pp @@ -0,0 +1,9 @@ +type + tr = bitpacked record + l: longint; + end; + +begin + if bitsizeof(tr) <> 32 then + halt(1); +end.