From 98eab07abd080e37907c99ef0934a62a54574df3 Mon Sep 17 00:00:00 2001 From: florian Date: Sun, 15 Nov 2020 16:17:54 +0000 Subject: [PATCH] * simplified and fixed code of (v1=const1) and (v2=const2) optimization, resolves #38066 git-svn-id: trunk@47423 - --- compiler/nadd.pas | 50 +++++++++++++++++++---------------------------- 1 file changed, 20 insertions(+), 30 deletions(-) diff --git a/compiler/nadd.pas b/compiler/nadd.pas index 28fe897925..ce1ab9743a 100644 --- a/compiler/nadd.pas +++ b/compiler/nadd.pas @@ -1427,37 +1427,27 @@ implementation end; if v1p^.resultdef.size=v2p^.resultdef.size then begin - if not(is_integer(v1p^.resultdef)) or not(is_integer(v2p^.resultdef)) then - begin - case v1p^.resultdef.size of - 1: - inttype:=u8inttype; - 2: - inttype:=u16inttype; - 4: - inttype:=u32inttype; - 8: - inttype:=u64inttype; - else - Internalerror(2020060101); - end; + case v1p^.resultdef.size of + 1: + inttype:=u8inttype; + 2: + inttype:=u16inttype; + 4: + inttype:=u32inttype; + 8: + inttype:=u64inttype; + else + Internalerror(2020060101); + end; - result:=caddnode.create_internal(equaln, - caddnode.create_internal(orn, - caddnode.create_internal(xorn,ctypeconvnode.create_internal(v1p^.getcopy,inttype), - ctypeconvnode.create_internal(c1p^.getcopy,inttype)), - caddnode.create_internal(xorn,ctypeconvnode.create_internal(v2p^.getcopy,inttype), - ctypeconvnode.create_internal(c2p^.getcopy,inttype)) - ), - cordconstnode.create(0,inttype,false)); - end - else - result:=caddnode.create_internal(equaln, - caddnode.create_internal(orn, - caddnode.create_internal(xorn,v1p^.getcopy,c1p^.getcopy), - caddnode.create_internal(xorn,v2p^.getcopy,c2p^.getcopy) - ), - cordconstnode.create(0,v1p^.resultdef,false)); + result:=caddnode.create_internal(equaln, + caddnode.create_internal(orn, + caddnode.create_internal(xorn,ctypeconvnode.create_internal(v1p^.getcopy,inttype), + ctypeconvnode.create_internal(c1p^.getcopy,inttype)), + caddnode.create_internal(xorn,ctypeconvnode.create_internal(v2p^.getcopy,inttype), + ctypeconvnode.create_internal(c2p^.getcopy,inttype)) + ), + cordconstnode.create(0,inttype,false)); end; end; { even when short circuit boolean evaluation is active, this