f79f50cd547d0582af15aebd3a0413136b9311ae added a pass that has an
iteration variable that is only used behind a LLVM_DEBUG macro which are
no-op in release builds, thus leaving the variable unused.
Introduce a pass to canonicalize live-in values for regions that will be
outlined for device execution.
When a region is outlined, values defined outside but used inside become
arguments to the outlined function. However, some values cannot or
should not be passed as arguments:
- Synthetic types (shape metadata, field indices)
- Constants better recreated inside the region
- Address-of operations for device-resident globals
This pass identifies such values and either sinks the defining operation
into the region (when all uses are inside) or clones it inside (when
uses exist both inside and outside).
To identify target regions in a dialect-agnostic way, this patch
introduces `OffloadRegionOpInterface`. This marker interface allows the
pass to work uniformly across OpenACC compute constructs, GPU
operations, and other offload dialects without hardcoding operation
types. The interface is attached to `acc.parallel`, `acc.kernels`, and
`acc.serial` directly through TableGen. It is also being attached to
`gpu.launch` and `cuf.kernel`, the latter through the FIR OpenACC
extensions.
The pass leverages existing interfaces for candidate detection:
`OutlineRematerializationOpInterface` marks operations producing
non-argument-passable values, while `ViewLikeOpInterface` and
`PartialEntityAccessOpInterface` allow tracing through casts and views
to find original defining operations. OpenACCSupport analysis provides
symbol validation for address-of operations.