fpc 3.1.1  on i386
-O3

function FOO: Boolean;  inline;
begin
  Result := FMem <> nil;
end;

function BAR: TPItemT;
begin
  if FOO
  then Result := nil
else Result := TPItemT(FMem.FirstItemPointer + (Index * FItemSize.ItemSize));
end;

generates something like:

005EACF0 833A00                   cmp dword ptr [edx],$00
005EACF3 0F95C0                   setnz al
005EACF6 84C0                     test al,al
005EACF8 7509                     jnz +$09

Is that something that should be optimized away?

al represents the nz flag

test al,al restores the nz flag, to what it already is. hat seems pointless.
_______________________________________________
fpc-devel maillist  -  [email protected]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply via email to