[mlir][acc] Add utilities for converting acc.loop to scf (#172953)
Add OpenACCUtilsLoop.h/.cpp with utilities for converting acc.loop
operations to SCF dialect operations:
- convertACCLoopToSCFFor: Convert structured acc.loop to scf.for with
loop collapsing support
- convertACCLoopToSCFParallel: Convert acc.loop to scf.parallel
- convertUnstructuredACCLoopToSCFExecuteRegion: Convert unstructured
acc.loop (multi-block) to scf.execute_region
Key features:
- Automatic type conversion between integer types and index
- Inclusive-to-exclusive upper bound conversion
- Trip count calculation with clamping for negative counts
- Constant folding via createOrFold for cleaner IR
- Assertions to prevent misuse (e.g., builder inside loop region)
- Error emission for unsupported cases (loops with results)
Comprehensive unit tests covering these APIs are also added.
---------
Co-authored-by: Scott Manley <rscottmanley@nvidia.com>