[Chapel Merge] Use newer strategy instead of isOuterVar

Branch: refs/heads/main
Revision: c1acc9d
Author: mppf
Log Message:

Merge pull request #18378 from mppf/follow-up-18341

Use newer strategy instead of isOuterVar

The updates to flattenFunctions in PR #18341 change the time in which an
argument is added for multiple nested functions referring to outer
variables. In particular, when propagating outer variables to other call
sites, the arguments are added to inner functions even if they are
visible in normal scoping. (Since these functions won't be inner
functions anymore by the time the pass completes). However, I had left
the part of the pass deciding which variables should be added initially
using the old logic that considered whether the variable was visible with
regular scoping. This created problems with numa configurations because
the pass was using now two different definitions for what an "outer"
variable is.

This PR addresses the problems with numa configurations by making the
initial determination of what variables to add use the more simple local
rule (looking for which function it is defined in) rather than the
isOuterVar logic.

Reviewed by @e-kayrakli - thanks!