Browse Source

* do not switch around node subtrees if they have different resultdefs, e.g.
because a subtree has been optimized for a 32x32->64 multiplication (so
some subtrees have a 32 bit resultdef and others a 64 bit resultdef)

git-svn-id: trunk@30033 -

Jonas Maebe 10 năm trước cách đây
mục cha
commit
86bde57b0f
1 tập tin đã thay đổi với 7 bổ sung1 xóa
  1. 7 1
      compiler/optcse.pas

+ 7 - 1
compiler/optcse.pas

@@ -317,7 +317,13 @@ unit optcse;
                    { for sets, we can do this always }
                    (is_set(n.resultdef))
                    ) then
-                  while n.nodetype=tbinarynode(n).left.nodetype do
+                  while (n.nodetype=tbinarynode(n).left.nodetype) and
+                        { the resulttypes of the operands we'll swap must be equal,
+                          required in case of a 32x32->64 multiplication, then we
+                          cannot swap out one of the 32 bit operands for a 64 bit one
+                        }
+                        (tbinarynode(tbinarynode(n).left).left.resultdef=tbinarynode(n).left.resultdef) and
+                        (tbinarynode(n).left.resultdef=tbinarynode(n).right.resultdef) do
                     begin
                       csedomain:=true;
                       foreachnodestatic(pm_postprocess,tbinarynode(n).right,@searchsubdomain,@csedomain);