瀏覽代碼

* x86: Arithmetic combination optimisations are now much more careful about the flags being in use

J. Gareth "Curious Kit" Moreton 1 年之前
父節點
當前提交
ebe7bc8097
共有 1 個文件被更改,包括 4 次插入3 次删除
  1. 4 3
      compiler/x86/aoptx86.pas

+ 4 - 3
compiler/x86/aoptx86.pas

@@ -6803,9 +6803,10 @@ unit aoptx86;
 
         SubInstr := (taicpu(p).opcode = A_SUB);
 
-        if GetLastInstruction(p, hp1) and
-           (hp1.typ = ait_instruction) and
-           (taicpu(hp1).opsize = taicpu(p).opsize) then
+        if not RegInUsedRegs(NR_DEFAULTFLAGS, UsedRegs) and
+          GetLastInstruction(p, hp1) and
+          (hp1.typ = ait_instruction) and
+          (taicpu(hp1).opsize = taicpu(p).opsize) then
           begin
             if not (taicpu(p).opsize in [S_B, S_W, S_L{$ifdef x86_64}, S_Q{$endif x86_64}]) then
               { Bad size }