[Flang-dev] f18 and PRESENT
troyj at cray.com
Fri Oct 12 11:51:57 EDT 2018
I'm curious how f18 will translate PRESENT (Fortran 2018 16.9.152) given the various checks imposed by 220.127.116.11. There seems to be a trend toward using OPTIONAL arguments, which then litters code with PRESENT checks, frequently inside loops. Sometimes it's possible for a compiler to hoist the check and version the loop, but the difficulty of that process depends on how PRESENT is expanded. Will it be a single conditional or multiple nested conditionals? For example, for an OPTIONAL ALLOCATABLE dummy argument, one might need PRESENT to be something like:
IF (ARG_EXISTS(X)) THEN
IF (ALLOCATED(X)) THEN
! code originally guarded by IF (PRESENT(X))
So then an optimization pass that tries to hoist PRESENT from loops is faced with two nested conditions as opposed to one. I suppose the number of checks might depend on the dope vector format that f18 intends to use.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the flang-dev