* Don't widen boolean operands of taddnode if they will be converted to pasbool8 immediately thereafter, doing so only causes generation of useless code. Mantis #20843.

git-svn-id: trunk@20376 -
This commit is contained in:
sergei 2012-02-19 18:49:50 +00:00
parent f8f5c3cd23
commit eda5511ef9

View File

@ -1206,28 +1206,29 @@ implementation
end;
end;
{ 2 booleans? Make them equal to the largest boolean }
{ 2 booleans? }
if (is_boolean(ld) and is_boolean(rd)) then
begin
if (torddef(left.resultdef).size>torddef(right.resultdef).size) or
(is_cbool(left.resultdef) and not is_cbool(right.resultdef)) then
begin
right:=ctypeconvnode.create_internal(right,left.resultdef);
ttypeconvnode(right).convtype:=tc_bool_2_bool;
typecheckpass(right);
end
else if (torddef(left.resultdef).size<torddef(right.resultdef).size) or
(not is_cbool(left.resultdef) and is_cbool(right.resultdef)) then
begin
left:=ctypeconvnode.create_internal(left,right.resultdef);
ttypeconvnode(left).convtype:=tc_bool_2_bool;
typecheckpass(left);
end;
case nodetype of
xorn,
andn,
orn:
begin
{ Make sides equal to the largest boolean }
if (torddef(left.resultdef).size>torddef(right.resultdef).size) or
(is_cbool(left.resultdef) and not is_cbool(right.resultdef)) then
begin
right:=ctypeconvnode.create_internal(right,left.resultdef);
ttypeconvnode(right).convtype:=tc_bool_2_bool;
typecheckpass(right);
end
else if (torddef(left.resultdef).size<torddef(right.resultdef).size) or
(not is_cbool(left.resultdef) and is_cbool(right.resultdef)) then
begin
left:=ctypeconvnode.create_internal(left,right.resultdef);
ttypeconvnode(left).convtype:=tc_bool_2_bool;
typecheckpass(left);
end;
end;
ltn,
lten,