On 25/06/2019 10:19, denisgolovan wrote: >> Can I have an example of "hoisting pure functions out of loops" that you >> speak of? > > Sure. > I mean something like following (completely artificial example): > > function PureFunc1: ... > function F(arg: Integer): Integer; > var s:Integer; > begin > s:=0; > for i:=0 to 100 do > s:=s+PureFunc(arg); > Result:=s; > end;
You don't need any kind of new source code constructs for optimizing that. The LLVM backend can already do that; in the worst case, only when LTO is enabled (in case the function is declared in another unit) Jonas _______________________________________________ fpc-devel maillist - fpc-devel@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel