[flang-commits] [flang] [mlir] [Flang][MLIR] Add `!$omp unroll` and `omp.unroll_heuristic` (PR #144785)
Michael Kruse via flang-commits
flang-commits at lists.llvm.org
Wed Jul 2 05:10:08 PDT 2025
================
@@ -0,0 +1,39 @@
+! RUN: %flang_fc1 -emit-hlfir -fopenmp -fopenmp-version=51 -o - %s 2>&1 | FileCheck %s
+
+
+subroutine omp_unroll_heuristic01(lb, ub, inc)
+ integer res, i, lb, ub, inc
+
+ !$omp unroll
+ do i = lb, ub, inc
+ res = i
+ end do
+ !$omp end unroll
+
+end subroutine omp_unroll_heuristic01
+
+
+!CHECK-LABEL: func.func @_QPomp_unroll_heuristic01(
+!CHECK: %c0_i32 = arith.constant 0 : i32
----------------
Meinersbur wrote:
This is not possible in MLIR: SSA value names are always automatically generated and cannot be user-provided. In this case there is a special handler for `arith.constant` that generates the name out of `c` (for constant), the value of the constant (`0`), and the type (`i32`). Without such a special handler, the value are just numbers. For values of type `omp.cli` I also defined such a special handler that generates names based on the nesting, see `NewCliOp::getAsmResultNames`.
https://github.com/llvm/llvm-project/pull/144785
More information about the flang-commits
mailing list