* simplify all type conversions for formal constants even for LLVM and JVM

(since these happen at compile time and don't result in generated code,
     they never need extra type conversions in the code)

git-svn-id: trunk@40629 -
This commit is contained in:
Jonas Maebe 2018-12-24 22:09:48 +00:00
parent b1b559f283
commit dd29088430
2 changed files with 5 additions and 3 deletions

View File

@ -80,7 +80,7 @@ class function tllvmtypeconvnode.target_specific_need_equal_typeconv(fromdef, to
result:=
(fromdef<>todef) and
{ two procdefs that are structurally the same but semantically different
still need a convertion }
still need a conversion }
(
((fromdef.typ=procvardef) and
(todef.typ=procvardef))

View File

@ -350,7 +350,8 @@ implementation
if equal_defs(p.resultdef,def) and
(p.resultdef.typ=def.typ) and
not is_bitpacked_access(p) and
not ctypeconvnode.target_specific_need_equal_typeconv(p.resultdef,def) then
((p.blocktype=bt_const) or
not ctypeconvnode.target_specific_need_equal_typeconv(p.resultdef,def)) then
begin
{ don't replace encoded string constants to rawbytestring encoding.
preserve the codepage }
@ -2434,7 +2435,8 @@ implementation
{$ifdef llvm}
{ we still may have to insert a type conversion at the
llvm level }
if (left.resultdef<>resultdef) and
if (blocktype<>bt_const) and
(left.resultdef<>resultdef) and
{ if unspecialised generic -> we won't generate any code
for this, and keeping the type conversion node will
cause valid_for_assign to fail because the typecast will be from/to something of 0