瀏覽代碼

* remove the redundant equal typeconv, left over as an artifact after removing
the unnecessary widening of intermediary calculations to 64-bit. This allows,
among other things, the x:=x+k optimization to be applied in the case of
signed32:=signed32+unsigned32 types.

git-svn-id: trunk@36191 -

nickysn 8 年之前
父節點
當前提交
460dd1c10a
共有 1 個文件被更改,包括 8 次插入0 次删除
  1. 8 0
      compiler/ncnv.pas

+ 8 - 0
compiler/ncnv.pas

@@ -3064,6 +3064,14 @@ implementation
                   checkremovebiginttypeconvs(left,foundsint,[s8bit,u8bit],int64(low(shortint)),high(byte)) then
                   checkremovebiginttypeconvs(left,foundsint,[s8bit,u8bit],int64(low(shortint)),high(byte)) then
                     doremoveinttypeconvs(left,generrordef,not foundsint,s8inttype,u8inttype);
                     doremoveinttypeconvs(left,generrordef,not foundsint,s8inttype,u8inttype);
 {$endif defined(cpu8bitalu)}
 {$endif defined(cpu8bitalu)}
+                  { the above simplification may have left a redundant equal
+                    typeconv (e.g. int32 to int32). If that's the case, we remove it }
+                  if equal_defs(left.resultdef,resultdef) then
+                    begin
+                      result:=left;
+                      left:=nil;
+                      exit;
+                    end;
                 end;
                 end;
             end;
             end;
         end;
         end;