[flang-commits] [flang] [mlir] [MLIR][ODS] Strip EnumAttr parameters in struct formats (PR #220727)

Mehdi Amini via flang-commits flang-commits at lists.llvm.org
Wed Sep 2 13:49:25 PDT 2026


https://github.com/joker-eph created https://github.com/llvm/llvm-project/pull/220727

Add typed EnumAttr parameter wrappers for attribute and type definitions.

Parse and print their underlying enum values inside struct directives.

Assisted-by: Codex

>From 66d15d89c2d776471c371f748eca9a1f73728462 Mon Sep 17 00:00:00 2001
From: Mehdi Amini <joker.eph at gmail.com>
Date: Wed, 2 Sep 2026 11:43:05 -0700
Subject: [PATCH] [MLIR][ODS] Strip EnumAttr parameters in struct formats

Add typed EnumAttr parameter wrappers for attribute and type definitions.

Parse and print their underlying enum values inside struct directives.

Use the stripped form for OpenMP declare-target fields.

Assisted-by: Codex
---
 flang/docs/OpenMP-declare-target.md           |   2 +-
 flang/test/Fir/omp-declare-target-data.fir    |  44 +++---
 ...are-target-deferred-marking-reductions.f90 |   4 +-
 .../declare-target-deferred-marking.f90       |   8 +-
 ...arget-implicit-func-and-subr-cap-enter.f90 |  38 +++---
 ...lare-target-implicit-func-and-subr-cap.f90 |  42 +++---
 .../declare-target-implicit-tarop-cap.f90     |  14 +-
 .../declare-target-named-main-interface.f90   |   6 +-
 .../OpenMP/function-filtering-2.f90           |   8 +-
 flang/test/Lower/OpenMP/common-block-map.f90  |   2 +-
 .../test/Lower/OpenMP/declare-target-data.f90 |  40 +++---
 .../OpenMP/declare-target-func-and-subr.f90   |  46 +++----
 .../OpenMP/declare-target-multiple-entry.f90  |   6 +-
 .../OpenMP/declare-target-unnamed-main.f90    |   2 +-
 .../Lower/OpenMP/declare_target_module.f90    |  10 +-
 .../OpenMP/omp-declare-target-program-var.f90 |   2 +-
 .../Transforms/omp-automap-to-target-data.fir |   4 +-
 .../omp-function-filtering-todo.mlir          |   2 +-
 .../DefiningDialects/AttributesAndTypes.md    |   5 +
 .../mlir/Dialect/OpenMP/OpenMPAttrDefs.td     |   4 +-
 mlir/include/mlir/IR/EnumAttr.td              |  16 +++
 mlir/test/Dialect/OpenMP/attr.mlir            |  60 ++++----
 mlir/test/Dialect/OpenMP/function-filter.mlir |  22 +--
 .../Dialect/OpenMP/host-op-filtering.mlir     |  14 +-
 .../Dialect/OpenMP/invalid-interface.mlir     |   4 +-
 .../Dialect/OpenMP/mark-declare-target.mlir   |  88 ++++++------
 mlir/test/Dialect/OpenMP/stack-to-shared.mlir |   4 +-
 ...target-atomic-capture-control-options.mlir |   2 +-
 ...ptarget-atomic-update-control-options.mlir |   2 +-
 .../omptarget-constant-alloca-raise.mlir      |   2 +-
 .../LLVMIR/omptarget-debug-map-link-loc.mlir  |   2 +-
 ...eclare-target-all-device-types-device.mlir |  24 ++--
 ...target-declare-target-func-visibility.mlir |   8 +-
 ...mptarget-declare-target-llvm-device-2.mlir |   6 +-
 .../omptarget-declare-target-llvm-device.mlir |   2 +-
 .../omptarget-declare-target-llvm-host.mlir   |  34 ++---
 ...-declare-target-module-rewrite-device.mlir |  24 ++--
 .../omptarget-declare-target-to-device.mlir   |   2 +-
 .../omptarget-declare-target-to-host.mlir     |   2 +-
 .../LLVMIR/omptarget-device-shared-mem.mlir   |   2 +-
 .../LLVMIR/omptarget-multi-reduction.mlir     |   2 +-
 .../LLVMIR/omptarget-parallel-llvm.mlir       |   4 +-
 .../LLVMIR/omptarget-parallel-wsloop.mlir     |   2 +-
 .../Target/LLVMIR/omptarget-private-llvm.mlir |   4 +-
 ...distribute-reduction-array-descriptor.mlir |   4 +-
 .../omptarget-teams-distribute-reduction.mlir |   2 +-
 .../Target/LLVMIR/omptarget-teams-llvm.mlir   |   2 +-
 .../LLVMIR/omptarget-teams-reduction.mlir     |   2 +-
 .../LLVMIR/omptarget-wsloop-collapsed.mlir    |   2 +-
 mlir/test/Target/LLVMIR/omptarget-wsloop.mlir |   4 +-
 .../LLVMIR/openmp-data-target-device.mlir     |   2 +-
 .../Target/LLVMIR/openmp-llvm-invalid.mlir    |   8 +-
 mlir/test/Target/LLVMIR/openmp-llvm.mlir      |  18 +--
 .../openmp-target-private-shared-mem.mlir     |   4 +-
 mlir/test/lib/Dialect/Test/TestAttrDefs.td    |  28 ++++
 mlir/test/lib/Dialect/Test/TestEnumDefs.td    |  20 +++
 .../attr-or-type-format-roundtrip.mlir        |  13 ++
 mlir/test/mlir-tblgen/attr-or-type-format.td  |  60 ++++++++
 .../tools/mlir-tblgen/AttrOrTypeFormatGen.cpp | 128 +++++++++++++++---
 59 files changed, 572 insertions(+), 346 deletions(-)

diff --git a/flang/docs/OpenMP-declare-target.md b/flang/docs/OpenMP-declare-target.md
index e43a623cc9fb9..3a7d001d15846 100644
--- a/flang/docs/OpenMP-declare-target.md
+++ b/flang/docs/OpenMP-declare-target.md
@@ -79,7 +79,7 @@ would find on the `declare target` directive i.e. device type (`nohost`,
 
 ```
 fir.global internal @_QFEi {omp.declare_target =
-#omp.declaretarget<device_type = (any), capture_clause = (to)>} : f32 {
+#omp.declaretarget<device_type = any, capture_clause = to>} : f32 {
     %0 = fir.undefined f32
     fir.has_value %0 : f32
 }
diff --git a/flang/test/Fir/omp-declare-target-data.fir b/flang/test/Fir/omp-declare-target-data.fir
index 171ea8fe4fcc2..539a7acf267f2 100644
--- a/flang/test/Fir/omp-declare-target-data.fir
+++ b/flang/test/Fir/omp-declare-target-data.fir
@@ -2,11 +2,11 @@
 
 module attributes {omp.is_target_device = false} {
 
-  // CHECK: llvm.mlir.global external @_QMtest_0Earray_1d(dense<[1, 2, 3]> : tensor<3xi32>) {{{.*}}omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (link)>{{.*}}} : !llvm.array<3 x i32>
-  fir.global @_QMtest_0Earray_1d(dense<[1, 2, 3]> : tensor<3xi32>) {omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (link)>} : !fir.array<3xi32>
+  // CHECK: llvm.mlir.global external @_QMtest_0Earray_1d(dense<[1, 2, 3]> : tensor<3xi32>) {{{.*}}omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = link>{{.*}}} : !llvm.array<3 x i32>
+  fir.global @_QMtest_0Earray_1d(dense<[1, 2, 3]> : tensor<3xi32>) {omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = link>} : !fir.array<3xi32>
 
-  // CHECK: llvm.mlir.global external @_QMtest_0Earray_2d() {{{.*}}omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (link)>{{.*}}} : !llvm.array<2 x array<2 x i32>>
-  fir.global @_QMtest_0Earray_2d {omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (link)>} : !fir.array<2x2xi32> {
+  // CHECK: llvm.mlir.global external @_QMtest_0Earray_2d() {{{.*}}omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = link>{{.*}}} : !llvm.array<2 x array<2 x i32>>
+  fir.global @_QMtest_0Earray_2d {omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = link>} : !fir.array<2x2xi32> {
     %0 = fir.undefined !fir.array<2x2xi32>
     %c1_i32 = arith.constant 1 : i32
     %1 = fir.insert_value %0, %c1_i32, [0 : index, 0 : index] : (!fir.array<2x2xi32>, i32) -> !fir.array<2x2xi32>
@@ -21,57 +21,57 @@ module attributes {omp.is_target_device = false} {
     fir.has_value %4 : !fir.array<2x2xi32>
   }
 
-  // CHECK: llvm.mlir.global external @_QMtest_0Edata_extended_link_1() {{{.*}}omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (link)>{{.*}}} : f32
-  fir.global @_QMtest_0Edata_extended_link_1 {omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (link)>} : f32 {
+  // CHECK: llvm.mlir.global external @_QMtest_0Edata_extended_link_1() {{{.*}}omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = link>{{.*}}} : f32
+  fir.global @_QMtest_0Edata_extended_link_1 {omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = link>} : f32 {
     %cst = arith.constant 2.000000e+00 : f32
     fir.has_value %cst : f32
   }
 
-  // CHECK: llvm.mlir.global external @_QMtest_0Edata_extended_link_2() {{{.*}}omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (link)>{{.*}}} : f32
-  fir.global @_QMtest_0Edata_extended_link_2 {omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (link)>} : f32 {
+  // CHECK: llvm.mlir.global external @_QMtest_0Edata_extended_link_2() {{{.*}}omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = link>{{.*}}} : f32
+  fir.global @_QMtest_0Edata_extended_link_2 {omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = link>} : f32 {
     %cst = arith.constant 3.000000e+00 : f32
     fir.has_value %cst : f32
   }
 
-  // CHECK: llvm.mlir.global external @_QMtest_0Edata_extended_to_1() {{{.*}}omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (to)>{{.*}}} : f32
-  fir.global @_QMtest_0Edata_extended_to_1 {omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (to)>} : f32 {
+  // CHECK: llvm.mlir.global external @_QMtest_0Edata_extended_to_1() {{{.*}}omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = to>{{.*}}} : f32
+  fir.global @_QMtest_0Edata_extended_to_1 {omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = to>} : f32 {
     %cst = arith.constant 2.000000e+00 : f32
     fir.has_value %cst : f32
   }
 
-  // CHECK: llvm.mlir.global external @_QMtest_0Edata_extended_to_2() {{{.*}}omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (to)>{{.*}}} : f32 {
-  fir.global @_QMtest_0Edata_extended_to_2 {omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (to)>} : f32 {
+  // CHECK: llvm.mlir.global external @_QMtest_0Edata_extended_to_2() {{{.*}}omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = to>{{.*}}} : f32 {
+  fir.global @_QMtest_0Edata_extended_to_2 {omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = to>} : f32 {
     %cst = arith.constant 3.000000e+00 : f32
     fir.has_value %cst : f32
   }
 
-  // CHECK: llvm.mlir.global external @_QMtest_0Edata_int() {{{.*}}omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (link)>{{.*}}} : i32
-  fir.global @_QMtest_0Edata_int {omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (link)>} : i32 {
+  // CHECK: llvm.mlir.global external @_QMtest_0Edata_int() {{{.*}}omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = link>{{.*}}} : i32
+  fir.global @_QMtest_0Edata_int {omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = link>} : i32 {
     %c10_i32 = arith.constant 10 : i32
     fir.has_value %c10_i32 : i32
   }
 
-  // CHECK: llvm.mlir.global external @_QMtest_0Edata_int_clauseless() {{{.*}}omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (to)>{{.*}}} : i32
-  fir.global @_QMtest_0Edata_int_clauseless {omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (to)>} : i32 {
+  // CHECK: llvm.mlir.global external @_QMtest_0Edata_int_clauseless() {{{.*}}omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = to>{{.*}}} : i32
+  fir.global @_QMtest_0Edata_int_clauseless {omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = to>} : i32 {
     %c1_i32 = arith.constant 1 : i32
     fir.has_value %c1_i32 : i32
   }
 
-  // CHECK: llvm.mlir.global external @_QMtest_0Edata_int_to() {{{.*}}omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (to)>{{.*}}} : i32
-  fir.global @_QMtest_0Edata_int_to {omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (to)>} : i32 {
+  // CHECK: llvm.mlir.global external @_QMtest_0Edata_int_to() {{{.*}}omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = to>{{.*}}} : i32
+  fir.global @_QMtest_0Edata_int_to {omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = to>} : i32 {
     %c5_i32 = arith.constant 5 : i32
     fir.has_value %c5_i32 : i32
   }
 
-  // CHECK: llvm.mlir.global external @_QMtest_0Ept1() {{{.*}}omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (link)>{{.*}}} : !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8)> {
-  fir.global @_QMtest_0Ept1 {omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (link)>} : !fir.box<!fir.ptr<i32>> {
+  // CHECK: llvm.mlir.global external @_QMtest_0Ept1() {{{.*}}omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = link>{{.*}}} : !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8)> {
+  fir.global @_QMtest_0Ept1 {omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = link>} : !fir.box<!fir.ptr<i32>> {
     %0 = fir.zero_bits !fir.ptr<i32>
     %1 = fir.embox %0 : (!fir.ptr<i32>) -> !fir.box<!fir.ptr<i32>>
     fir.has_value %1 : !fir.box<!fir.ptr<i32>>
   }
 
-  // CHECK: llvm.mlir.global external @_QMtest_0Ept2_tar() {{{.*}}omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (link)>{{.*}}} : i32
-  fir.global @_QMtest_0Ept2_tar {omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (link)>} target : i32 {
+  // CHECK: llvm.mlir.global external @_QMtest_0Ept2_tar() {{{.*}}omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = link>{{.*}}} : i32
+  fir.global @_QMtest_0Ept2_tar {omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = link>} target : i32 {
     %c5_i32 = arith.constant 5 : i32
     fir.has_value %c5_i32 : i32
   }
diff --git a/flang/test/Integration/OpenMP/declare-target-deferred-marking-reductions.f90 b/flang/test/Integration/OpenMP/declare-target-deferred-marking-reductions.f90
index 124ec4b8ffbd7..ede40592426ef 100644
--- a/flang/test/Integration/OpenMP/declare-target-deferred-marking-reductions.f90
+++ b/flang/test/Integration/OpenMP/declare-target-deferred-marking-reductions.f90
@@ -39,6 +39,6 @@ end function mycombine
  end program main
 
 !CHECK: llvm.func @myinit(!llvm.ptr, !llvm.ptr)
-!CHECK-SAME: {{.*}}, omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (to), implicit = true>{{.*}}
+!CHECK-SAME: {{.*}}, omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = to, implicit = true>{{.*}}
 !CHECK-LABEL: llvm.func @mycombine(!llvm.ptr, !llvm.ptr)
-!CHECK-SAME: {{.*}}, omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (to), implicit = true>{{.*}}
+!CHECK-SAME: {{.*}}, omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = to, implicit = true>{{.*}}
diff --git a/flang/test/Integration/OpenMP/declare-target-deferred-marking.f90 b/flang/test/Integration/OpenMP/declare-target-deferred-marking.f90
index 8be7efd2619f1..8b2e02797ed2a 100644
--- a/flang/test/Integration/OpenMP/declare-target-deferred-marking.f90
+++ b/flang/test/Integration/OpenMP/declare-target-deferred-marking.f90
@@ -59,10 +59,10 @@ end subroutine unused_unemitted_interface
  end program main
 
 !HOST-LABEL: llvm.func @host_interface()
-!HOST-SAME: {{.*}}, omp.declare_target = #omp.declaretarget<device_type = (host), capture_clause = (enter)>{{.*}}
+!HOST-SAME: {{.*}}, omp.declare_target = #omp.declaretarget<device_type = host, capture_clause = enter>{{.*}}
 !ALL-LABEL: llvm.func @called_from_target_interface(!llvm.ptr, !llvm.ptr)
-!ALL-SAME: {{.*}}, omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (to), implicit = true>{{.*}}
+!ALL-SAME: {{.*}}, omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = to, implicit = true>{{.*}}
 !ALL-LABEL: llvm.func @any_interface()
-!ALL-SAME: {{.*}}, omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (enter)>{{.*}}
+!ALL-SAME: {{.*}}, omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = enter>{{.*}}
 !ALL-LABEL: llvm.func @device_interface()
-!ALL-SAME: {{.*}}, omp.declare_target = #omp.declaretarget<device_type = (nohost), capture_clause = (enter)>{{.*}}
+!ALL-SAME: {{.*}}, omp.declare_target = #omp.declaretarget<device_type = nohost, capture_clause = enter>{{.*}}
diff --git a/flang/test/Integration/OpenMP/declare-target-implicit-func-and-subr-cap-enter.f90 b/flang/test/Integration/OpenMP/declare-target-implicit-func-and-subr-cap-enter.f90
index 225a8f4bec855..b0a4cd75b9497 100644
--- a/flang/test/Integration/OpenMP/declare-target-implicit-func-and-subr-cap-enter.f90
+++ b/flang/test/Integration/OpenMP/declare-target-implicit-func-and-subr-cap-enter.f90
@@ -36,7 +36,7 @@ recursive subroutine implicitly_captured_recursive(increment)
 
    contains
    ! CHECK-LABEL: llvm.func{{.*}} @_QFPimplicitly_captured_twice
-   ! CHECK-SAME: {{.*}}attributes {{{.*}}omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (to), implicit = true>{{.*}}}
+   ! CHECK-SAME: {{.*}}attributes {{{.*}}omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = to, implicit = true>{{.*}}}
    function implicitly_captured_twice() result(k)
       integer :: i
       i = 10
@@ -44,7 +44,7 @@ function implicitly_captured_twice() result(k)
    end function implicitly_captured_twice
 
    ! CHECK-LABEL: llvm.func{{.*}} @_QFPtarget_function_twice_host()
-   ! CHECK-SAME: {{.*}}attributes {{{.*}}omp.declare_target = #omp.declaretarget<device_type = (host), capture_clause = (enter)>{{.*}}}
+   ! CHECK-SAME: {{.*}}attributes {{{.*}}omp.declare_target = #omp.declaretarget<device_type = host, capture_clause = enter>{{.*}}}
    function target_function_twice_host() result(i)
    !$omp declare target enter(target_function_twice_host) device_type(host)
       integer :: i
@@ -52,7 +52,7 @@ function target_function_twice_host() result(i)
    end function target_function_twice_host
 
    ! DEVICE-LABEL: llvm.func{{.*}} @_QFPtarget_function_twice_device()
-   ! DEVICE-SAME: {{.*}}attributes {{{.*}}omp.declare_target = #omp.declaretarget<device_type = (nohost), capture_clause = (enter)>{{.*}}}
+   ! DEVICE-SAME: {{.*}}attributes {{{.*}}omp.declare_target = #omp.declaretarget<device_type = nohost, capture_clause = enter>{{.*}}}
    function target_function_twice_device() result(i)
    !$omp declare target enter(target_function_twice_device) device_type(nohost)
       integer :: i
@@ -62,7 +62,7 @@ end function target_function_twice_device
    !! -----
 
    ! DEVICE-LABEL: llvm.func{{.*}} @_QFPimplicitly_captured_nest()
-   ! DEVICE-SAME: {{.*}}attributes {{{.*}}omp.declare_target = #omp.declaretarget<device_type = (nohost), capture_clause = (to), implicit = true>{{.*}}}
+   ! DEVICE-SAME: {{.*}}attributes {{{.*}}omp.declare_target = #omp.declaretarget<device_type = nohost, capture_clause = to, implicit = true>{{.*}}}
    function implicitly_captured_nest() result(k)
       integer :: i
       i = 10
@@ -70,13 +70,13 @@ function implicitly_captured_nest() result(k)
    end function implicitly_captured_nest
 
    ! DEVICE-LABEL: llvm.func{{.*}} @_QFPimplicitly_captured_one()
-   ! DEVICE-SAME: {{.*}}attributes {{{.*}}omp.declare_target = #omp.declaretarget<device_type = (nohost), capture_clause = (to), implicit = true>{{.*}}}
+   ! DEVICE-SAME: {{.*}}attributes {{{.*}}omp.declare_target = #omp.declaretarget<device_type = nohost, capture_clause = to, implicit = true>{{.*}}}
    function implicitly_captured_one() result(k)
       k = implicitly_captured_nest()
    end function implicitly_captured_one
 
    ! DEVICE-LABEL: llvm.func{{.*}} @_QFPimplicitly_captured_two()
-   ! DEVICE-SAME: {{.*}}attributes {{{.*}}omp.declare_target = #omp.declaretarget<device_type = (nohost), capture_clause = (to), implicit = true>{{.*}}}
+   ! DEVICE-SAME: {{.*}}attributes {{{.*}}omp.declare_target = #omp.declaretarget<device_type = nohost, capture_clause = to, implicit = true>{{.*}}}
    function implicitly_captured_two() result(k)
       integer :: i
       i = 10
@@ -84,7 +84,7 @@ function implicitly_captured_two() result(k)
    end function implicitly_captured_two
 
    ! DEVICE-LABEL: llvm.func{{.*}} @_QFPtarget_function_test()
-   ! DEVICE-SAME: {{.*}}attributes {{{.*}}omp.declare_target = #omp.declaretarget<device_type = (nohost), capture_clause = (enter)>{{.*}}}
+   ! DEVICE-SAME: {{.*}}attributes {{{.*}}omp.declare_target = #omp.declaretarget<device_type = nohost, capture_clause = enter>{{.*}}}
    function target_function_test() result(j)
    !$omp declare target enter(target_function_test) device_type(nohost)
       integer :: i, j
@@ -95,7 +95,7 @@ end function target_function_test
    !! -----
 
    ! CHECK-LABEL: llvm.func{{.*}} @_QFPimplicitly_captured_nest_twice()
-   ! CHECK-SAME: {{.*}}attributes {{{.*}}omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (to), implicit = true>{{.*}}}
+   ! CHECK-SAME: {{.*}}attributes {{{.*}}omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = to, implicit = true>{{.*}}}
    function implicitly_captured_nest_twice() result(k)
       integer :: i
       i = 10
@@ -103,13 +103,13 @@ function implicitly_captured_nest_twice() result(k)
    end function implicitly_captured_nest_twice
 
    ! CHECK-LABEL: llvm.func{{.*}} @_QFPimplicitly_captured_one_twice()
-   ! CHECK-SAME: {{.*}}attributes {{{.*}}omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (to), implicit = true>{{.*}}}
+   ! CHECK-SAME: {{.*}}attributes {{{.*}}omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = to, implicit = true>{{.*}}}
    function implicitly_captured_one_twice() result(k)
       k = implicitly_captured_nest_twice()
    end function implicitly_captured_one_twice
 
    ! CHECK-LABEL: llvm.func{{.*}} @_QFPimplicitly_captured_two_twice()
-   ! CHECK-SAME: {{.*}}attributes {{{.*}}omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (to), implicit = true>{{.*}}}
+   ! CHECK-SAME: {{.*}}attributes {{{.*}}omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = to, implicit = true>{{.*}}}
    function implicitly_captured_two_twice() result(k)
       integer :: i
       i = 10
@@ -117,7 +117,7 @@ function implicitly_captured_two_twice() result(k)
    end function implicitly_captured_two_twice
 
    ! DEVICE-LABEL: llvm.func{{.*}} @_QFPtarget_function_test_device()
-   ! DEVICE-SAME: {{.*}}attributes {{{.*}}omp.declare_target = #omp.declaretarget<device_type = (nohost), capture_clause = (enter)>{{.*}}}
+   ! DEVICE-SAME: {{.*}}attributes {{{.*}}omp.declare_target = #omp.declaretarget<device_type = nohost, capture_clause = enter>{{.*}}}
    function target_function_test_device() result(j)
       !$omp declare target enter(target_function_test_device) device_type(nohost)
       integer :: i, j
@@ -126,7 +126,7 @@ function target_function_test_device() result(j)
    end function target_function_test_device
 
    ! CHECK-LABEL: llvm.func{{.*}} @_QFPtarget_function_test_host()
-   ! CHECK-SAME: {{.*}}attributes {{{.*}}omp.declare_target = #omp.declaretarget<device_type = (host), capture_clause = (enter)>{{.*}}}
+   ! CHECK-SAME: {{.*}}attributes {{{.*}}omp.declare_target = #omp.declaretarget<device_type = host, capture_clause = enter>{{.*}}}
    function target_function_test_host() result(j)
       !$omp declare target enter(target_function_test_host) device_type(host)
       integer :: i, j
@@ -150,7 +150,7 @@ recursive function implicitly_captured_with_dev_type_recursive(increment) result
 end function implicitly_captured_with_dev_type_recursive
 
 ! DEVICE-LABEL: llvm.func @_QPtarget_function_with_dev_type_recurse()
-! DEVICE-SAME: {{.*}}attributes {{{.*}}omp.declare_target = #omp.declaretarget<device_type = (nohost), capture_clause = (enter)>{{.*}}}
+! DEVICE-SAME: {{.*}}attributes {{{.*}}omp.declare_target = #omp.declaretarget<device_type = nohost, capture_clause = enter>{{.*}}}
 function target_function_with_dev_type_recurse() result(i)
 !$omp declare target enter(target_function_with_dev_type_recurse) device_type(nohost)
    integer :: i
@@ -162,28 +162,28 @@ end function target_function_with_dev_type_recurse
 module test_module
 contains
 ! CHECK-LABEL: llvm.func @_QMtest_modulePimplicitly_captured_nest_twice()
-! CHECK-SAME: {{.*}}attributes {{{.*}}omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (to), implicit = true>{{.*}}}
+! CHECK-SAME: {{.*}}attributes {{{.*}}omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = to, implicit = true>{{.*}}}
    function implicitly_captured_nest_twice() result(i)
       integer :: i
       i = 10
    end function implicitly_captured_nest_twice
 
 ! CHECK-LABEL: llvm.func @_QMtest_modulePimplicitly_captured_one_twice()
-! CHECK-SAME: {{.*}}attributes {{{.*}}omp.declare_target = #omp.declaretarget<device_type = (host), capture_clause = (enter)>{{.*}}}
+! CHECK-SAME: {{.*}}attributes {{{.*}}omp.declare_target = #omp.declaretarget<device_type = host, capture_clause = enter>{{.*}}}
    function implicitly_captured_one_twice() result(k)
       !$omp declare target enter(implicitly_captured_one_twice) device_type(host)
       k = implicitly_captured_nest_twice()
    end function implicitly_captured_one_twice
 
 ! DEVICE-LABEL: llvm.func @_QMtest_modulePimplicitly_captured_two_twice()
-! DEVICE-SAME: {{.*}}attributes {{{.*}}omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (to), implicit = true>{{.*}}}
+! DEVICE-SAME: {{.*}}attributes {{{.*}}omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = to, implicit = true>{{.*}}}
    function implicitly_captured_two_twice() result(y)
       integer :: y
       y = 5
    end function implicitly_captured_two_twice
 
 ! DEVICE-LABEL: llvm.func @_QMtest_modulePtarget_function_test_device()
-! DEVICE-SAME: {{.*}}attributes {{{.*}}omp.declare_target = #omp.declaretarget<device_type = (nohost), capture_clause = (enter)>{{.*}}}
+! DEVICE-SAME: {{.*}}attributes {{{.*}}omp.declare_target = #omp.declaretarget<device_type = nohost, capture_clause = enter>{{.*}}}
    function target_function_test_device() result(j)
       !$omp declare target enter(target_function_test_device) device_type(nohost)
       integer :: i, j
@@ -195,7 +195,7 @@ end module test_module
 !! -----
 
 ! DEVICE-LABEL: llvm.func @_QPimplicitly_captured_recursive
-! DEVICE-SAME: {{.*}}attributes {{.*}}omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (to), implicit = true>{{.*}}}
+! DEVICE-SAME: {{.*}}attributes {{.*}}omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = to, implicit = true>{{.*}}}
 recursive subroutine implicitly_captured_recursive(increment)
    integer :: increment
    if (increment == 10) then
@@ -206,7 +206,7 @@ recursive subroutine implicitly_captured_recursive(increment)
 end subroutine
 
 ! DEVICE-LABEL: llvm.func @_QPcaller_recursive
-! DEVICE-SAME: {{.*}}attributes {{{.*}}omp.declare_target = #omp.declaretarget<device_type = (nohost), capture_clause = (enter)>{{.*}}}
+! DEVICE-SAME: {{.*}}attributes {{{.*}}omp.declare_target = #omp.declaretarget<device_type = nohost, capture_clause = enter>{{.*}}}
 subroutine caller_recursive
 !$omp declare target enter(caller_recursive) device_type(nohost)
    call implicitly_captured_recursive(0)
diff --git a/flang/test/Integration/OpenMP/declare-target-implicit-func-and-subr-cap.f90 b/flang/test/Integration/OpenMP/declare-target-implicit-func-and-subr-cap.f90
index 36954739a916d..c5382123e534b 100644
--- a/flang/test/Integration/OpenMP/declare-target-implicit-func-and-subr-cap.f90
+++ b/flang/test/Integration/OpenMP/declare-target-implicit-func-and-subr-cap.f90
@@ -37,7 +37,7 @@ recursive subroutine implicitly_captured_recursive(increment)
 
    contains
    ! CHECK-LABEL: llvm.func{{.*}} @_QFPimplicitly_captured(
-   ! CHECK-SAME: {{.*}}attributes {{{.*}}omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (to), implicit = true>{{.*}}}
+   ! CHECK-SAME: {{.*}}attributes {{{.*}}omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = to, implicit = true>{{.*}}}
    function implicitly_captured(toggle) result(k)
       integer :: i, j, k
       logical :: toggle
@@ -51,7 +51,7 @@ function implicitly_captured(toggle) result(k)
    end function implicitly_captured
 
    ! CHECK-LABEL: llvm.func{{.*}} @_QFPtarget_function(
-   ! CHECK-SAME: {{.*}}attributes {{{.*}}omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (to)>{{.*}}}
+   ! CHECK-SAME: {{.*}}attributes {{{.*}}omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = to>{{.*}}}
    function target_function(toggle) result(i)
    !$omp declare target
       integer :: i
@@ -62,7 +62,7 @@ end function target_function
    !! -----
 
    ! CHECK-LABEL: llvm.func{{.*}} @_QFPimplicitly_captured_twice()
-   ! CHECK-SAME: {{.*}}attributes {{{.*}}omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (to), implicit = true>{{.*}}}
+   ! CHECK-SAME: {{.*}}attributes {{{.*}}omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = to, implicit = true>{{.*}}}
    function implicitly_captured_twice() result(k)
       integer :: i
       i = 10
@@ -70,7 +70,7 @@ function implicitly_captured_twice() result(k)
    end function implicitly_captured_twice
 
    ! CHECK-LABEL: llvm.func{{.*}} @_QFPtarget_function_twice_host()
-   ! CHECK-SAME: {{.*}}attributes {{{.*}}omp.declare_target = #omp.declaretarget<device_type = (host), capture_clause = (to)>{{.*}}}
+   ! CHECK-SAME: {{.*}}attributes {{{.*}}omp.declare_target = #omp.declaretarget<device_type = host, capture_clause = to>{{.*}}}
    function target_function_twice_host() result(i)
    !$omp declare target to(target_function_twice_host) device_type(host)
       integer :: i
@@ -78,7 +78,7 @@ function target_function_twice_host() result(i)
    end function target_function_twice_host
 
    ! DEVICE-LABEL: llvm.func{{.*}} @_QFPtarget_function_twice_device()
-   ! DEVICE-SAME: {{.*}}attributes {{{.*}}omp.declare_target = #omp.declaretarget<device_type = (nohost), capture_clause = (to)>{{.*}}}
+   ! DEVICE-SAME: {{.*}}attributes {{{.*}}omp.declare_target = #omp.declaretarget<device_type = nohost, capture_clause = to>{{.*}}}
    function target_function_twice_device() result(i)
    !$omp declare target to(target_function_twice_device) device_type(nohost)
       integer :: i
@@ -88,7 +88,7 @@ end function target_function_twice_device
    !! -----
 
    ! DEVICE-LABEL: llvm.func{{.*}} @_QFPimplicitly_captured_nest()
-   ! DEVICE-SAME: {{.*}}attributes {{{.*}}omp.declare_target = #omp.declaretarget<device_type = (nohost), capture_clause = (to), implicit = true>{{.*}}}
+   ! DEVICE-SAME: {{.*}}attributes {{{.*}}omp.declare_target = #omp.declaretarget<device_type = nohost, capture_clause = to, implicit = true>{{.*}}}
    function implicitly_captured_nest() result(k)
       integer :: i
       i = 10
@@ -96,13 +96,13 @@ function implicitly_captured_nest() result(k)
    end function implicitly_captured_nest
 
    ! DEVICE-LABEL: llvm.func{{.*}} @_QFPimplicitly_captured_one()
-   ! DEVICE-SAME: {{.*}}attributes {{{.*}}omp.declare_target = #omp.declaretarget<device_type = (nohost), capture_clause = (to), implicit = true>{{.*}}}
+   ! DEVICE-SAME: {{.*}}attributes {{{.*}}omp.declare_target = #omp.declaretarget<device_type = nohost, capture_clause = to, implicit = true>{{.*}}}
    function implicitly_captured_one() result(k)
       k = implicitly_captured_nest()
    end function implicitly_captured_one
 
    ! DEVICE-LABEL: llvm.func{{.*}} @_QFPimplicitly_captured_two()
-   ! DEVICE-SAME: {{.*}}attributes {{{.*}}omp.declare_target = #omp.declaretarget<device_type = (nohost), capture_clause = (to), implicit = true>{{.*}}}
+   ! DEVICE-SAME: {{.*}}attributes {{{.*}}omp.declare_target = #omp.declaretarget<device_type = nohost, capture_clause = to, implicit = true>{{.*}}}
    function implicitly_captured_two() result(k)
       integer :: i
       i = 10
@@ -110,7 +110,7 @@ function implicitly_captured_two() result(k)
    end function implicitly_captured_two
 
    ! DEVICE-LABEL: llvm.func{{.*}} @_QFPtarget_function_test()
-   ! DEVICE-SAME: {{.*}}attributes {{{.*}}omp.declare_target = #omp.declaretarget<device_type = (nohost), capture_clause = (to)>{{.*}}}
+   ! DEVICE-SAME: {{.*}}attributes {{{.*}}omp.declare_target = #omp.declaretarget<device_type = nohost, capture_clause = to>{{.*}}}
    function target_function_test() result(j)
    !$omp declare target to(target_function_test) device_type(nohost)
       integer :: i, j
@@ -121,7 +121,7 @@ end function target_function_test
    !! -----
 
    ! CHECK-LABEL: llvm.func{{.*}} @_QFPimplicitly_captured_nest_twice()
-   ! CHECK-SAME: {{.*}}attributes {{{.*}}omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (to), implicit = true>{{.*}}}
+   ! CHECK-SAME: {{.*}}attributes {{{.*}}omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = to, implicit = true>{{.*}}}
    function implicitly_captured_nest_twice() result(k)
       integer :: i
       i = 10
@@ -129,13 +129,13 @@ function implicitly_captured_nest_twice() result(k)
    end function implicitly_captured_nest_twice
 
    ! CHECK-LABEL: llvm.func{{.*}} @_QFPimplicitly_captured_one_twice()
-   ! CHECK-SAME: {{.*}}attributes {{{.*}}omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (to), implicit = true>{{.*}}}
+   ! CHECK-SAME: {{.*}}attributes {{{.*}}omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = to, implicit = true>{{.*}}}
    function implicitly_captured_one_twice() result(k)
       k = implicitly_captured_nest_twice()
    end function implicitly_captured_one_twice
 
    ! CHECK-LABEL: llvm.func{{.*}} @_QFPimplicitly_captured_two_twice()
-   ! CHECK-SAME: {{.*}}attributes {{{.*}}omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (to), implicit = true>{{.*}}}
+   ! CHECK-SAME: {{.*}}attributes {{{.*}}omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = to, implicit = true>{{.*}}}
    function implicitly_captured_two_twice() result(k)
       integer :: i
       i = 10
@@ -143,7 +143,7 @@ function implicitly_captured_two_twice() result(k)
    end function implicitly_captured_two_twice
 
    ! DEVICE-LABEL: llvm.func{{.*}} @_QFPtarget_function_test_device()
-   ! DEVICE-SAME: {{.*}}attributes {{{.*}}omp.declare_target = #omp.declaretarget<device_type = (nohost), capture_clause = (to)>{{.*}}}
+   ! DEVICE-SAME: {{.*}}attributes {{{.*}}omp.declare_target = #omp.declaretarget<device_type = nohost, capture_clause = to>{{.*}}}
    function target_function_test_device() result(j)
       !$omp declare target to(target_function_test_device) device_type(nohost)
       integer :: i, j
@@ -152,7 +152,7 @@ function target_function_test_device() result(j)
    end function target_function_test_device
 
    ! CHECK-LABEL: llvm.func{{.*}} @_QFPtarget_function_test_host()
-   ! CHECK-SAME: {{.*}}attributes {{{.*}}omp.declare_target = #omp.declaretarget<device_type = (host), capture_clause = (to)>{{.*}}}
+   ! CHECK-SAME: {{.*}}attributes {{{.*}}omp.declare_target = #omp.declaretarget<device_type = host, capture_clause = to>{{.*}}}
    function target_function_test_host() result(j)
       !$omp declare target to(target_function_test_host) device_type(host)
       integer :: i, j
@@ -176,7 +176,7 @@ recursive function implicitly_captured_with_dev_type_recursive(increment) result
 end function implicitly_captured_with_dev_type_recursive
 
 ! DEVICE-LABEL: llvm.func @_QPtarget_function_with_dev_type_recurse()
-! DEVICE-SAME: {{.*}}attributes {{{.*}}omp.declare_target = #omp.declaretarget<device_type = (nohost), capture_clause = (to)>{{.*}}}
+! DEVICE-SAME: {{.*}}attributes {{{.*}}omp.declare_target = #omp.declaretarget<device_type = nohost, capture_clause = to>{{.*}}}
 function target_function_with_dev_type_recurse() result(i)
 !$omp declare target to(target_function_with_dev_type_recurse) device_type(nohost)
    integer :: i
@@ -188,28 +188,28 @@ end function target_function_with_dev_type_recurse
 module test_module
 contains
 ! CHECK-LABEL: llvm.func @_QMtest_modulePimplicitly_captured_nest_twice()
-! CHECK-SAME: {{.*}}attributes {{{.*}}omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (to), implicit = true>{{.*}}}
+! CHECK-SAME: {{.*}}attributes {{{.*}}omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = to, implicit = true>{{.*}}}
    function implicitly_captured_nest_twice() result(i)
       integer :: i
       i = 10
    end function implicitly_captured_nest_twice
 
 ! CHECK-LABEL: llvm.func @_QMtest_modulePimplicitly_captured_one_twice()
-! CHECK-SAME: {{.*}}attributes {{{.*}}omp.declare_target = #omp.declaretarget<device_type = (host), capture_clause = (to)>{{.*}}}
+! CHECK-SAME: {{.*}}attributes {{{.*}}omp.declare_target = #omp.declaretarget<device_type = host, capture_clause = to>{{.*}}}
    function implicitly_captured_one_twice() result(k)
       !$omp declare target to(implicitly_captured_one_twice) device_type(host)
       k = implicitly_captured_nest_twice()
    end function implicitly_captured_one_twice
 
 ! DEVICE-LABEL: llvm.func @_QMtest_modulePimplicitly_captured_two_twice()
-! DEVICE-SAME: {{.*}}attributes {{{.*}}omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (to), implicit = true>{{.*}}}
+! DEVICE-SAME: {{.*}}attributes {{{.*}}omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = to, implicit = true>{{.*}}}
    function implicitly_captured_two_twice() result(y)
       integer :: y
       y = 5
    end function implicitly_captured_two_twice
 
 ! DEVICE-LABEL: llvm.func @_QMtest_modulePtarget_function_test_device()
-! DEVICE-SAME: {{.*}}attributes {{{.*}}omp.declare_target = #omp.declaretarget<device_type = (nohost), capture_clause = (to)>{{.*}}}
+! DEVICE-SAME: {{.*}}attributes {{{.*}}omp.declare_target = #omp.declaretarget<device_type = nohost, capture_clause = to>{{.*}}}
    function target_function_test_device() result(j)
       !$omp declare target to(target_function_test_device) device_type(nohost)
       integer :: i, j
@@ -221,7 +221,7 @@ end module test_module
 !! -----
 
 ! DEVICE-LABEL: llvm.func @_QPimplicitly_captured_recursive
-! DEVICE-SAME: {{.*}}attributes {{.*}}omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (to), implicit = true>{{.*}}}
+! DEVICE-SAME: {{.*}}attributes {{.*}}omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = to, implicit = true>{{.*}}}
 recursive subroutine implicitly_captured_recursive(increment)
    integer :: increment
    if (increment == 10) then
@@ -232,7 +232,7 @@ recursive subroutine implicitly_captured_recursive(increment)
 end subroutine
 
 ! DEVICE-LABEL: llvm.func @_QPcaller_recursive
-! DEVICE-SAME: {{.*}}attributes {{{.*}}omp.declare_target = #omp.declaretarget<device_type = (nohost), capture_clause = (to)>{{.*}}}
+! DEVICE-SAME: {{.*}}attributes {{{.*}}omp.declare_target = #omp.declaretarget<device_type = nohost, capture_clause = to>{{.*}}}
 subroutine caller_recursive
 !$omp declare target to(caller_recursive) device_type(nohost)
    call implicitly_captured_recursive(0)
diff --git a/flang/test/Integration/OpenMP/declare-target-implicit-tarop-cap.f90 b/flang/test/Integration/OpenMP/declare-target-implicit-tarop-cap.f90
index 0d527df426a2d..6bfde64c3218c 100644
--- a/flang/test/Integration/OpenMP/declare-target-implicit-tarop-cap.f90
+++ b/flang/test/Integration/OpenMP/declare-target-implicit-tarop-cap.f90
@@ -23,7 +23,7 @@ program main
 
    contains
    ! DEVICE-LABEL: llvm.func{{.*}} @_QFPimplicit_capture()
-   ! DEVICE-SAME: {{.*}}attributes {{{.*}}omp.declare_target = #omp.declaretarget<device_type = (nohost), capture_clause = (to), implicit = true>{{.*}}}
+   ! DEVICE-SAME: {{.*}}attributes {{{.*}}omp.declare_target = #omp.declaretarget<device_type = nohost, capture_clause = to, implicit = true>{{.*}}}
    function implicit_capture() result(i)
       implicit none
       integer :: i
@@ -40,35 +40,35 @@ subroutine subr_target()
    !! -----
 
    ! CHECK-LABEL: llvm.func{{.*}} @_QFPimplicitly_captured_nest_twice()
-   ! CHECK-SAME: {{.*}}attributes {{{.*}}omp.declare_target = #omp.declaretarget<device_type = (host), capture_clause = (to), implicit = true>{{.*}}}
+   ! CHECK-SAME: {{.*}}attributes {{{.*}}omp.declare_target = #omp.declaretarget<device_type = host, capture_clause = to, implicit = true>{{.*}}}
    function implicitly_captured_nest_twice() result(i)
       integer :: i
       i = 10
    end function implicitly_captured_nest_twice
 
    ! CHECK-LABEL: llvm.func{{.*}} @_QFPimplicitly_captured_one_twice()
-   ! CHECK-SAME: {{.*}}attributes {{{.*}}omp.declare_target = #omp.declaretarget<device_type = (host), capture_clause = (to)>{{.*}}}
+   ! CHECK-SAME: {{.*}}attributes {{{.*}}omp.declare_target = #omp.declaretarget<device_type = host, capture_clause = to>{{.*}}}
    function implicitly_captured_one_twice() result(k)
    !$omp declare target to(implicitly_captured_one_twice) device_type(host)
       k = implicitly_captured_nest_twice()
    end function implicitly_captured_one_twice
 
    ! CHECK-LABEL: llvm.func{{.*}} @_QFPimplicitly_captured_nest_twice_enter()
-   ! CHECK-SAME: {{.*}}attributes {{{.*}}omp.declare_target = #omp.declaretarget<device_type = (host), capture_clause = (to), implicit = true>{{.*}}}
+   ! CHECK-SAME: {{.*}}attributes {{{.*}}omp.declare_target = #omp.declaretarget<device_type = host, capture_clause = to, implicit = true>{{.*}}}
    function implicitly_captured_nest_twice_enter() result(i)
       integer :: i
       i = 10
    end function implicitly_captured_nest_twice_enter
 
    ! CHECK-LABEL: llvm.func{{.*}} @_QFPimplicitly_captured_one_twice_enter()
-   ! CHECK-SAME: {{.*}}attributes {{{.*}}omp.declare_target = #omp.declaretarget<device_type = (host), capture_clause = (enter)>{{.*}}}
+   ! CHECK-SAME: {{.*}}attributes {{{.*}}omp.declare_target = #omp.declaretarget<device_type = host, capture_clause = enter>{{.*}}}
    function implicitly_captured_one_twice_enter() result(k)
    !$omp declare target enter(implicitly_captured_one_twice_enter) device_type(host)
       k = implicitly_captured_nest_twice_enter()
    end function implicitly_captured_one_twice_enter
 
    ! DEVICE-LABEL: llvm.func{{.*}} @_QFPimplicitly_captured_two_twice()
-   ! DEVICE-SAME: {{.*}}attributes {{{.*}}omp.declare_target = #omp.declaretarget<device_type = (nohost), capture_clause = (to), implicit = true>{{.*}}}
+   ! DEVICE-SAME: {{.*}}attributes {{{.*}}omp.declare_target = #omp.declaretarget<device_type = nohost, capture_clause = to, implicit = true>{{.*}}}
    function implicitly_captured_two_twice() result(y)
       integer :: y
       y = 5
@@ -86,7 +86,7 @@ end function target_function_test_device
    !! -----
 
    ! DEVICE-LABEL: llvm.func{{.*}} @_QFPimplicitly_captured_recursive(
-   ! DEVICE-SAME: {{.*}}attributes {{.*}}omp.declare_target = #omp.declaretarget<device_type = (nohost), capture_clause = (to), implicit = true>{{.*}}}
+   ! DEVICE-SAME: {{.*}}attributes {{.*}}omp.declare_target = #omp.declaretarget<device_type = nohost, capture_clause = to, implicit = true>{{.*}}}
    recursive function implicitly_captured_recursive(increment) result(k)
       integer :: increment, k
       if (increment == 10) then
diff --git a/flang/test/Integration/OpenMP/declare-target-named-main-interface.f90 b/flang/test/Integration/OpenMP/declare-target-named-main-interface.f90
index 5303260e5e45e..7f85324fc6869 100644
--- a/flang/test/Integration/OpenMP/declare-target-named-main-interface.f90
+++ b/flang/test/Integration/OpenMP/declare-target-named-main-interface.f90
@@ -14,9 +14,9 @@
 ! program (_QQmain) as a declare-target function while still correctly
 ! marking the declared subroutine (sub_a) as device_type(any).
 
-! CHECK-NOT: llvm.func @_QQmain{{.*}}device_type = (any)
-! CHECK-NOT: llvm.func @_QQmain{{.*}}device_type = (nohost)
-! CHECK: llvm.func @_QPsub_a{{.*}}device_type = (any), {{.*}}sym_visibility = "private"
+! CHECK-NOT: llvm.func @_QQmain{{.*}}device_type = any
+! CHECK-NOT: llvm.func @_QQmain{{.*}}device_type = nohost
+! CHECK: llvm.func @_QPsub_a{{.*}}device_type = any, {{.*}}sym_visibility = "private"
 
 program named_main
   interface
diff --git a/flang/test/Integration/OpenMP/function-filtering-2.f90 b/flang/test/Integration/OpenMP/function-filtering-2.f90
index a5bb5d2165fe7..cc6fa0b938e1e 100644
--- a/flang/test/Integration/OpenMP/function-filtering-2.f90
+++ b/flang/test/Integration/OpenMP/function-filtering-2.f90
@@ -24,13 +24,13 @@ program main
     !$omp end target
 
     contains
-    ! MLIR-ALL: llvm.func{{.*}} @{{.*}}implicit_invocation() attributes {{{.*}}omp.declare_target = #omp.declaretarget<device_type = (nohost), capture_clause = (to), implicit = true>{{.*}}}
+    ! MLIR-ALL: llvm.func{{.*}} @{{.*}}implicit_invocation() attributes {{{.*}}omp.declare_target = #omp.declaretarget<device_type = nohost, capture_clause = to, implicit = true>{{.*}}}
     ! MLIR-ALL: llvm.return
     ! LLVM-ALL: define {{.*}} @{{.*}}implicit_invocation{{.*}}(
     subroutine implicit_invocation()
     end subroutine implicit_invocation
 
-    ! MLIR-ALL: llvm.func{{.*}} @{{.*}}declaretarget() attributes {{{.*}}omp.declare_target = #omp.declaretarget<device_type = (nohost), capture_clause = (to)>{{.*}}}
+    ! MLIR-ALL: llvm.func{{.*}} @{{.*}}declaretarget() attributes {{{.*}}omp.declare_target = #omp.declaretarget<device_type = nohost, capture_clause = to>{{.*}}}
     ! MLIR-ALL: llvm.return
     ! LLVM-ALL: define {{.*}} @{{.*}}declaretarget{{.*}}(
     subroutine declaretarget()
@@ -38,7 +38,7 @@ subroutine declaretarget()
         call implicit_invocation()
     end subroutine declaretarget
 
-    ! MLIR-ALL: llvm.func{{.*}} @{{.*}}declaretarget_enter() attributes {{{.*}}omp.declare_target = #omp.declaretarget<device_type = (nohost), capture_clause = (enter)>{{.*}}}
+    ! MLIR-ALL: llvm.func{{.*}} @{{.*}}declaretarget_enter() attributes {{{.*}}omp.declare_target = #omp.declaretarget<device_type = nohost, capture_clause = enter>{{.*}}}
     ! MLIR-ALL: llvm.return
     ! LLVM-ALL: define {{.*}} @{{.*}}declaretarget_enter{{.*}}(
     subroutine declaretarget_enter()
@@ -46,7 +46,7 @@ subroutine declaretarget_enter()
         call implicit_invocation()
     end subroutine declaretarget_enter
 
-    ! MLIR-ALL: llvm.func{{.*}} @{{.*}}no_declaretarget() attributes {{{.*}}omp.declare_target = #omp.declaretarget<device_type = (nohost), capture_clause = (to), implicit = true>{{.*}}}
+    ! MLIR-ALL: llvm.func{{.*}} @{{.*}}no_declaretarget() attributes {{{.*}}omp.declare_target = #omp.declaretarget<device_type = nohost, capture_clause = to, implicit = true>{{.*}}}
     ! MLIR-ALL: llvm.return
     ! LLVM-ALL: define {{.*}} @{{.*}}no_declaretarget{{.*}}(
     subroutine no_declaretarget()
diff --git a/flang/test/Lower/OpenMP/common-block-map.f90 b/flang/test/Lower/OpenMP/common-block-map.f90
index 42547bf7b8f4d..db6202015f8b4 100644
--- a/flang/test/Lower/OpenMP/common-block-map.f90
+++ b/flang/test/Lower/OpenMP/common-block-map.f90
@@ -1,7 +1,7 @@
 !RUN: %flang_fc1 -emit-hlfir -fopenmp %s -o - | FileCheck %s
 
 !CHECK: fir.global common @var_common_(dense<0> : vector<8xi8>) {{.*}} : !fir.array<8xi8>
-!CHECK: fir.global common @var_common_link_(dense<0> : vector<8xi8>) {{{.*}} omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (link)>} : !fir.array<8xi8>
+!CHECK: fir.global common @var_common_link_(dense<0> : vector<8xi8>) {{{.*}} omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = link>} : !fir.array<8xi8>
 
 !CHECK-LABEL: func.func @_QPmap_full_block
 !CHECK: %[[CB_ADDR:.*]] = fir.address_of(@var_common_) : !fir.ref<!fir.array<8xi8>>
diff --git a/flang/test/Lower/OpenMP/declare-target-data.f90 b/flang/test/Lower/OpenMP/declare-target-data.f90
index d4f1fb273e068..6bfcbb09427d2 100644
--- a/flang/test/Lower/OpenMP/declare-target-data.f90
+++ b/flang/test/Lower/OpenMP/declare-target-data.f90
@@ -4,61 +4,61 @@
 module test_0
     implicit none
 
-!CHECK-DAG: fir.global @_QMtest_0Edata_int {omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (link)>} : i32
+!CHECK-DAG: fir.global @_QMtest_0Edata_int {omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = link>} : i32
 INTEGER :: data_int = 10
 !$omp declare target link(data_int)
 
-!CHECK-DAG: fir.global @_QMtest_0Earray_1d({{.*}}) {alignment = 64 : i64, omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (link)>} : !fir.array<3xi32>
+!CHECK-DAG: fir.global @_QMtest_0Earray_1d({{.*}}) {alignment = 64 : i64, omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = link>} : !fir.array<3xi32>
 INTEGER :: array_1d(3) = (/1,2,3/)
 !$omp declare target link(array_1d)
 
-!CHECK-DAG: fir.global @_QMtest_0Earray_2d({{.*}}) {alignment = 64 : i64, omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (link)>} : !fir.array<2x2xi32>
+!CHECK-DAG: fir.global @_QMtest_0Earray_2d({{.*}}) {alignment = 64 : i64, omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = link>} : !fir.array<2x2xi32>
 INTEGER :: array_2d(2,2) = reshape((/1,2,3,4/), (/2,2/))
 !$omp declare target link(array_2d)
 
-!CHECK-DAG: fir.global @_QMtest_0Ept1 {omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (link)>} : !fir.box<!fir.ptr<i32>>
+!CHECK-DAG: fir.global @_QMtest_0Ept1 {omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = link>} : !fir.box<!fir.ptr<i32>>
 INTEGER, POINTER :: pt1
 !$omp declare target link(pt1)
 
-!CHECK-DAG: fir.global @_QMtest_0Ept2_tar {omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (link)>} target : i32
+!CHECK-DAG: fir.global @_QMtest_0Ept2_tar {omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = link>} target : i32
 INTEGER, TARGET :: pt2_tar = 5
 !$omp declare target link(pt2_tar)
 
-!CHECK-DAG: fir.global @_QMtest_0Ept2 {omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (link)>} : !fir.box<!fir.ptr<i32>>
+!CHECK-DAG: fir.global @_QMtest_0Ept2 {omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = link>} : !fir.box<!fir.ptr<i32>>
 INTEGER, POINTER :: pt2 => pt2_tar
 !$omp declare target link(pt2)
 
-!CHECK-DAG: fir.global @_QMtest_0Edata_int_to {omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (to)>} : i32
+!CHECK-DAG: fir.global @_QMtest_0Edata_int_to {omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = to>} : i32
 INTEGER :: data_int_to = 5
 !$omp declare target to(data_int_to)
 
-!CHECK-DAG: fir.global @_QMtest_0Edata_int_enter {omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (enter)>} : i32
+!CHECK-DAG: fir.global @_QMtest_0Edata_int_enter {omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = enter>} : i32
 INTEGER :: data_int_enter = 5
 !$omp declare target enter(data_int_enter)
 
-!CHECK-DAG: fir.global @_QMtest_0Edata_int_clauseless {omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (to)>} : i32
+!CHECK-DAG: fir.global @_QMtest_0Edata_int_clauseless {omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = to>} : i32
 INTEGER :: data_int_clauseless = 1
 !$omp declare target(data_int_clauseless)
 
-!CHECK-DAG: fir.global @_QMtest_0Edata_extended_to_1 {omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (to)>} : f32
-!CHECK-DAG: fir.global @_QMtest_0Edata_extended_to_2 {omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (to)>} : f32
+!CHECK-DAG: fir.global @_QMtest_0Edata_extended_to_1 {omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = to>} : f32
+!CHECK-DAG: fir.global @_QMtest_0Edata_extended_to_2 {omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = to>} : f32
 REAL :: data_extended_to_1 = 2
 REAL :: data_extended_to_2 = 3
 !$omp declare target to(data_extended_to_1, data_extended_to_2)
 
-!CHECK-DAG: fir.global @_QMtest_0Edata_extended_enter_1 {omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (enter)>} : f32
-!CHECK-DAG: fir.global @_QMtest_0Edata_extended_enter_2 {omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (enter)>} : f32
+!CHECK-DAG: fir.global @_QMtest_0Edata_extended_enter_1 {omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = enter>} : f32
+!CHECK-DAG: fir.global @_QMtest_0Edata_extended_enter_2 {omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = enter>} : f32
 REAL :: data_extended_enter_1 = 2
 REAL :: data_extended_enter_2 = 3
 !$omp declare target enter(data_extended_enter_1, data_extended_enter_2)
 
-!CHECK-DAG: fir.global @_QMtest_0Edata_extended_link_1 {omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (link)>} : f32
-!CHECK-DAG: fir.global @_QMtest_0Edata_extended_link_2 {omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (link)>} : f32
+!CHECK-DAG: fir.global @_QMtest_0Edata_extended_link_1 {omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = link>} : f32
+!CHECK-DAG: fir.global @_QMtest_0Edata_extended_link_2 {omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = link>} : f32
 REAL :: data_extended_link_1 = 2
 REAL :: data_extended_link_2 = 3
 !$omp declare target link(data_extended_link_1, data_extended_link_2)
 
-!CHECK-DAG: fir.global @_QMtest_0Eautomap_data {omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (enter), automap = true>} target : !fir.box<!fir.heap<i32>>
+!CHECK-DAG: fir.global @_QMtest_0Eautomap_data {omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = enter, automap = true>} target : !fir.box<!fir.heap<i32>>
 INTEGER, ALLOCATABLE, TARGET :: automap_data
 !$omp declare target enter(automap : automap_data)
 
@@ -66,25 +66,25 @@ module test_0
 end module test_0
 
 PROGRAM commons
-    !CHECK-DAG: fir.global @numbers_ {alignment = 4 : i64, omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (to)>} : tuple<f32, f32> {
+    !CHECK-DAG: fir.global @numbers_ {alignment = 4 : i64, omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = to>} : tuple<f32, f32> {
     REAL :: one = 1
     REAL :: two = 2
     COMMON /numbers/ one, two
     !$omp declare target(/numbers/)
 
-    !CHECK-DAG: fir.global @numbers_link_ {alignment = 4 : i64, omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (link)>} : tuple<f32, f32> {
+    !CHECK-DAG: fir.global @numbers_link_ {alignment = 4 : i64, omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = link>} : tuple<f32, f32> {
     REAL :: one_link = 1
     REAL :: two_link = 2
     COMMON /numbers_link/ one_link, two_link
     !$omp declare target link(/numbers_link/)
 
-    !CHECK-DAG: fir.global @numbers_to_ {alignment = 4 : i64, omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (to)>} : tuple<f32, f32> {
+    !CHECK-DAG: fir.global @numbers_to_ {alignment = 4 : i64, omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = to>} : tuple<f32, f32> {
     REAL :: one_to = 1
     REAL :: two_to = 2
     COMMON /numbers_to/ one_to, two_to
     !$omp declare target to(/numbers_to/)
 
-    !CHECK-DAG: fir.global @numbers_enter_ {alignment = 4 : i64, omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (enter)>} : tuple<f32, f32> {
+    !CHECK-DAG: fir.global @numbers_enter_ {alignment = 4 : i64, omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = enter>} : tuple<f32, f32> {
     REAL :: one_enter = 1
     REAL :: two_enter = 2
     COMMON /numbers_enter/ one_enter, two_enter
diff --git a/flang/test/Lower/OpenMP/declare-target-func-and-subr.f90 b/flang/test/Lower/OpenMP/declare-target-func-and-subr.f90
index 8db8c620042c5..083af7809b96e 100644
--- a/flang/test/Lower/OpenMP/declare-target-func-and-subr.f90
+++ b/flang/test/Lower/OpenMP/declare-target-func-and-subr.f90
@@ -6,7 +6,7 @@
 ! zero clause declare target
 
 ! DEVICE-LABEL: func.func @_QPfunc_t_device()
-! DEVICE-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget<device_type = (nohost), capture_clause = (to)>{{.*}}
+! DEVICE-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget<device_type = nohost, capture_clause = to>{{.*}}
 FUNCTION FUNC_T_DEVICE() RESULT(I)
 !$omp declare target to(FUNC_T_DEVICE) device_type(nohost)
     INTEGER :: I
@@ -14,7 +14,7 @@ FUNCTION FUNC_T_DEVICE() RESULT(I)
 END FUNCTION FUNC_T_DEVICE
 
 ! DEVICE-LABEL: func.func @_QPfunc_enter_device()
-! DEVICE-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget<device_type = (nohost), capture_clause = (enter)>{{.*}}
+! DEVICE-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget<device_type = nohost, capture_clause = enter>{{.*}}
 FUNCTION FUNC_ENTER_DEVICE() RESULT(I)
 !$omp declare target enter(FUNC_ENTER_DEVICE) device_type(nohost)
     INTEGER :: I
@@ -22,7 +22,7 @@ FUNCTION FUNC_ENTER_DEVICE() RESULT(I)
 END FUNCTION FUNC_ENTER_DEVICE
 
 ! HOST-LABEL: func.func @_QPfunc_t_host()
-! HOST-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget<device_type = (host), capture_clause = (to)>{{.*}}
+! HOST-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget<device_type = host, capture_clause = to>{{.*}}
 FUNCTION FUNC_T_HOST() RESULT(I)
 !$omp declare target to(FUNC_T_HOST) device_type(host)
     INTEGER :: I
@@ -30,7 +30,7 @@ FUNCTION FUNC_T_HOST() RESULT(I)
 END FUNCTION FUNC_T_HOST
 
 ! HOST-LABEL: func.func @_QPfunc_enter_host()
-! HOST-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget<device_type = (host), capture_clause = (enter)>{{.*}}
+! HOST-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget<device_type = host, capture_clause = enter>{{.*}}
 FUNCTION FUNC_ENTER_HOST() RESULT(I)
 !$omp declare target enter(FUNC_ENTER_HOST) device_type(host)
     INTEGER :: I
@@ -38,7 +38,7 @@ FUNCTION FUNC_ENTER_HOST() RESULT(I)
 END FUNCTION FUNC_ENTER_HOST
 
 ! ALL-LABEL: func.func @_QPfunc_t_any()
-! ALL-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (to)>{{.*}}
+! ALL-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = to>{{.*}}
 FUNCTION FUNC_T_ANY() RESULT(I)
 !$omp declare target to(FUNC_T_ANY) device_type(any)
     INTEGER :: I
@@ -46,7 +46,7 @@ FUNCTION FUNC_T_ANY() RESULT(I)
 END FUNCTION FUNC_T_ANY
 
 ! ALL-LABEL: func.func @_QPfunc_enter_any()
-! ALL-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (enter)>{{.*}}
+! ALL-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = enter>{{.*}}
 FUNCTION FUNC_ENTER_ANY() RESULT(I)
 !$omp declare target enter(FUNC_ENTER_ANY) device_type(any)
     INTEGER :: I
@@ -54,7 +54,7 @@ FUNCTION FUNC_ENTER_ANY() RESULT(I)
 END FUNCTION FUNC_ENTER_ANY
 
 ! ALL-LABEL: func.func @_QPfunc_default_t_any()
-! ALL-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (to)>{{.*}}
+! ALL-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = to>{{.*}}
 FUNCTION FUNC_DEFAULT_T_ANY() RESULT(I)
 !$omp declare target to(FUNC_DEFAULT_T_ANY)
     INTEGER :: I
@@ -62,7 +62,7 @@ FUNCTION FUNC_DEFAULT_T_ANY() RESULT(I)
 END FUNCTION FUNC_DEFAULT_T_ANY
 
 ! ALL-LABEL: func.func @_QPfunc_default_enter_any()
-! ALL-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (enter)>{{.*}}
+! ALL-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = enter>{{.*}}
 FUNCTION FUNC_DEFAULT_ENTER_ANY() RESULT(I)
 !$omp declare target enter(FUNC_DEFAULT_ENTER_ANY)
     INTEGER :: I
@@ -70,7 +70,7 @@ FUNCTION FUNC_DEFAULT_ENTER_ANY() RESULT(I)
 END FUNCTION FUNC_DEFAULT_ENTER_ANY
 
 ! ALL-LABEL: func.func @_QPfunc_default_any()
-! ALL-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (to)>{{.*}}
+! ALL-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = to>{{.*}}
 FUNCTION FUNC_DEFAULT_ANY() RESULT(I)
 !$omp declare target
     INTEGER :: I
@@ -78,7 +78,7 @@ FUNCTION FUNC_DEFAULT_ANY() RESULT(I)
 END FUNCTION FUNC_DEFAULT_ANY
 
 ! ALL-LABEL: func.func @_QPfunc_default_extendedlist()
-! ALL-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (to)>{{.*}}
+! ALL-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = to>{{.*}}
 FUNCTION FUNC_DEFAULT_EXTENDEDLIST() RESULT(I)
 !$omp declare target(FUNC_DEFAULT_EXTENDEDLIST)
     INTEGER :: I
@@ -86,7 +86,7 @@ FUNCTION FUNC_DEFAULT_EXTENDEDLIST() RESULT(I)
 END FUNCTION FUNC_DEFAULT_EXTENDEDLIST
 
 ! ALL-LABEL: func.func @_QPfunc_name_as_result()
-! ALL-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (to)>{{.*}}
+! ALL-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = to>{{.*}}
 FUNCTION FUNC_NAME_AS_RESULT()
 !$omp declare target(FUNC_NAME_AS_RESULT)
   FUNC_NAME_AS_RESULT = 1.0
@@ -99,61 +99,61 @@ END FUNCTION FUNC_NAME_AS_RESULT
 ! zero clause declare target
 
 ! DEVICE-LABEL: func.func @_QPsubr_t_device()
-! DEVICE-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget<device_type = (nohost), capture_clause = (to)>{{.*}}
+! DEVICE-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget<device_type = nohost, capture_clause = to>{{.*}}
 SUBROUTINE SUBR_T_DEVICE()
 !$omp declare target to(SUBR_T_DEVICE) device_type(nohost)
 END
 
 ! DEVICE-LABEL: func.func @_QPsubr_enter_device()
-! DEVICE-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget<device_type = (nohost), capture_clause = (enter)>{{.*}}
+! DEVICE-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget<device_type = nohost, capture_clause = enter>{{.*}}
 SUBROUTINE SUBR_ENTER_DEVICE()
 !$omp declare target enter(SUBR_ENTER_DEVICE) device_type(nohost)
 END
 
 ! HOST-LABEL: func.func @_QPsubr_t_host()
-! HOST-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget<device_type = (host), capture_clause = (to)>{{.*}}
+! HOST-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget<device_type = host, capture_clause = to>{{.*}}
 SUBROUTINE SUBR_T_HOST()
 !$omp declare target to(SUBR_T_HOST) device_type(host)
 END
 
 ! HOST-LABEL: func.func @_QPsubr_enter_host()
-! HOST-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget<device_type = (host), capture_clause = (enter)>{{.*}}
+! HOST-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget<device_type = host, capture_clause = enter>{{.*}}
 SUBROUTINE SUBR_ENTER_HOST()
 !$omp declare target enter(SUBR_ENTER_HOST) device_type(host)
 END
 
 ! ALL-LABEL: func.func @_QPsubr_t_any()
-! ALL-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (to)>{{.*}}
+! ALL-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = to>{{.*}}
 SUBROUTINE SUBR_T_ANY()
 !$omp declare target to(SUBR_T_ANY) device_type(any)
 END
 
 ! ALL-LABEL: func.func @_QPsubr_enter_any()
-! ALL-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (enter)>{{.*}}
+! ALL-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = enter>{{.*}}
 SUBROUTINE SUBR_ENTER_ANY()
 !$omp declare target enter(SUBR_ENTER_ANY) device_type(any)
 END
 
 ! ALL-LABEL: func.func @_QPsubr_default_t_any()
-! ALL-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (to)>{{.*}}
+! ALL-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = to>{{.*}}
 SUBROUTINE SUBR_DEFAULT_T_ANY()
 !$omp declare target to(SUBR_DEFAULT_T_ANY)
 END
 
 ! ALL-LABEL: func.func @_QPsubr_default_enter_any()
-! ALL-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (enter)>{{.*}}
+! ALL-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = enter>{{.*}}
 SUBROUTINE SUBR_DEFAULT_ENTER_ANY()
 !$omp declare target enter(SUBR_DEFAULT_ENTER_ANY)
 END
 
 ! ALL-LABEL: func.func @_QPsubr_default_any()
-! ALL-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (to)>{{.*}}
+! ALL-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = to>{{.*}}
 SUBROUTINE SUBR_DEFAULT_ANY()
 !$omp declare target
 END
 
 ! ALL-LABEL: func.func @_QPsubr_default_extendedlist()
-! ALL-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (to)>{{.*}}
+! ALL-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = to>{{.*}}
 SUBROUTINE SUBR_DEFAULT_EXTENDEDLIST()
 !$omp declare target(SUBR_DEFAULT_EXTENDEDLIST)
 END
@@ -161,7 +161,7 @@ SUBROUTINE SUBR_DEFAULT_EXTENDEDLIST()
 !! -----
 
 ! DEVICE-LABEL: func.func @_QPrecursive_declare_target
-! DEVICE-SAME: {{.*}}attributes {{.*}}omp.declare_target = #omp.declaretarget<device_type = (nohost), capture_clause = (to)>{{.*}}
+! DEVICE-SAME: {{.*}}attributes {{.*}}omp.declare_target = #omp.declaretarget<device_type = nohost, capture_clause = to>{{.*}}
 RECURSIVE FUNCTION RECURSIVE_DECLARE_TARGET(INCREMENT) RESULT(K)
 !$omp declare target to(RECURSIVE_DECLARE_TARGET) device_type(nohost)
     INTEGER :: INCREMENT, K
@@ -173,7 +173,7 @@ RECURSIVE FUNCTION RECURSIVE_DECLARE_TARGET(INCREMENT) RESULT(K)
 END FUNCTION RECURSIVE_DECLARE_TARGET
 
 ! DEVICE-LABEL: func.func @_QPrecursive_declare_target_enter
-! DEVICE-SAME: {{.*}}attributes {{.*}}omp.declare_target = #omp.declaretarget<device_type = (nohost), capture_clause = (enter)>{{.*}}
+! DEVICE-SAME: {{.*}}attributes {{.*}}omp.declare_target = #omp.declaretarget<device_type = nohost, capture_clause = enter>{{.*}}
 RECURSIVE FUNCTION RECURSIVE_DECLARE_TARGET_ENTER(INCREMENT) RESULT(K)
 !$omp declare target enter(RECURSIVE_DECLARE_TARGET_ENTER) device_type(nohost)
     INTEGER :: INCREMENT, K
diff --git a/flang/test/Lower/OpenMP/declare-target-multiple-entry.f90 b/flang/test/Lower/OpenMP/declare-target-multiple-entry.f90
index ba6b6693b087e..e983093cbacee 100644
--- a/flang/test/Lower/OpenMP/declare-target-multiple-entry.f90
+++ b/flang/test/Lower/OpenMP/declare-target-multiple-entry.f90
@@ -4,9 +4,9 @@
 ! Test that a bare '!$omp declare target' inside a multiple entry subprogram
 ! marks all entries as declare-target functions.
 
-! CHECK: func.func @_QPfirst_entry{{.*}}device_type = (any)
-! CHECK: func.func @_QPsecond_entry{{.*}}device_type = (any)
-! CHECK: func.func @_QPthird_entry{{.*}}device_type = (any)
+! CHECK: func.func @_QPfirst_entry{{.*}}device_type = any
+! CHECK: func.func @_QPsecond_entry{{.*}}device_type = any
+! CHECK: func.func @_QPthird_entry{{.*}}device_type = any
 
 subroutine first_entry()
   implicit none
diff --git a/flang/test/Lower/OpenMP/declare-target-unnamed-main.f90 b/flang/test/Lower/OpenMP/declare-target-unnamed-main.f90
index b7d6d2fa232ad..05b4efe80a81c 100644
--- a/flang/test/Lower/OpenMP/declare-target-unnamed-main.f90
+++ b/flang/test/Lower/OpenMP/declare-target-unnamed-main.f90
@@ -7,7 +7,7 @@
 ! appropriately mark the function as declare target, even when
 ! unused within the target region.
 
-!CHECK: func.func @_QPfoo(%{{.*}}: !fir.ref<f32>{{.*}}) -> f32 attributes {{{.*}}omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (to)>{{.*}}}
+!CHECK: func.func @_QPfoo(%{{.*}}: !fir.ref<f32>{{.*}}) -> f32 attributes {{{.*}}omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = to>{{.*}}}
 
 interface
 real function foo (x)
diff --git a/flang/test/Lower/OpenMP/declare_target_module.f90 b/flang/test/Lower/OpenMP/declare_target_module.f90
index 8dbdb3d9469c4..d3176526e9586 100644
--- a/flang/test/Lower/OpenMP/declare_target_module.f90
+++ b/flang/test/Lower/OpenMP/declare_target_module.f90
@@ -32,18 +32,18 @@ subroutine s()
   global_real = 1.0
   global_integer = 1
 end subroutine
-!CHECK-DAG: fir.global @_QMdeclare_target_moduleEglobal_arr {alignment = 64 : i64, omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (enter)>} : !fir.array<10xi32>
-!CHECK-DAG: fir.global @_QMdeclare_target_moduleEglobal_real {omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (link)>} : f32
-!CHECK-DAG: fir.global @_QMdeclare_target_moduleEglobal_integer {omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (enter)>} : i32
+!CHECK-DAG: fir.global @_QMdeclare_target_moduleEglobal_arr {alignment = 64 : i64, omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = enter>} : !fir.array<10xi32>
+!CHECK-DAG: fir.global @_QMdeclare_target_moduleEglobal_real {omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = link>} : f32
+!CHECK-DAG: fir.global @_QMdeclare_target_moduleEglobal_integer {omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = enter>} : i32
 
 subroutine device_s()
   !$omp declare target enter(device_s) device_type(nohost)
   global_device_integer = 1
 end subroutine
-!CHECK-DAG: fir.global @_QMdeclare_target_moduleEglobal_device_integer {omp.declare_target = #omp.declaretarget<device_type = (nohost), capture_clause = (enter)>} : i32
+!CHECK-DAG: fir.global @_QMdeclare_target_moduleEglobal_device_integer {omp.declare_target = #omp.declaretarget<device_type = nohost, capture_clause = enter>} : i32
 
 subroutine call_module_s()
 call module_s()
 end subroutine
-!CHECK-DAG: func.func private @_QMdeclare_target_modulePmodule_s() attributes {omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (enter)>}
+!CHECK-DAG: func.func private @_QMdeclare_target_modulePmodule_s() attributes {omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = enter>}
 end module
diff --git a/flang/test/Lower/OpenMP/omp-declare-target-program-var.f90 b/flang/test/Lower/OpenMP/omp-declare-target-program-var.f90
index d18f42ae3ceb0..43e2b1b0cc3b0 100644
--- a/flang/test/Lower/OpenMP/omp-declare-target-program-var.f90
+++ b/flang/test/Lower/OpenMP/omp-declare-target-program-var.f90
@@ -5,7 +5,7 @@ PROGRAM main
     ! HOST-DAG: %[[I_REF:.*]] = fir.alloca f32 {bindc_name = "i", uniq_name = "_QFEi"}
     ! HOST-DAG: %[[I_DECL:.*]]:2 = hlfir.declare %[[I_REF]] {uniq_name = "_QFEi"} : (!fir.ref<f32>) -> (!fir.ref<f32>, !fir.ref<f32>)
     REAL :: I
-    ! ALL-DAG: fir.global internal @_QFEi {omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (to)>} : f32 {
+    ! ALL-DAG: fir.global internal @_QFEi {omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = to>} : f32 {
     ! ALL-DAG: %[[UNDEF:.*]] = fir.zero_bits f32
     ! ALL-DAG: fir.has_value %[[UNDEF]] : f32
     ! ALL-DAG: }
diff --git a/flang/test/Transforms/omp-automap-to-target-data.fir b/flang/test/Transforms/omp-automap-to-target-data.fir
index 0939293a8f798..5b2e7bc233c51 100644
--- a/flang/test/Transforms/omp-automap-to-target-data.fir
+++ b/flang/test/Transforms/omp-automap-to-target-data.fir
@@ -3,8 +3,8 @@
 
 module {
   fir.global
-      @_QMtestEarr{omp.declare_target = #omp.declaretarget<device_type = (any),
-                       capture_clause = (enter), automap = true>} target
+      @_QMtestEarr{omp.declare_target = #omp.declaretarget<device_type = any,
+                       capture_clause = enter, automap = true>} target
                        : !fir.box<!fir.heap<!fir.array<?xi32>>>
 
   func.func @automap() {
diff --git a/flang/test/Transforms/omp-function-filtering-todo.mlir b/flang/test/Transforms/omp-function-filtering-todo.mlir
index 64efad742002a..ee2c245e304e7 100644
--- a/flang/test/Transforms/omp-function-filtering-todo.mlir
+++ b/flang/test/Transforms/omp-function-filtering-todo.mlir
@@ -56,7 +56,7 @@ module attributes {omp.is_gpu = true, omp.is_target_device = true} {
     omp.yield(%arg0 : !fir.ref<!fir.box<!fir.heap<!fir.array<?xi32>>>>)
   }
 
-  func.func @f2(%ia : !fir.ref<!fir.box<!fir.heap<!fir.array<?xi32>>>>) attributes {omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (enter), automap = false>} {
+  func.func @f2(%ia : !fir.ref<!fir.box<!fir.heap<!fir.array<?xi32>>>>) attributes {omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = enter, automap = false>} {
     %c1_i32 = arith.constant 1 : i32
     omp.wsloop reduction(byref @red2 %ia -> %arg0 : !fir.ref<!fir.box<!fir.heap<!fir.array<?xi32>>>>) {
       omp.loop_nest (%arg1) : i32 = (%c1_i32) to (%c1_i32) inclusive step (%c1_i32) {
diff --git a/mlir/docs/DefiningDialects/AttributesAndTypes.md b/mlir/docs/DefiningDialects/AttributesAndTypes.md
index 18c24d6f431b6..1482919c7c4fd 100644
--- a/mlir/docs/DefiningDialects/AttributesAndTypes.md
+++ b/mlir/docs/DefiningDialects/AttributesAndTypes.md
@@ -887,6 +887,11 @@ assembly format of `` `<` struct(params) `>` `` will result in:
 The order in which the parameters are printed is the order in which they are
 declared in the attribute's or type's `parameter` list.
 
+An `EnumAttrParameter` or `OptionalEnumAttrParameter` captured by `struct` uses
+the underlying enum syntax. This omits the enum attribute's mnemonic and
+assembly-format delimiters. For example, an enum attribute whose standalone
+syntax is `#my_dialect.enum<case>` is printed as `kind = case` in a `struct`.
+
 Passing `custom<Foo>($variable)` allows providing a custom printer and parser
 for the encapsulated variable. Check the
 [custom and ref directive](#custom-and-ref-directive) section for more
diff --git a/mlir/include/mlir/Dialect/OpenMP/OpenMPAttrDefs.td b/mlir/include/mlir/Dialect/OpenMP/OpenMPAttrDefs.td
index 55895add86dc4..b80c2f6aba441 100644
--- a/mlir/include/mlir/Dialect/OpenMP/OpenMPAttrDefs.td
+++ b/mlir/include/mlir/Dialect/OpenMP/OpenMPAttrDefs.td
@@ -43,8 +43,8 @@ def AtomicControlAttr : OpenMP_Attr<"AtomicControl", "atomic_control"> {
 
 def DeclareTargetAttr : OpenMP_Attr<"DeclareTarget", "declaretarget"> {
   let parameters =
-      (ins OptionalParameter<"DeclareTargetDeviceTypeAttr">:$device_type,
-          OptionalParameter<"DeclareTargetCaptureClauseAttr">:$capture_clause,
+      (ins OptionalEnumAttrParameter<DeclareTargetDeviceTypeAttr>:$device_type,
+          OptionalEnumAttrParameter<DeclareTargetCaptureClauseAttr>:$capture_clause,
           DefaultValuedParameter<"bool", "false">:$automap,
           DefaultValuedParameter<"bool", "false">:$implicit);
 
diff --git a/mlir/include/mlir/IR/EnumAttr.td b/mlir/include/mlir/IR/EnumAttr.td
index 4b7ea55d089d6..b0704c81805c9 100644
--- a/mlir/include/mlir/IR/EnumAttr.td
+++ b/mlir/include/mlir/IR/EnumAttr.td
@@ -571,6 +571,22 @@ class EnumAttr<Dialect dialect, EnumInfo enumInfo, string name = "",
   let assemblyFormat = "$value";
 }
 
+// An EnumAttr used as a parameter of another attribute or type. This retains
+// the EnumAttr definition so that declarative assembly format directives can
+// format its underlying enum value directly.
+class EnumAttrParameter<EnumAttr enumAttr, string desc = "">
+    : AttrParameter<enumAttr.cppNamespace # "::" # enumAttr.cppClassName,
+                    desc> {
+  EnumAttr attr = enumAttr;
+  Dialect dialect = enumAttr.dialect;
+}
+
+// An optional EnumAttr parameter.
+class OptionalEnumAttrParameter<EnumAttr enumAttr, string desc = "">
+    : EnumAttrParameter<enumAttr, desc> {
+  let defaultValue = cppStorageType # "()";
+}
+
 // A property wrapping by a C++ enum. This class will automatically create bytecode
 // serialization logic for the given enum, as well as arranging for parser and
 // printer calls.
diff --git a/mlir/test/Dialect/OpenMP/attr.mlir b/mlir/test/Dialect/OpenMP/attr.mlir
index 8c6f25f3bcaab..a17112df4a3f5 100644
--- a/mlir/test/Dialect/OpenMP/attr.mlir
+++ b/mlir/test/Dialect/OpenMP/attr.mlir
@@ -66,100 +66,100 @@ module attributes {omp.version = #omp.version<version = 51>} {}
 // ----
 
 // CHECK-LABEL: func @omp_decl_tar_host_to
-// CHECK-SAME: {{.*}} attributes {omp.declare_target = #omp.declaretarget<device_type = (host), capture_clause = (to)>} {
-func.func @omp_decl_tar_host_to() -> () attributes {omp.declare_target = #omp.declaretarget<device_type = (host), capture_clause = (to)>} {
+// CHECK-SAME: {{.*}} attributes {omp.declare_target = #omp.declaretarget<device_type = host, capture_clause = to>} {
+func.func @omp_decl_tar_host_to() -> () attributes {omp.declare_target = #omp.declaretarget<device_type = host, capture_clause = to>} {
   return
 }
 
 // CHECK-LABEL: func @omp_decl_tar_host_enter
-// CHECK-SAME: {{.*}} attributes {omp.declare_target = #omp.declaretarget<device_type = (host), capture_clause = (enter)>} {
-func.func @omp_decl_tar_host_enter() -> () attributes {omp.declare_target = #omp.declaretarget<device_type = (host), capture_clause = (enter)>} {
+// CHECK-SAME: {{.*}} attributes {omp.declare_target = #omp.declaretarget<device_type = host, capture_clause = enter>} {
+func.func @omp_decl_tar_host_enter() -> () attributes {omp.declare_target = #omp.declaretarget<device_type = host, capture_clause = enter>} {
   return
 }
 
 // CHECK-LABEL: func @omp_decl_tar_nohost_to
-// CHECK-SAME: {{.*}} attributes {omp.declare_target = #omp.declaretarget<device_type = (nohost), capture_clause = (to)>} {
-func.func @omp_decl_tar_nohost_to() -> () attributes {omp.declare_target = #omp.declaretarget<device_type = (nohost), capture_clause = (to)>} {
+// CHECK-SAME: {{.*}} attributes {omp.declare_target = #omp.declaretarget<device_type = nohost, capture_clause = to>} {
+func.func @omp_decl_tar_nohost_to() -> () attributes {omp.declare_target = #omp.declaretarget<device_type = nohost, capture_clause = to>} {
   return
 }
 
 // CHECK-LABEL: func @omp_decl_tar_nohost_enter
-// CHECK-SAME: {{.*}} attributes {omp.declare_target = #omp.declaretarget<device_type = (nohost), capture_clause = (enter)>} {
-func.func @omp_decl_tar_nohost_enter() -> () attributes {omp.declare_target = #omp.declaretarget<device_type = (nohost), capture_clause = (enter)>} {
+// CHECK-SAME: {{.*}} attributes {omp.declare_target = #omp.declaretarget<device_type = nohost, capture_clause = enter>} {
+func.func @omp_decl_tar_nohost_enter() -> () attributes {omp.declare_target = #omp.declaretarget<device_type = nohost, capture_clause = enter>} {
   return
 }
 
 // CHECK-LABEL: func @omp_decl_tar_any_to
-// CHECK-SAME: {{.*}} attributes {omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (to)>} {
-func.func @omp_decl_tar_any_to() -> () attributes {omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (to)>} {
+// CHECK-SAME: {{.*}} attributes {omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = to>} {
+func.func @omp_decl_tar_any_to() -> () attributes {omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = to>} {
   return
 }
 
 // CHECK-LABEL: func @omp_decl_tar_any_enter
-// CHECK-SAME: {{.*}} attributes {omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (enter)>} {
-func.func @omp_decl_tar_any_enter() -> () attributes {omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (enter)>} {
+// CHECK-SAME: {{.*}} attributes {omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = enter>} {
+func.func @omp_decl_tar_any_enter() -> () attributes {omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = enter>} {
   return
 }
 
 // CHECK-LABEL: global external @omp_decl_tar_data_host_to
-// CHECK-SAME: {{.*}} {{{.*}}omp.declare_target = #omp.declaretarget<device_type = (host), capture_clause = (to)>}
-llvm.mlir.global external @omp_decl_tar_data_host_to() {omp.declare_target = #omp.declaretarget<device_type = (host), capture_clause = (to)>} : i32 {
+// CHECK-SAME: {{.*}} {{{.*}}omp.declare_target = #omp.declaretarget<device_type = host, capture_clause = to>}
+llvm.mlir.global external @omp_decl_tar_data_host_to() {omp.declare_target = #omp.declaretarget<device_type = host, capture_clause = to>} : i32 {
   %0 = llvm.mlir.constant(1 : i32) : i32
   llvm.return %0 : i32
 }
 
 // CHECK-LABEL: global external @omp_decl_tar_data_host_link
-// CHECK-SAME: {{.*}} {{{.*}}omp.declare_target = #omp.declaretarget<device_type = (host), capture_clause = (link)>}
-llvm.mlir.global external @omp_decl_tar_data_host_link() {omp.declare_target = #omp.declaretarget<device_type = (host), capture_clause = (link)>} : i32 {
+// CHECK-SAME: {{.*}} {{{.*}}omp.declare_target = #omp.declaretarget<device_type = host, capture_clause = link>}
+llvm.mlir.global external @omp_decl_tar_data_host_link() {omp.declare_target = #omp.declaretarget<device_type = host, capture_clause = link>} : i32 {
   %0 = llvm.mlir.constant(1 : i32) : i32
   llvm.return %0 : i32
 }
 
 // CHECK-LABEL: global external @omp_decl_tar_data_host_enter
-// CHECK-SAME: {{.*}} {{{.*}}omp.declare_target = #omp.declaretarget<device_type = (host), capture_clause = (enter)>}
-llvm.mlir.global external @omp_decl_tar_data_host_enter() {omp.declare_target = #omp.declaretarget<device_type = (host), capture_clause = (enter)>} : i32 {
+// CHECK-SAME: {{.*}} {{{.*}}omp.declare_target = #omp.declaretarget<device_type = host, capture_clause = enter>}
+llvm.mlir.global external @omp_decl_tar_data_host_enter() {omp.declare_target = #omp.declaretarget<device_type = host, capture_clause = enter>} : i32 {
   %0 = llvm.mlir.constant(1 : i32) : i32
   llvm.return %0 : i32
 }
 
 // CHECK-LABEL: global external @omp_decl_tar_data_nohost_to
-// CHECK-SAME: {{.*}} {{{.*}}omp.declare_target = #omp.declaretarget<device_type = (nohost), capture_clause = (to)>}
-llvm.mlir.global external @omp_decl_tar_data_nohost_to() {omp.declare_target = #omp.declaretarget<device_type = (nohost), capture_clause = (to)>} : i32 {
+// CHECK-SAME: {{.*}} {{{.*}}omp.declare_target = #omp.declaretarget<device_type = nohost, capture_clause = to>}
+llvm.mlir.global external @omp_decl_tar_data_nohost_to() {omp.declare_target = #omp.declaretarget<device_type = nohost, capture_clause = to>} : i32 {
   %0 = llvm.mlir.constant(1 : i32) : i32
   llvm.return %0 : i32
 }
 
 // CHECK-LABEL: global external @omp_decl_tar_data_nohost_link
-// CHECK-SAME: {{.*}} {{{.*}}omp.declare_target = #omp.declaretarget<device_type = (nohost), capture_clause = (link)>}
-llvm.mlir.global external @omp_decl_tar_data_nohost_link() {omp.declare_target = #omp.declaretarget<device_type = (nohost), capture_clause = (link)>} : i32 {
+// CHECK-SAME: {{.*}} {{{.*}}omp.declare_target = #omp.declaretarget<device_type = nohost, capture_clause = link>}
+llvm.mlir.global external @omp_decl_tar_data_nohost_link() {omp.declare_target = #omp.declaretarget<device_type = nohost, capture_clause = link>} : i32 {
   %0 = llvm.mlir.constant(1 : i32) : i32
   llvm.return %0 : i32
 }
 
 // CHECK-LABEL: global external @omp_decl_tar_data_nohost_enter
-// CHECK-SAME: {{.*}} {{{.*}}omp.declare_target = #omp.declaretarget<device_type = (nohost), capture_clause = (enter)>}
-llvm.mlir.global external @omp_decl_tar_data_nohost_enter() {omp.declare_target = #omp.declaretarget<device_type = (nohost), capture_clause = (enter)>} : i32 {
+// CHECK-SAME: {{.*}} {{{.*}}omp.declare_target = #omp.declaretarget<device_type = nohost, capture_clause = enter>}
+llvm.mlir.global external @omp_decl_tar_data_nohost_enter() {omp.declare_target = #omp.declaretarget<device_type = nohost, capture_clause = enter>} : i32 {
   %0 = llvm.mlir.constant(1 : i32) : i32
   llvm.return %0 : i32
 }
 
 // CHECK-LABEL: global external @omp_decl_tar_data_any_to
-// CHECK-SAME: {{.*}} {{{.*}}omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (to)>}
-llvm.mlir.global external @omp_decl_tar_data_any_to() {omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (to)>} : i32 {
+// CHECK-SAME: {{.*}} {{{.*}}omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = to>}
+llvm.mlir.global external @omp_decl_tar_data_any_to() {omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = to>} : i32 {
   %0 = llvm.mlir.constant(1 : i32) : i32
   llvm.return %0 : i32
 }
 
 // CHECK-LABEL: global external @omp_decl_tar_data_any_link
-// CHECK-SAME: {{.*}} {{{.*}}omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (link)>}
-llvm.mlir.global external @omp_decl_tar_data_any_link() {omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (link)>} : i32 {
+// CHECK-SAME: {{.*}} {{{.*}}omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = link>}
+llvm.mlir.global external @omp_decl_tar_data_any_link() {omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = link>} : i32 {
   %0 = llvm.mlir.constant(1 : i32) : i32
   llvm.return %0 : i32
 }
 
 // CHECK-LABEL: global external @omp_decl_tar_data_any_enter
-// CHECK-SAME: {{.*}} {{{.*}}omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (enter)>}
-llvm.mlir.global external @omp_decl_tar_data_any_enter() {omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (enter)>} : i32 {
+// CHECK-SAME: {{.*}} {{{.*}}omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = enter>}
+llvm.mlir.global external @omp_decl_tar_data_any_enter() {omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = enter>} : i32 {
   %0 = llvm.mlir.constant(1 : i32) : i32
   llvm.return %0 : i32
 }
diff --git a/mlir/test/Dialect/OpenMP/function-filter.mlir b/mlir/test/Dialect/OpenMP/function-filter.mlir
index eec48d24ef963..0e5d370be2043 100644
--- a/mlir/test/Dialect/OpenMP/function-filter.mlir
+++ b/mlir/test/Dialect/OpenMP/function-filter.mlir
@@ -20,21 +20,21 @@ module attributes {omp.is_target_device = true} {
   llvm.func @any() -> ()
       attributes {
         omp.declare_target =
-          #omp.declaretarget<device_type = (any), capture_clause = (to)>
+          #omp.declaretarget<device_type = any, capture_clause = to>
       } {
     llvm.return
   }
   llvm.func @nohost() -> ()
       attributes {
         omp.declare_target =
-          #omp.declaretarget<device_type = (nohost), capture_clause = (to)>
+          #omp.declaretarget<device_type = nohost, capture_clause = to>
       } {
     llvm.return
   }
   llvm.func @host() -> ()
       attributes {
         omp.declare_target =
-          #omp.declaretarget<device_type = (host), capture_clause = (to)>
+          #omp.declaretarget<device_type = host, capture_clause = to>
       } {
     llvm.return
   }
@@ -44,7 +44,7 @@ module attributes {omp.is_target_device = true} {
   llvm.func @nohost_target() -> ()
       attributes {
         omp.declare_target =
-          #omp.declaretarget<device_type = (nohost), capture_clause = (to)>
+          #omp.declaretarget<device_type = nohost, capture_clause = to>
       } {
     omp.target kernel_type(generic) {
       omp.terminator
@@ -54,7 +54,7 @@ module attributes {omp.is_target_device = true} {
   llvm.func @host_target() -> ()
       attributes {
         omp.declare_target =
-          #omp.declaretarget<device_type = (host), capture_clause = (to)>
+          #omp.declaretarget<device_type = host, capture_clause = to>
       } {
     omp.target kernel_type(generic) {
       omp.terminator
@@ -71,7 +71,7 @@ module attributes {omp.is_target_device = true} {
   llvm.func @host_target_call() -> i32
       attributes {
         omp.declare_target =
-          #omp.declaretarget<device_type = (host), capture_clause = (to)>
+          #omp.declaretarget<device_type = host, capture_clause = to>
       } {
     omp.target kernel_type(generic) {
       omp.terminator
@@ -101,21 +101,21 @@ module attributes {omp.is_target_device = false} {
   llvm.func @any() -> ()
       attributes {
         omp.declare_target =
-          #omp.declaretarget<device_type = (any), capture_clause = (to)>
+          #omp.declaretarget<device_type = any, capture_clause = to>
       } {
     llvm.return
   }
   llvm.func @nohost() -> ()
       attributes {
           omp.declare_target =
-            #omp.declaretarget<device_type = (nohost), capture_clause = (to)>
+            #omp.declaretarget<device_type = nohost, capture_clause = to>
       } {
     llvm.return
   }
   llvm.func @host() -> ()
       attributes {
         omp.declare_target =
-          #omp.declaretarget<device_type = (host), capture_clause = (to)>
+          #omp.declaretarget<device_type = host, capture_clause = to>
       } {
     llvm.return
   }
@@ -125,7 +125,7 @@ module attributes {omp.is_target_device = false} {
   llvm.func @nohost_target() -> ()
       attributes {
         omp.declare_target =
-          #omp.declaretarget<device_type = (nohost), capture_clause = (to)>
+          #omp.declaretarget<device_type = nohost, capture_clause = to>
       } {
     omp.target kernel_type(generic) {
       omp.terminator
@@ -135,7 +135,7 @@ module attributes {omp.is_target_device = false} {
   llvm.func @host_target() -> ()
       attributes {
         omp.declare_target =
-          #omp.declaretarget<device_type = (host), capture_clause = (to)>
+          #omp.declaretarget<device_type = host, capture_clause = to>
       } {
     omp.target kernel_type(generic) {
       omp.terminator
diff --git a/mlir/test/Dialect/OpenMP/host-op-filtering.mlir b/mlir/test/Dialect/OpenMP/host-op-filtering.mlir
index bf0a7185132b1..789ec35fddd45 100644
--- a/mlir/test/Dialect/OpenMP/host-op-filtering.mlir
+++ b/mlir/test/Dialect/OpenMP/host-op-filtering.mlir
@@ -462,7 +462,7 @@ module attributes {omp.is_target_device = true} {
     llvm.return
   }
 
-  llvm.func @foo() attributes {omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (enter)>, sym_visibility = "private"}
+  llvm.func @foo() attributes {omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = enter>, sym_visibility = "private"}
   omp.private {type = firstprivate} @privatizer : i32 copy {
   ^bb0(%arg0: !llvm.ptr, %arg1: !llvm.ptr):
     %0 = llvm.load %arg0 : !llvm.ptr -> i32
@@ -489,16 +489,16 @@ module attributes {omp.is_target_device = true} {
   // CHECK: llvm.mlir.global external @declare_target_enter_any
   // CHECK: llvm.mlir.global external @declare_target_enter_host
   // CHECK: llvm.mlir.global external @declare_target_enter_nohost
-  llvm.mlir.global external @declare_target_enter_any() {addr_space = 0 : i32, omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (enter), automap = false>} : i32
-  llvm.mlir.global external @declare_target_enter_host() {addr_space = 0 : i32, omp.declare_target = #omp.declaretarget<device_type = (host), capture_clause = (enter), automap = false>} : i32
-  llvm.mlir.global external @declare_target_enter_nohost() {addr_space = 0 : i32, omp.declare_target = #omp.declaretarget<device_type = (nohost), capture_clause = (enter), automap = false>} : i32
+  llvm.mlir.global external @declare_target_enter_any() {addr_space = 0 : i32, omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = enter, automap = false>} : i32
+  llvm.mlir.global external @declare_target_enter_host() {addr_space = 0 : i32, omp.declare_target = #omp.declaretarget<device_type = host, capture_clause = enter, automap = false>} : i32
+  llvm.mlir.global external @declare_target_enter_nohost() {addr_space = 0 : i32, omp.declare_target = #omp.declaretarget<device_type = nohost, capture_clause = enter, automap = false>} : i32
 
   // CHECK: llvm.mlir.global external @declare_target_link_any
   // CHECK: llvm.mlir.global external @declare_target_link_host
   // CHECK: llvm.mlir.global external @declare_target_link_nohost
-  llvm.mlir.global external @declare_target_link_any() {addr_space = 0 : i32, omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (link), automap = false>} : i32
-  llvm.mlir.global external @declare_target_link_host() {addr_space = 0 : i32, omp.declare_target = #omp.declaretarget<device_type = (host), capture_clause = (link), automap = false>} : i32
-  llvm.mlir.global external @declare_target_link_nohost() {addr_space = 0 : i32, omp.declare_target = #omp.declaretarget<device_type = (nohost), capture_clause = (link), automap = false>} : i32
+  llvm.mlir.global external @declare_target_link_any() {addr_space = 0 : i32, omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = link, automap = false>} : i32
+  llvm.mlir.global external @declare_target_link_host() {addr_space = 0 : i32, omp.declare_target = #omp.declaretarget<device_type = host, capture_clause = link, automap = false>} : i32
+  llvm.mlir.global external @declare_target_link_nohost() {addr_space = 0 : i32, omp.declare_target = #omp.declaretarget<device_type = nohost, capture_clause = link, automap = false>} : i32
 
   llvm.func @LangRTPlaceholderFunc(!llvm.ptr {llvm.nocapture}, !llvm.ptr {llvm.nocapture}, !llvm.ptr, i8 {llvm.signext}, i32) attributes {sym_visibility = "private"}
 }
diff --git a/mlir/test/Dialect/OpenMP/invalid-interface.mlir b/mlir/test/Dialect/OpenMP/invalid-interface.mlir
index 787b6a7ec00ce..ecbd17db54a41 100644
--- a/mlir/test/Dialect/OpenMP/invalid-interface.mlir
+++ b/mlir/test/Dialect/OpenMP/invalid-interface.mlir
@@ -108,7 +108,7 @@ func.func @composable_conditional_combined(%x : i32) {
 // -----
 
 // expected-error @below {{omp.declare_target can only be applied to DeclareTargetInterface ops}}
-%0 = arith.constant { omp.declare_target = #omp.declaretarget<capture_clause = (enter)> } 2 : i32
+%0 = arith.constant { omp.declare_target = #omp.declaretarget<capture_clause = enter> } 2 : i32
 
 // -----
 
@@ -123,7 +123,7 @@ func.func private @declare_target_automap() attributes { omp.declare_target = #o
 // -----
 
 // expected-error @below {{omp.declare_target 'link' is not valid on functions}}
-func.func private @declare_target_link() attributes { omp.declare_target = #omp.declaretarget<capture_clause = (link)>}
+func.func private @declare_target_link() attributes { omp.declare_target = #omp.declaretarget<capture_clause = link>}
 
 // -----
 
diff --git a/mlir/test/Dialect/OpenMP/mark-declare-target.mlir b/mlir/test/Dialect/OpenMP/mark-declare-target.mlir
index a50e4678aa37d..2509354a9c862 100644
--- a/mlir/test/Dialect/OpenMP/mark-declare-target.mlir
+++ b/mlir/test/Dialect/OpenMP/mark-declare-target.mlir
@@ -17,23 +17,23 @@ omp.private {type = firstprivate} @priv : !llvm.struct<(ptr)> init {
 }
 
 // CHECK: llvm.func {{.*}}@priv_callee_nested()
-// CHECK-SAME: omp.declare_target = #omp.declaretarget<device_type = (nohost), capture_clause = (to), implicit = true>
+// CHECK-SAME: omp.declare_target = #omp.declaretarget<device_type = nohost, capture_clause = to, implicit = true>
 llvm.func @priv_callee_nested() attributes {sym_visibility = "private"} {
   llvm.return
 }
 // CHECK: llvm.func {{.*}}@priv_callee_init()
-// CHECK-SAME: omp.declare_target = #omp.declaretarget<device_type = (nohost), capture_clause = (to), implicit = true>
+// CHECK-SAME: omp.declare_target = #omp.declaretarget<device_type = nohost, capture_clause = to, implicit = true>
 llvm.func @priv_callee_init() attributes {sym_visibility = "private"} {
   llvm.call @priv_callee_nested() : () -> ()
   llvm.return
 }
 // CHECK: llvm.func {{.*}}@priv_callee_copy()
-// CHECK-SAME: omp.declare_target = #omp.declaretarget<device_type = (nohost), capture_clause = (to), implicit = true>
+// CHECK-SAME: omp.declare_target = #omp.declaretarget<device_type = nohost, capture_clause = to, implicit = true>
 llvm.func @priv_callee_copy() attributes {sym_visibility = "private"} {
   llvm.return
 }
 // CHECK: llvm.func {{.*}}@priv_callee_dealloc()
-// CHECK-SAME: omp.declare_target = #omp.declaretarget<device_type = (nohost), capture_clause = (to), implicit = true>
+// CHECK-SAME: omp.declare_target = #omp.declaretarget<device_type = nohost, capture_clause = to, implicit = true>
 llvm.func @priv_callee_dealloc() attributes {sym_visibility = "private"} {
   llvm.return
 }
@@ -74,31 +74,31 @@ cleanup {
 }
 
 // CHECK: llvm.func {{.*}}@red_callee_nested()
-// CHECK-SAME: omp.declare_target = #omp.declaretarget<device_type = (host), capture_clause = (to), implicit = true>
+// CHECK-SAME: omp.declare_target = #omp.declaretarget<device_type = host, capture_clause = to, implicit = true>
 llvm.func @red_callee_nested() attributes {sym_visibility = "private"} {
   llvm.return
 }
 // CHECK: llvm.func {{.*}}@red_callee_init()
-// CHECK-SAME: omp.declare_target = #omp.declaretarget<device_type = (host), capture_clause = (to), implicit = true>
+// CHECK-SAME: omp.declare_target = #omp.declaretarget<device_type = host, capture_clause = to, implicit = true>
 llvm.func @red_callee_init() attributes {sym_visibility = "private"} {
   llvm.call @red_callee_nested() : () -> ()
   llvm.return
 }
 // CHECK: llvm.func {{.*}}@red_callee_combiner()
-// CHECK-SAME: omp.declare_target = #omp.declaretarget<device_type = (host), capture_clause = (to), implicit = true>
+// CHECK-SAME: omp.declare_target = #omp.declaretarget<device_type = host, capture_clause = to, implicit = true>
 llvm.func @red_callee_combiner() attributes {sym_visibility = "private"} {
   llvm.return
 }
 // CHECK: llvm.func {{.*}}@red_callee_cleanup()
-// CHECK-SAME: omp.declare_target = #omp.declaretarget<device_type = (host), capture_clause = (to), implicit = true>
+// CHECK-SAME: omp.declare_target = #omp.declaretarget<device_type = host, capture_clause = to, implicit = true>
 llvm.func @red_callee_cleanup() attributes {sym_visibility = "private"} {
   llvm.return
 }
 // CHECK: llvm.func {{.*}}@main(
-// CHECK-SAME: omp.declare_target = #omp.declaretarget<device_type = (host), capture_clause = (to)>
+// CHECK-SAME: omp.declare_target = #omp.declaretarget<device_type = host, capture_clause = to>
 llvm.func @main(%arg0 : !llvm.ptr) attributes {
     omp.declare_target = #omp.declaretarget<
-        device_type = (host), capture_clause = (to)>} {
+        device_type = host, capture_clause = to>} {
   omp.parallel reduction(@red %arg0 -> %arg1 : !llvm.ptr) {
     omp.terminator
   }
@@ -138,24 +138,24 @@ cleanup {
 }
 
 // CHECK: llvm.func {{.*}}@red_callee_nested2()
-// CHECK-SAME: omp.declare_target = #omp.declaretarget<device_type = (nohost), capture_clause = (to), implicit = true>
+// CHECK-SAME: omp.declare_target = #omp.declaretarget<device_type = nohost, capture_clause = to, implicit = true>
 llvm.func @red_callee_nested2() attributes {sym_visibility = "private"} {
   llvm.return
 }
 // CHECK: llvm.func {{.*}}@red_callee_nested()
-// CHECK-SAME: omp.declare_target = #omp.declaretarget<device_type = (nohost), capture_clause = (to), implicit = true>
+// CHECK-SAME: omp.declare_target = #omp.declaretarget<device_type = nohost, capture_clause = to, implicit = true>
 llvm.func @red_callee_nested() attributes {sym_visibility = "private"} {
   llvm.call @red_callee_nested2() : () -> ()
   llvm.return
 }
 // CHECK: llvm.func {{.*}}@red_callee()
-// CHECK-SAME: omp.declare_target = #omp.declaretarget<device_type = (nohost), capture_clause = (to), implicit = true>
+// CHECK-SAME: omp.declare_target = #omp.declaretarget<device_type = nohost, capture_clause = to, implicit = true>
 llvm.func @red_callee() attributes {sym_visibility = "private"} {
   llvm.call @red_callee_nested() : () -> ()
   llvm.return
 }
 // CHECK: llvm.func {{.*}}@priv_callee()
-// CHECK-SAME: omp.declare_target = #omp.declaretarget<device_type = (nohost), capture_clause = (to), implicit = true>
+// CHECK-SAME: omp.declare_target = #omp.declaretarget<device_type = nohost, capture_clause = to, implicit = true>
 llvm.func @priv_callee() attributes {sym_visibility = "private"} {
   %0 = llvm.mlir.constant(1 : i64) : i64
   %1 = llvm.alloca %0 x i32 : (i64) -> !llvm.ptr
@@ -165,7 +165,7 @@ llvm.func @priv_callee() attributes {sym_visibility = "private"} {
   llvm.return
 }
 // CHECK: llvm.func {{.*}}@main_callee()
-// CHECK-SAME: omp.declare_target = #omp.declaretarget<device_type = (nohost), capture_clause = (to), implicit = true>
+// CHECK-SAME: omp.declare_target = #omp.declaretarget<device_type = nohost, capture_clause = to, implicit = true>
 llvm.func @main_callee() attributes {sym_visibility = "private"} {
   %0 = llvm.mlir.constant(1 : i64) : i64
   %1 = llvm.alloca %0 x i32 : (i64) -> !llvm.ptr
@@ -175,10 +175,10 @@ llvm.func @main_callee() attributes {sym_visibility = "private"} {
   llvm.return
 }
 // CHECK: llvm.func {{.*}}@main()
-// CHECK-SAME: omp.declare_target = #omp.declaretarget<device_type = (nohost), capture_clause = (to)>
+// CHECK-SAME: omp.declare_target = #omp.declaretarget<device_type = nohost, capture_clause = to>
 llvm.func @main() attributes {
     omp.declare_target = #omp.declaretarget<
-        device_type = (nohost), capture_clause = (to)>} {
+        device_type = nohost, capture_clause = to>} {
   llvm.call @main_callee() : () -> ()
   llvm.return
 }
@@ -208,18 +208,18 @@ llvm.func @main() {
 // If they aren't compatible, this is a user error.
 
 // CHECK: llvm.func {{.*}}@callee()
-// CHECK-SAME: omp.declare_target = #omp.declaretarget<device_type = (host), capture_clause = (to)>
+// CHECK-SAME: omp.declare_target = #omp.declaretarget<device_type = host, capture_clause = to>
 llvm.func @callee() attributes {
     sym_visibility = "private",
     omp.declare_target = #omp.declaretarget<
-        device_type = (host), capture_clause = (to)>} {
+        device_type = host, capture_clause = to>} {
   llvm.return
 }
 // CHECK: llvm.func {{.*}}@main()
-// CHECK-SAME: omp.declare_target = #omp.declaretarget<device_type = (nohost), capture_clause = (to)>
+// CHECK-SAME: omp.declare_target = #omp.declaretarget<device_type = nohost, capture_clause = to>
 llvm.func @main() attributes {
     omp.declare_target = #omp.declaretarget<
-        device_type = (nohost), capture_clause = (to)>} {
+        device_type = nohost, capture_clause = to>} {
   llvm.call @callee() : () -> ()
   llvm.return
 }
@@ -230,29 +230,29 @@ llvm.func @main() attributes {
 // device_type(any) and it propagates to nested callees.
 
 // CHECK: llvm.func {{.*}}@callee_nested()
-// CHECK-SAME: omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (to), implicit = true>
+// CHECK-SAME: omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = to, implicit = true>
 llvm.func @callee_nested() attributes {sym_visibility = "private"} {
   llvm.return
 }
 // CHECK: llvm.func {{.*}}@callee()
-// CHECK-SAME: omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (to), implicit = true>
+// CHECK-SAME: omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = to, implicit = true>
 llvm.func @callee() attributes {sym_visibility = "private"} {
   llvm.call @callee_nested() : () -> ()
   llvm.return
 }
 // CHECK: llvm.func {{.*}}@fn_host()
-// CHECK-SAME: omp.declare_target = #omp.declaretarget<device_type = (host), capture_clause = (to)>
+// CHECK-SAME: omp.declare_target = #omp.declaretarget<device_type = host, capture_clause = to>
 llvm.func @fn_host() attributes {
     omp.declare_target = #omp.declaretarget<
-        device_type = (host), capture_clause = (to)>} {
+        device_type = host, capture_clause = to>} {
   llvm.call @callee() : () -> ()
   llvm.return
 }
 // CHECK: llvm.func {{.*}}@fn_nohost()
-// CHECK-SAME: omp.declare_target = #omp.declaretarget<device_type = (nohost), capture_clause = (to)>
+// CHECK-SAME: omp.declare_target = #omp.declaretarget<device_type = nohost, capture_clause = to>
 llvm.func @fn_nohost() attributes {
     omp.declare_target = #omp.declaretarget<
-        device_type = (nohost), capture_clause = (to)>} {
+        device_type = nohost, capture_clause = to>} {
   llvm.call @callee() : () -> ()
   llvm.return
 }
@@ -262,34 +262,34 @@ llvm.func @fn_nohost() attributes {
 // Always use implicit device_type(any) for external and public functions.
 
 // CHECK: llvm.func {{.*}}@external_host()
-// CHECK-SAME: omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (to), implicit = true>
+// CHECK-SAME: omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = to, implicit = true>
 llvm.func @external_host()
 // CHECK: llvm.func {{.*}}@external_nohost()
-// CHECK-SAME: omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (to), implicit = true>
+// CHECK-SAME: omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = to, implicit = true>
 llvm.func @external_nohost()
 // CHECK: llvm.func {{.*}}@external_both()
-// CHECK-SAME: omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (to), implicit = true>
+// CHECK-SAME: omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = to, implicit = true>
 llvm.func @external_both()
 // CHECK: llvm.func {{.*}}@public_host()
-// CHECK-SAME: omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (to), implicit = true>
+// CHECK-SAME: omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = to, implicit = true>
 llvm.func @public_host() {
   llvm.return
 }
 // CHECK: llvm.func {{.*}}@public_nohost()
-// CHECK-SAME: omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (to), implicit = true>
+// CHECK-SAME: omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = to, implicit = true>
 llvm.func @public_nohost() {
   llvm.return
 }
 // CHECK: llvm.func {{.*}}@public_both()
-// CHECK-SAME: omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (to), implicit = true>
+// CHECK-SAME: omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = to, implicit = true>
 llvm.func @public_both() {
   llvm.return
 }
 // CHECK: llvm.func {{.*}}@fn_host()
-// CHECK-SAME: omp.declare_target = #omp.declaretarget<device_type = (host), capture_clause = (to)>
+// CHECK-SAME: omp.declare_target = #omp.declaretarget<device_type = host, capture_clause = to>
 llvm.func @fn_host() attributes {
     omp.declare_target = #omp.declaretarget<
-        device_type = (host), capture_clause = (to)>} {
+        device_type = host, capture_clause = to>} {
   llvm.call @external_host() : () -> ()
   llvm.call @external_both() : () -> ()
   llvm.call @public_host() : () -> ()
@@ -297,10 +297,10 @@ llvm.func @fn_host() attributes {
   llvm.return
 }
 // CHECK: llvm.func {{.*}}@fn_nohost()
-// CHECK-SAME: omp.declare_target = #omp.declaretarget<device_type = (nohost), capture_clause = (to)>
+// CHECK-SAME: omp.declare_target = #omp.declaretarget<device_type = nohost, capture_clause = to>
 llvm.func @fn_nohost() attributes {
     omp.declare_target = #omp.declaretarget<
-        device_type = (nohost), capture_clause = (to)>} {
+        device_type = nohost, capture_clause = to>} {
   llvm.call @external_nohost() : () -> ()
   llvm.call @external_both() : () -> ()
   llvm.call @public_nohost() : () -> ()
@@ -340,19 +340,19 @@ cleanup {
 }
 
 // CHECK: llvm.func {{.*}}@red_callee()
-// CHECK-SAME: omp.declare_target = #omp.declaretarget<device_type = (host), capture_clause = (to), implicit = true>
+// CHECK-SAME: omp.declare_target = #omp.declaretarget<device_type = host, capture_clause = to, implicit = true>
 llvm.func @red_callee() attributes {sym_visibility = "private"} {
   llvm.return
 }
 // CHECK: llvm.func {{.*}}@priv_callee()
-// CHECK-SAME: omp.declare_target = #omp.declaretarget<device_type = (nohost), capture_clause = (to), implicit = true>
+// CHECK-SAME: omp.declare_target = #omp.declaretarget<device_type = nohost, capture_clause = to, implicit = true>
 llvm.func @priv_callee() attributes {sym_visibility = "private"} {
   llvm.return
 }
 
 llvm.func @main(%arg0 : !llvm.ptr) attributes {
     omp.declare_target = #omp.declaretarget<
-        device_type = (host), capture_clause = (to)>} {
+        device_type = host, capture_clause = to>} {
   %0 = omp.map.info var_ptr(%arg0 : !llvm.ptr, i32) map_clauses(tofrom) capture(ByRef) -> !llvm.ptr
   omp.target kernel_type(generic) in_reduction(@red %arg0 : !llvm.ptr)
              map_entries(%0 -> %arg1 : !llvm.ptr)
@@ -368,18 +368,18 @@ llvm.func @main(%arg0 : !llvm.ptr) attributes {
 // pass.
 
 // CHECK: llvm.func {{.*}}@callee()
-// CHECK-SAME: omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (to), implicit = true>
+// CHECK-SAME: omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = to, implicit = true>
 llvm.func @callee() attributes {
     sym_visibility = "private",
     omp.declare_target = #omp.declaretarget<
-        device_type = (host), capture_clause = (to), implicit = true>} {
+        device_type = host, capture_clause = to, implicit = true>} {
   llvm.return
 }
 // CHECK: llvm.func {{.*}}@main()
-// CHECK-SAME: omp.declare_target = #omp.declaretarget<device_type = (nohost), capture_clause = (to)>
+// CHECK-SAME: omp.declare_target = #omp.declaretarget<device_type = nohost, capture_clause = to>
 llvm.func @main() attributes {
     omp.declare_target = #omp.declaretarget<
-        device_type = (nohost), capture_clause = (to)>} {
+        device_type = nohost, capture_clause = to>} {
   llvm.call @callee() : () -> ()
   llvm.return
 }
diff --git a/mlir/test/Dialect/OpenMP/stack-to-shared.mlir b/mlir/test/Dialect/OpenMP/stack-to-shared.mlir
index 972d3fe39e7bc..2f71674e6257f 100644
--- a/mlir/test/Dialect/OpenMP/stack-to-shared.mlir
+++ b/mlir/test/Dialect/OpenMP/stack-to-shared.mlir
@@ -25,11 +25,11 @@ omp.private {type = firstprivate} @firstprivatizer_f32 : !llvm.ptr copy {
   omp.yield(%arg0 : !llvm.ptr)
 }
 
-llvm.func @foo(%arg0: !llvm.ptr) attributes {omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (to)>}
+llvm.func @foo(%arg0: !llvm.ptr) attributes {omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = to>}
 
 // CHECK-LABEL: llvm.func @device_func(
 // CHECK-SAME:  %[[N:.*]]: i64, %[[COND:.*]]: i1)
-llvm.func @device_func(%arg0: i64, %cond: i1) attributes {omp.declare_target = #omp.declaretarget<device_type = (nohost), capture_clause = (to)>} {
+llvm.func @device_func(%arg0: i64, %cond: i1) attributes {omp.declare_target = #omp.declaretarget<device_type = nohost, capture_clause = to>} {
   // CHECK: %[[ALLOC0:.*]] = omp.alloc_shared_mem %[[N]] x i64 : (i64) -> !llvm.ptr
   %0 = llvm.alloca %arg0 x i64 : (i64) -> !llvm.ptr
   // CHECK: %[[ALLOC1:.*]] = omp.alloc_shared_mem %[[N]] x f32 : (i64) align(128) -> !llvm.ptr
diff --git a/mlir/test/Target/LLVMIR/omptarget-atomic-capture-control-options.mlir b/mlir/test/Target/LLVMIR/omptarget-atomic-capture-control-options.mlir
index 01a46dacb4346..1145a9800deeb 100644
--- a/mlir/test/Target/LLVMIR/omptarget-atomic-capture-control-options.mlir
+++ b/mlir/test/Target/LLVMIR/omptarget-atomic-capture-control-options.mlir
@@ -3,7 +3,7 @@
 // CHECK: atomicrmw add ptr %loadgep_, i32 1 monotonic, align 4, !amdgpu.no.remote.memory !{{.*}}
 
 module attributes {dlti.dl_spec = #dlti.dl_spec<!llvm.ptr = dense<64> : vector<4xi64>, !llvm.ptr<1> = dense<64> : vector<4xi64>, !llvm.ptr<2> = dense<32> : vector<4xi64>, !llvm.ptr<3> = dense<32> : vector<4xi64>, !llvm.ptr<4> = dense<64> : vector<4xi64>, !llvm.ptr<5> = dense<32> : vector<4xi64>, !llvm.ptr<6> = dense<32> : vector<4xi64>, !llvm.ptr<7> = dense<[160, 256, 256, 32]> : vector<4xi64>, !llvm.ptr<8> = dense<[128, 128, 128, 48]> : vector<4xi64>, !llvm.ptr<9> = dense<[192, 256, 256, 32]> : vector<4xi64>, i64 = dense<64> : vector<2xi64>, i1 = dense<8> : vector<2xi64>, i8 = dense<8> : vector<2xi64>, i16 = dense<16> : vector<2xi64>, i32 = dense<32> : vector<2xi64>, f16 = dense<16> : vector<2xi64>, f64 = dense<64> : vector<2xi64>, f128 = dense<128> : vector<2xi64>, "dlti.endianness" = "little", "dlti.legal_int_widths" = array<i32: 32, 64>, "dlti.stack_alignment" = 32 : i64, "dlti.alloca_memory_space" = 5 : ui64, "dlti.global_memory_space" = 1 : ui64>, fir.atomic_fine_grained_memory, fir.defaultkind = "a1c4d8i4l4r4", fir.kindmap = "", fir.target_cpu = "generic-hsa", llvm.data_layout = "e-p:64:64-p1:64:64-p2:32:32-p3:32:32-p4:64:64-p5:32:32-p6:32:32-p7:160:256:256:32-p8:128:128:128:48-p9:192:256:256:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64-S32-A5-G1-ni:7:8:9", llvm.target_triple = "amdgcn-amd-amdhsa", omp.flags = #omp.flags<openmp_device_version = 31>, omp.is_gpu = true, omp.is_target_device = true, omp.requires = #omp<clause_requires none>, omp.target_triples = [], omp.version = #omp.version<version = 31>} {
-  llvm.func @_QQmain() attributes {fir.bindc_name = "TEST", omp.declare_target = #omp.declaretarget<device_type = (host), capture_clause = (to)>, target_cpu = "generic-hsa"} {
+  llvm.func @_QQmain() attributes {fir.bindc_name = "TEST", omp.declare_target = #omp.declaretarget<device_type = host, capture_clause = to>, target_cpu = "generic-hsa"} {
     %0 = llvm.mlir.constant(1 : i64) : i64
     %1 = llvm.alloca %0 x i32 {bindc_name = "threads"} : (i64) -> !llvm.ptr<5>
     %2 = llvm.addrspacecast %1 : !llvm.ptr<5> to !llvm.ptr
diff --git a/mlir/test/Target/LLVMIR/omptarget-atomic-update-control-options.mlir b/mlir/test/Target/LLVMIR/omptarget-atomic-update-control-options.mlir
index 45fbb2e1fbe89..bf6c36cf768a1 100644
--- a/mlir/test/Target/LLVMIR/omptarget-atomic-update-control-options.mlir
+++ b/mlir/test/Target/LLVMIR/omptarget-atomic-update-control-options.mlir
@@ -3,7 +3,7 @@
 // CHECK: atomicrmw add ptr %loadgep_, i32 1 monotonic, align 4, !amdgpu.ignore.denormal.mode !{{.*}}, !amdgpu.no.fine.grained.memory !{{.*}}, !amdgpu.no.remote.memory !{{.*}}
 
 module attributes {dlti.dl_spec = #dlti.dl_spec<!llvm.ptr = dense<64> : vector<4xi64>, !llvm.ptr<1> = dense<64> : vector<4xi64>, !llvm.ptr<2> = dense<32> : vector<4xi64>, !llvm.ptr<3> = dense<32> : vector<4xi64>, !llvm.ptr<4> = dense<64> : vector<4xi64>, !llvm.ptr<5> = dense<32> : vector<4xi64>, !llvm.ptr<6> = dense<32> : vector<4xi64>, !llvm.ptr<7> = dense<[160, 256, 256, 32]> : vector<4xi64>, !llvm.ptr<8> = dense<[128, 128, 128, 48]> : vector<4xi64>, !llvm.ptr<9> = dense<[192, 256, 256, 32]> : vector<4xi64>, i64 = dense<64> : vector<2xi64>, i1 = dense<8> : vector<2xi64>, i8 = dense<8> : vector<2xi64>, i16 = dense<16> : vector<2xi64>, i32 = dense<32> : vector<2xi64>, f16 = dense<16> : vector<2xi64>, f64 = dense<64> : vector<2xi64>, f128 = dense<128> : vector<2xi64>, "dlti.endianness" = "little", "dlti.legal_int_widths" = array<i32: 32, 64>, "dlti.stack_alignment" = 32 : i64, "dlti.alloca_memory_space" = 5 : ui64, "dlti.global_memory_space" = 1 : ui64>, fir.atomic_ignore_denormal_mode, fir.defaultkind = "a1c4d8i4l4r4", fir.kindmap = "", fir.target_cpu = "generic-hsa", llvm.data_layout = "e-p:64:64-p1:64:64-p2:32:32-p3:32:32-p4:64:64-p5:32:32-p6:32:32-p7:160:256:256:32-p8:128:128:128:48-p9:192:256:256:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64-S32-A5-G1-ni:7:8:9", llvm.target_triple = "amdgcn-amd-amdhsa", omp.flags = #omp.flags<openmp_device_version = 31>, omp.is_gpu = true, omp.is_target_device = true, omp.requires = #omp<clause_requires none>, omp.target_triples = [], omp.version = #omp.version<version = 31>} {
-  llvm.func @_QQmain() attributes {fir.bindc_name = "TEST", omp.declare_target = #omp.declaretarget<device_type = (host), capture_clause = (to)>, target_cpu = "generic-hsa"} {
+  llvm.func @_QQmain() attributes {fir.bindc_name = "TEST", omp.declare_target = #omp.declaretarget<device_type = host, capture_clause = to>, target_cpu = "generic-hsa"} {
     %0 = llvm.mlir.constant(1 : i64) : i64
     %1 = llvm.alloca %0 x i32 {bindc_name = "threads"} : (i64) -> !llvm.ptr<5>
     %2 = llvm.addrspacecast %1 : !llvm.ptr<5> to !llvm.ptr
diff --git a/mlir/test/Target/LLVMIR/omptarget-constant-alloca-raise.mlir b/mlir/test/Target/LLVMIR/omptarget-constant-alloca-raise.mlir
index dae2d2daa7091..1b53ec3e058a8 100644
--- a/mlir/test/Target/LLVMIR/omptarget-constant-alloca-raise.mlir
+++ b/mlir/test/Target/LLVMIR/omptarget-constant-alloca-raise.mlir
@@ -11,7 +11,7 @@
 // scenarios. 
 
 module attributes {dlti.dl_spec = #dlti.dl_spec<#dlti.dl_entry<"dlti.alloca_memory_space", 5 : ui32>>, llvm.target_triple = "amdgcn-amd-amdhsa", omp.is_target_device = true} {
-  llvm.func @_QQmain() attributes {omp.declare_target = #omp.declaretarget<device_type = (host), capture_clause = (to)>} {
+  llvm.func @_QQmain() attributes {omp.declare_target = #omp.declaretarget<device_type = host, capture_clause = to>} {
     %1 = llvm.mlir.constant(1 : i64) : i64
     %2 = llvm.alloca %1 x !llvm.struct<(ptr)> : (i64) -> !llvm.ptr
     %3 = omp.map.info var_ptr(%2 : !llvm.ptr, !llvm.struct<(ptr)>) map_clauses(tofrom) capture(ByRef) -> !llvm.ptr
diff --git a/mlir/test/Target/LLVMIR/omptarget-debug-map-link-loc.mlir b/mlir/test/Target/LLVMIR/omptarget-debug-map-link-loc.mlir
index d8181b0c3fb17..eb0bb04d10e30 100644
--- a/mlir/test/Target/LLVMIR/omptarget-debug-map-link-loc.mlir
+++ b/mlir/test/Target/LLVMIR/omptarget-debug-map-link-loc.mlir
@@ -1,7 +1,7 @@
 // RUN: mlir-translate -mlir-to-llvmir %s
 
 module attributes {dlti.dl_spec = #dlti.dl_spec<#dlti.dl_entry<"dlti.alloca_memory_space", 5 : ui32>>, llvm.target_triple = "amdgcn-amd-amdhsa", omp.is_target_device = true} {
-  llvm.mlir.global external @_QMtest_0Esp() {addr_space = 0 : i32, omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (link)>} : i32 {
+  llvm.mlir.global external @_QMtest_0Esp() {addr_space = 0 : i32, omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = link>} : i32 {
     %0 = llvm.mlir.constant(1 : i32) : i32 loc(#loc1)
     llvm.return %0 : i32 loc(#loc1)
   } loc(#loc1)
diff --git a/mlir/test/Target/LLVMIR/omptarget-declare-target-all-device-types-device.mlir b/mlir/test/Target/LLVMIR/omptarget-declare-target-all-device-types-device.mlir
index 3e0bb2404783b..73ca99ef94837 100644
--- a/mlir/test/Target/LLVMIR/omptarget-declare-target-all-device-types-device.mlir
+++ b/mlir/test/Target/LLVMIR/omptarget-declare-target-all-device-types-device.mlir
@@ -9,14 +9,14 @@ module attributes {llvm.target_triple = "amdgcn-amd-amdhsa", omp.is_gpu = true,
 
   // CHECK-DAG: @ial = internal global float 0.000000e+00
   // CHECK-DAG: @ial_decl_tgt_ref_ptr = weak global ptr null, align 8
-  llvm.mlir.global internal @ial() {addr_space = 0 : i32, omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (link)>} : f32 {
+  llvm.mlir.global internal @ial() {addr_space = 0 : i32, omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = link>} : f32 {
     %0 = llvm.mlir.zero : f32
     llvm.return %0 : f32
   }
 
   // CHECK-DAG: @eal = internal global float 0.000000e+00
   // CHECK-DAG: @eal_decl_tgt_ref_ptr = weak global ptr null, align 8
-  llvm.mlir.global external @eal() {addr_space = 0 : i32, dso_local, omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (link)>} : f32 {
+  llvm.mlir.global external @eal() {addr_space = 0 : i32, dso_local, omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = link>} : f32 {
     %0 = llvm.mlir.zero : f32
     llvm.return %0 : f32
   }
@@ -25,14 +25,14 @@ module attributes {llvm.target_triple = "amdgcn-amd-amdhsa", omp.is_gpu = true,
 
   // CHECK-DAG: @ihl = internal global float 0.000000e+00
   // CHECK-DAG: @ihl_decl_tgt_ref_ptr = weak global ptr null, align 8
-  llvm.mlir.global internal @ihl() {addr_space = 0 : i32, omp.declare_target = #omp.declaretarget<device_type = (host), capture_clause = (link)>} : f32 {
+  llvm.mlir.global internal @ihl() {addr_space = 0 : i32, omp.declare_target = #omp.declaretarget<device_type = host, capture_clause = link>} : f32 {
     %0 = llvm.mlir.zero : f32
     llvm.return %0 : f32
   }
 
   // CHECK-DAG: @ehl = internal global float 0.000000e+00
   // CHECK-DAG: @ehl_decl_tgt_ref_ptr = weak global ptr null, align 8
-  llvm.mlir.global external @ehl() {addr_space = 0 : i32, dso_local, omp.declare_target = #omp.declaretarget<device_type = (host), capture_clause = (link)>} : f32 {
+  llvm.mlir.global external @ehl() {addr_space = 0 : i32, dso_local, omp.declare_target = #omp.declaretarget<device_type = host, capture_clause = link>} : f32 {
     %0 = llvm.mlir.zero : f32
     llvm.return %0 : f32
   }
@@ -41,14 +41,14 @@ module attributes {llvm.target_triple = "amdgcn-amd-amdhsa", omp.is_gpu = true,
 
   // CHECK-DAG: @inl = internal global float 0.000000e+00
   // CHECK-DAG: @inl_decl_tgt_ref_ptr = weak global ptr null, align 8
-  llvm.mlir.global internal @inl() {addr_space = 0 : i32, omp.declare_target = #omp.declaretarget<device_type = (nohost), capture_clause = (link)>} : f32 {
+  llvm.mlir.global internal @inl() {addr_space = 0 : i32, omp.declare_target = #omp.declaretarget<device_type = nohost, capture_clause = link>} : f32 {
     %0 = llvm.mlir.zero : f32
     llvm.return %0 : f32
   }
 
   // CHECK-DAG: @enl = internal global float 0.000000e+00
   // CHECK-DAG: @enl_decl_tgt_ref_ptr = weak global ptr null, align 8
-  llvm.mlir.global external @enl() {addr_space = 0 : i32, dso_local, omp.declare_target = #omp.declaretarget<device_type = (nohost), capture_clause = (link)>} : f32 {
+  llvm.mlir.global external @enl() {addr_space = 0 : i32, dso_local, omp.declare_target = #omp.declaretarget<device_type = nohost, capture_clause = link>} : f32 {
     %0 = llvm.mlir.zero : f32
     llvm.return %0 : f32
   }
@@ -56,13 +56,13 @@ module attributes {llvm.target_triple = "amdgcn-amd-amdhsa", omp.is_gpu = true,
   // --- enter any ---
 
   // CHECK-DAG: @iae = global float 0.000000e+00
-  llvm.mlir.global internal @iae() {addr_space = 0 : i32, omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (enter)>} : f32 {
+  llvm.mlir.global internal @iae() {addr_space = 0 : i32, omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = enter>} : f32 {
     %0 = llvm.mlir.zero : f32
     llvm.return %0 : f32
   }
 
   // CHECK-DAG: @eae = dso_local global float 0.000000e+00
-  llvm.mlir.global external @eae() {addr_space = 0 : i32, dso_local, omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (enter)>} : f32 {
+  llvm.mlir.global external @eae() {addr_space = 0 : i32, dso_local, omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = enter>} : f32 {
     %0 = llvm.mlir.zero : f32
     llvm.return %0 : f32
   }
@@ -70,13 +70,13 @@ module attributes {llvm.target_triple = "amdgcn-amd-amdhsa", omp.is_gpu = true,
   // --- enter host ---
 
   // CHECK-DAG: @ihe = external dso_local global float
-  llvm.mlir.global internal @ihe() {addr_space = 0 : i32, omp.declare_target = #omp.declaretarget<device_type = (host), capture_clause = (enter)>} : f32 {
+  llvm.mlir.global internal @ihe() {addr_space = 0 : i32, omp.declare_target = #omp.declaretarget<device_type = host, capture_clause = enter>} : f32 {
     %0 = llvm.mlir.zero : f32
     llvm.return %0 : f32
   }
 
   // CHECK-DAG: @ehe = external dso_local global float
-  llvm.mlir.global external @ehe() {addr_space = 0 : i32, dso_local, omp.declare_target = #omp.declaretarget<device_type = (host), capture_clause = (enter)>} : f32 {
+  llvm.mlir.global external @ehe() {addr_space = 0 : i32, dso_local, omp.declare_target = #omp.declaretarget<device_type = host, capture_clause = enter>} : f32 {
     %0 = llvm.mlir.zero : f32
     llvm.return %0 : f32
   }
@@ -84,13 +84,13 @@ module attributes {llvm.target_triple = "amdgcn-amd-amdhsa", omp.is_gpu = true,
   // --- enter nohost ---
 
   // CHECK-DAG: @ine = global float 0.000000e+00
-  llvm.mlir.global internal @ine() {addr_space = 0 : i32, omp.declare_target = #omp.declaretarget<device_type = (nohost), capture_clause = (enter)>} : f32 {
+  llvm.mlir.global internal @ine() {addr_space = 0 : i32, omp.declare_target = #omp.declaretarget<device_type = nohost, capture_clause = enter>} : f32 {
     %0 = llvm.mlir.zero : f32
     llvm.return %0 : f32
   }
 
   // CHECK-DAG: @ene = dso_local global float 0.000000e+00
-  llvm.mlir.global external @ene() {addr_space = 0 : i32, dso_local, omp.declare_target = #omp.declaretarget<device_type = (nohost), capture_clause = (enter)>} : f32 {
+  llvm.mlir.global external @ene() {addr_space = 0 : i32, dso_local, omp.declare_target = #omp.declaretarget<device_type = nohost, capture_clause = enter>} : f32 {
     %0 = llvm.mlir.zero : f32
     llvm.return %0 : f32
   }
diff --git a/mlir/test/Target/LLVMIR/omptarget-declare-target-func-visibility.mlir b/mlir/test/Target/LLVMIR/omptarget-declare-target-func-visibility.mlir
index f5f3c9f419f0b..fdbe2cf13d98d 100644
--- a/mlir/test/Target/LLVMIR/omptarget-declare-target-func-visibility.mlir
+++ b/mlir/test/Target/LLVMIR/omptarget-declare-target-func-visibility.mlir
@@ -9,19 +9,19 @@
 
 module attributes {llvm.target_triple = "amdgcn-amd-amdhsa", omp.is_target_device = true} {
   // CHECK: define hidden void @device_any()
-  llvm.func @device_any() attributes {omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (to)>} {
+  llvm.func @device_any() attributes {omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = to>} {
     llvm.return
   }
 
   // CHECK: define hidden void @device_nohost()
-  llvm.func @device_nohost() attributes {omp.declare_target = #omp.declaretarget<device_type = (nohost), capture_clause = (to)>} {
+  llvm.func @device_nohost() attributes {omp.declare_target = #omp.declaretarget<device_type = nohost, capture_clause = to>} {
     llvm.return
   }
 
   // A function with an explicitly requested (non-default) visibility is left
   // untouched.
   // CHECK: define protected void @device_protected()
-  llvm.func protected @device_protected() attributes {omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (to)>} {
+  llvm.func protected @device_protected() attributes {omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = to>} {
     llvm.return
   }
 
@@ -34,5 +34,5 @@ module attributes {llvm.target_triple = "amdgcn-amd-amdhsa", omp.is_target_devic
   // A declaration (no definition) is left untouched: there is nothing to
   // internalize, and hiding it could over-constrain the symbol's visibility.
   // CHECK: declare void @device_decl()
-  llvm.func @device_decl() attributes {omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (to)>}
+  llvm.func @device_decl() attributes {omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = to>}
 }
diff --git a/mlir/test/Target/LLVMIR/omptarget-declare-target-llvm-device-2.mlir b/mlir/test/Target/LLVMIR/omptarget-declare-target-llvm-device-2.mlir
index e53c0430a731c..3b6243c160d47 100644
--- a/mlir/test/Target/LLVMIR/omptarget-declare-target-llvm-device-2.mlir
+++ b/mlir/test/Target/LLVMIR/omptarget-declare-target-llvm-device-2.mlir
@@ -6,19 +6,19 @@
 
 module attributes {llvm.target_triple = "amdgcn-amd-amdhsa", omp.is_target_device = true, omp.requires = #omp<clause_requires unified_shared_memory>} {
   // CHECK-DAG: @_QMtest_0Evar_to_usm_decl_tgt_ref_ptr = weak global ptr null, align 8
-  llvm.mlir.global external @_QMtest_0Evar_to_usm() {addr_space = 0 : i32, omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (to)>} : i32 {
+  llvm.mlir.global external @_QMtest_0Evar_to_usm() {addr_space = 0 : i32, omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = to>} : i32 {
     %0 = llvm.mlir.constant(1 : i32) : i32
     llvm.return %0 : i32
   }
 
   // CHECK-DAG: @_QMtest_0Evar_enter_usm_decl_tgt_ref_ptr = weak global ptr null, align 8
-  llvm.mlir.global external @_QMtest_0Evar_enter_usm() {addr_space = 0 : i32, omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (enter)>} : i32 {
+  llvm.mlir.global external @_QMtest_0Evar_enter_usm() {addr_space = 0 : i32, omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = enter>} : i32 {
     %0 = llvm.mlir.constant(2 : i32) : i32
     llvm.return %0 : i32
   }
 
   // CHECK-DAG: @_QMtest_0Evar_link_usm_decl_tgt_ref_ptr = weak global ptr null, align 8
-  llvm.mlir.global external @_QMtest_0Evar_link_usm() {addr_space = 0 : i32, omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (link)>} : i32 {
+  llvm.mlir.global external @_QMtest_0Evar_link_usm() {addr_space = 0 : i32, omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = link>} : i32 {
     %0 = llvm.mlir.constant(3 : i32) : i32
     llvm.return %0 : i32
   }
diff --git a/mlir/test/Target/LLVMIR/omptarget-declare-target-llvm-device.mlir b/mlir/test/Target/LLVMIR/omptarget-declare-target-llvm-device.mlir
index 3473965ab57c5..e0540a530ed71 100644
--- a/mlir/test/Target/LLVMIR/omptarget-declare-target-llvm-device.mlir
+++ b/mlir/test/Target/LLVMIR/omptarget-declare-target-llvm-device.mlir
@@ -10,7 +10,7 @@
 module attributes {llvm.target_triple = "amdgcn-amd-amdhsa", omp.is_target_device = true} {
   // CHECK-DAG: @_QMtest_0Esp = internal global i32
   // CHECK-DAG: @_QMtest_0Esp_decl_tgt_ref_ptr = weak global ptr null, align 8
-  llvm.mlir.global external @_QMtest_0Esp() {addr_space = 0 : i32, omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (link)>} : i32 {
+  llvm.mlir.global external @_QMtest_0Esp() {addr_space = 0 : i32, omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = link>} : i32 {
     %0 = llvm.mlir.constant(0 : i32) : i32
     llvm.return %0 : i32
   }
diff --git a/mlir/test/Target/LLVMIR/omptarget-declare-target-llvm-host.mlir b/mlir/test/Target/LLVMIR/omptarget-declare-target-llvm-host.mlir
index acaa1b7aac9f4..3e925e47453eb 100644
--- a/mlir/test/Target/LLVMIR/omptarget-declare-target-llvm-host.mlir
+++ b/mlir/test/Target/LLVMIR/omptarget-declare-target-llvm-host.mlir
@@ -9,14 +9,14 @@ module attributes {llvm.target_triple = "x86_64-unknown-linux-gnu", omp.is_targe
   // CHECK-DAG: @.offloading.entry_name{{.*}} = internal unnamed_addr constant [36 x i8] c"_QMtest_0Earray_1d_decl_tgt_ref_ptr\00"
   // CHECK-DAG: @.offloading.entry._QMtest_0Earray_1d_decl_tgt_ref_ptr = weak constant %struct.__tgt_offload_entry { i64 0, i16 1, i16 1, i32 1, ptr @_QMtest_0Earray_1d_decl_tgt_ref_ptr, ptr @.offloading.entry_name{{.*}}, i64 8, i64 0, ptr null }, section "llvm_offload_entries"
   // CHECK-DAG: !{{.*}} = !{i32 {{.*}}, !"_QMtest_0Earray_1d_decl_tgt_ref_ptr", i32 {{.*}}, i32 {{.*}}}
-  llvm.mlir.global external @_QMtest_0Earray_1d(dense<[1, 2, 3]> : tensor<3xi32>) {addr_space = 0 : i32, omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (link)>} : !llvm.array<3 x i32>
+  llvm.mlir.global external @_QMtest_0Earray_1d(dense<[1, 2, 3]> : tensor<3xi32>) {addr_space = 0 : i32, omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = link>} : !llvm.array<3 x i32>
 
   // CHECK-DAG: @_QMtest_0Earray_2d = global [2 x [2 x i32]] {{.*}}
   // CHECK-DAG: @_QMtest_0Earray_2d_decl_tgt_ref_ptr = weak global ptr @_QMtest_0Earray_2d
   // CHECK-DAG: @.offloading.entry_name{{.*}} = internal unnamed_addr constant [36 x i8] c"_QMtest_0Earray_2d_decl_tgt_ref_ptr\00"
   // CHECK-DAG: @.offloading.entry._QMtest_0Earray_2d_decl_tgt_ref_ptr = weak constant %struct.__tgt_offload_entry { i64 0, i16 1, i16 1, i32 1, ptr @_QMtest_0Earray_2d_decl_tgt_ref_ptr, ptr @.offloading.entry_name{{.*}}, i64 8, i64 0, ptr null }, section "llvm_offload_entries"
   // CHECK-DAG: !{{.*}} = !{i32 {{.*}}, !"_QMtest_0Earray_2d_decl_tgt_ref_ptr", i32 {{.*}}, i32 {{.*}}}
-  llvm.mlir.global external @_QMtest_0Earray_2d() {addr_space = 0 : i32, omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (link)>} : !llvm.array<2 x array<2 x i32>> {
+  llvm.mlir.global external @_QMtest_0Earray_2d() {addr_space = 0 : i32, omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = link>} : !llvm.array<2 x array<2 x i32>> {
     %0 = llvm.mlir.undef : !llvm.array<2 x array<2 x i32>>
     %1 = llvm.mlir.constant(1 : i32) : i32
     %2 = llvm.insertvalue %1, %0[0, 0] : !llvm.array<2 x array<2 x i32>>
@@ -36,7 +36,7 @@ module attributes {llvm.target_triple = "x86_64-unknown-linux-gnu", omp.is_targe
   // CHECK-DAG:  @.offloading.entry_name{{.*}} = internal unnamed_addr constant [48 x i8] c"_QMtest_0Edata_extended_link_1_decl_tgt_ref_ptr\00"
   // CHECK-DAG:  @.offloading.entry._QMtest_0Edata_extended_link_1_decl_tgt_ref_ptr = weak constant %struct.__tgt_offload_entry { i64 0, i16 1, i16 1, i32 1, ptr @_QMtest_0Edata_extended_link_1_decl_tgt_ref_ptr, ptr @.offloading.entry_name{{.*}}, i64 8, i64 0, ptr null }, section "llvm_offload_entries"
   // CHECK-DAG:  !{{.*}} = !{i32 {{.*}}, !"_QMtest_0Edata_extended_link_1_decl_tgt_ref_ptr", i32 {{.*}}, i32 {{.*}}}
-  llvm.mlir.global external @_QMtest_0Edata_extended_link_1() {addr_space = 0 : i32, omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (link)>} : f32 {
+  llvm.mlir.global external @_QMtest_0Edata_extended_link_1() {addr_space = 0 : i32, omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = link>} : f32 {
     %0 = llvm.mlir.constant(2.000000e+00 : f32) : f32
     llvm.return %0 : f32
   }
@@ -46,7 +46,7 @@ module attributes {llvm.target_triple = "x86_64-unknown-linux-gnu", omp.is_targe
   // CHECK-DAG:  @.offloading.entry_name{{.*}} = internal unnamed_addr constant [48 x i8] c"_QMtest_0Edata_extended_link_2_decl_tgt_ref_ptr\00"
   // CHECK-DAG:  @.offloading.entry._QMtest_0Edata_extended_link_2_decl_tgt_ref_ptr = weak constant %struct.__tgt_offload_entry { i64 0, i16 1, i16 1, i32 1, ptr @_QMtest_0Edata_extended_link_2_decl_tgt_ref_ptr, ptr @.offloading.entry_name{{.*}}, i64 8, i64 0, ptr null }, section "llvm_offload_entries"
   // CHECK-DAG:  !{{.*}} = !{i32 {{.*}}, !"_QMtest_0Edata_extended_link_2_decl_tgt_ref_ptr", i32 {{.*}}, i32 {{.*}}}
-  llvm.mlir.global external @_QMtest_0Edata_extended_link_2() {addr_space = 0 : i32, omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (link)>} : f32 {
+  llvm.mlir.global external @_QMtest_0Edata_extended_link_2() {addr_space = 0 : i32, omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = link>} : f32 {
     %0 = llvm.mlir.constant(3.000000e+00 : f32) : f32
     llvm.return %0 : f32
   }
@@ -55,7 +55,7 @@ module attributes {llvm.target_triple = "x86_64-unknown-linux-gnu", omp.is_targe
   // CHECK-DAG: @.offloading.entry_name{{.*}} = internal unnamed_addr constant [29 x i8] c"_QMtest_0Edata_extended_to_1\00"
   // CHECK-DAG: @.offloading.entry._QMtest_0Edata_extended_to_1 = weak constant %struct.__tgt_offload_entry { i64 0, i16 1, i16 1, i32 0, ptr @_QMtest_0Edata_extended_to_1, ptr @.offloading.entry_name{{.*}}, i64 4, i64 0, ptr null }, section "llvm_offload_entries"
   // CHECK-DAG: !{{.*}} = !{i32 {{.*}}, !"_QMtest_0Edata_extended_to_1", i32 {{.*}}, i32 {{.*}}}
-  llvm.mlir.global external @_QMtest_0Edata_extended_to_1() {addr_space = 0 : i32, omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (to)>} : f32 {
+  llvm.mlir.global external @_QMtest_0Edata_extended_to_1() {addr_space = 0 : i32, omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = to>} : f32 {
     %0 = llvm.mlir.constant(2.000000e+00 : f32) : f32
     llvm.return %0 : f32
   }
@@ -64,7 +64,7 @@ module attributes {llvm.target_triple = "x86_64-unknown-linux-gnu", omp.is_targe
   // CHECK-DAG: @.offloading.entry_name{{.*}} = internal unnamed_addr constant [32 x i8] c"_QMtest_0Edata_extended_enter_1\00"
   // CHECK-DAG: @.offloading.entry._QMtest_0Edata_extended_enter_1 = weak constant %struct.__tgt_offload_entry { i64 0, i16 1, i16 1, i32 0, ptr @_QMtest_0Edata_extended_enter_1, ptr @.offloading.entry_name{{.*}}, i64 4, i64 0, ptr null }, section "llvm_offload_entries"
   // CHECK-DAG: !{{.*}} = !{i32 {{.*}}, !"_QMtest_0Edata_extended_enter_1", i32 {{.*}}, i32 {{.*}}}
-  llvm.mlir.global external @_QMtest_0Edata_extended_enter_1() {addr_space = 0 : i32, omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (enter)>} : f32 {
+  llvm.mlir.global external @_QMtest_0Edata_extended_enter_1() {addr_space = 0 : i32, omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = enter>} : f32 {
     %0 = llvm.mlir.constant(2.000000e+00 : f32) : f32
     llvm.return %0 : f32
   }
@@ -73,7 +73,7 @@ module attributes {llvm.target_triple = "x86_64-unknown-linux-gnu", omp.is_targe
   // CHECK-DAG: @.offloading.entry_name{{.*}} = internal unnamed_addr constant [29 x i8] c"_QMtest_0Edata_extended_to_2\00"
   // CHECK-DAG: @.offloading.entry._QMtest_0Edata_extended_to_2 = weak constant %struct.__tgt_offload_entry { i64 0, i16 1, i16 1, i32 0, ptr @_QMtest_0Edata_extended_to_2, ptr @.offloading.entry_name{{.*}}, i64 4, i64 0, ptr null }, section "llvm_offload_entries"
   // CHECK-DAG: !{{.*}} = !{i32 {{.*}}, !"_QMtest_0Edata_extended_to_2", i32 {{.*}}, i32 {{.*}}}
-  llvm.mlir.global external @_QMtest_0Edata_extended_to_2() {addr_space = 0 : i32, omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (to)>} : f32 {
+  llvm.mlir.global external @_QMtest_0Edata_extended_to_2() {addr_space = 0 : i32, omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = to>} : f32 {
     %0 = llvm.mlir.constant(3.000000e+00 : f32) : f32
     llvm.return %0 : f32
   }
@@ -82,7 +82,7 @@ module attributes {llvm.target_triple = "x86_64-unknown-linux-gnu", omp.is_targe
   // CHECK-DAG: @.offloading.entry_name{{.*}} = internal unnamed_addr constant [32 x i8] c"_QMtest_0Edata_extended_enter_2\00"
   // CHECK-DAG: @.offloading.entry._QMtest_0Edata_extended_enter_2 = weak constant %struct.__tgt_offload_entry { i64 0, i16 1, i16 1, i32 0, ptr @_QMtest_0Edata_extended_enter_2, ptr @.offloading.entry_name{{.*}}, i64 4, i64 0, ptr null }, section "llvm_offload_entries"
   // CHECK-DAG: !{{.*}} = !{i32 {{.*}}, !"_QMtest_0Edata_extended_enter_2", i32 {{.*}}, i32 {{.*}}}
-  llvm.mlir.global external @_QMtest_0Edata_extended_enter_2() {addr_space = 0 : i32, omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (enter)>} : f32 {
+  llvm.mlir.global external @_QMtest_0Edata_extended_enter_2() {addr_space = 0 : i32, omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = enter>} : f32 {
     %0 = llvm.mlir.constant(3.000000e+00 : f32) : f32
     llvm.return %0 : f32
   }
@@ -92,7 +92,7 @@ module attributes {llvm.target_triple = "x86_64-unknown-linux-gnu", omp.is_targe
   // CHECK-DAG: @.offloading.entry_name{{.*}} = internal unnamed_addr constant [36 x i8] c"_QMtest_0Edata_int_decl_tgt_ref_ptr\00"
   // CHECK-DAG: @.offloading.entry._QMtest_0Edata_int_decl_tgt_ref_ptr = weak constant %struct.__tgt_offload_entry { i64 0, i16 1, i16 1, i32 1, ptr @_QMtest_0Edata_int_decl_tgt_ref_ptr, ptr @.offloading.entry_name{{.*}}, i64 8, i64 0, ptr null }, section "llvm_offload_entries"
   // CHECK-DAG: !{{.*}} = !{i32 {{.*}}, !"_QMtest_0Edata_int_decl_tgt_ref_ptr", i32 {{.*}}, i32 {{.*}}}
-  llvm.mlir.global external @_QMtest_0Edata_int() {addr_space = 0 : i32, omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (link)>} : i32 {
+  llvm.mlir.global external @_QMtest_0Edata_int() {addr_space = 0 : i32, omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = link>} : i32 {
     %0 = llvm.mlir.constant(10 : i32) : i32
     llvm.return %0 : i32
   }
@@ -101,7 +101,7 @@ module attributes {llvm.target_triple = "x86_64-unknown-linux-gnu", omp.is_targe
   // CHECK-DAG: @.offloading.entry_name{{.*}} = internal unnamed_addr constant [33 x i8] c"_QMtest_0Edata_int_clauseless_to\00"
   // CHECK-DAG: @.offloading.entry._QMtest_0Edata_int_clauseless_to = weak constant %struct.__tgt_offload_entry { i64 0, i16 1, i16 1, i32 0, ptr @_QMtest_0Edata_int_clauseless_to, ptr @.offloading.entry_name{{.*}}, i64 4, i64 0, ptr null }, section "llvm_offload_entries"
   // CHECK-DAG: !{{.*}} = !{i32 {{.*}}, !"_QMtest_0Edata_int_clauseless_to", i32 {{.*}}, i32 {{.*}}}
-  llvm.mlir.global external @_QMtest_0Edata_int_clauseless_to() {addr_space = 0 : i32, omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (to)>} : i32 {
+  llvm.mlir.global external @_QMtest_0Edata_int_clauseless_to() {addr_space = 0 : i32, omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = to>} : i32 {
     %0 = llvm.mlir.constant(1 : i32) : i32
     llvm.return %0 : i32
   }
@@ -110,7 +110,7 @@ module attributes {llvm.target_triple = "x86_64-unknown-linux-gnu", omp.is_targe
   // CHECK-DAG: @.offloading.entry_name{{.*}} = internal unnamed_addr constant [36 x i8] c"_QMtest_0Edata_int_clauseless_enter\00"
   // CHECK-DAG: @.offloading.entry._QMtest_0Edata_int_clauseless_enter = weak constant %struct.__tgt_offload_entry { i64 0, i16 1, i16 1, i32 0, ptr @_QMtest_0Edata_int_clauseless_enter, ptr @.offloading.entry_name{{.*}}, i64 4, i64 0, ptr null }, section "llvm_offload_entries"
   // CHECK-DAG: !{{.*}} = !{i32 {{.*}}, !"_QMtest_0Edata_int_clauseless_enter", i32 {{.*}}, i32 {{.*}}}
-  llvm.mlir.global external @_QMtest_0Edata_int_clauseless_enter() {addr_space = 0 : i32, omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (enter)>} : i32 {
+  llvm.mlir.global external @_QMtest_0Edata_int_clauseless_enter() {addr_space = 0 : i32, omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = enter>} : i32 {
     %0 = llvm.mlir.constant(1 : i32) : i32
     llvm.return %0 : i32
   }
@@ -119,7 +119,7 @@ module attributes {llvm.target_triple = "x86_64-unknown-linux-gnu", omp.is_targe
   // CHECK-DAG: @.offloading.entry_name{{.*}} = internal unnamed_addr constant [22 x i8] c"_QMtest_0Edata_int_to\00"
   // CHECK-DAG: @.offloading.entry._QMtest_0Edata_int_to = weak constant %struct.__tgt_offload_entry { i64 0, i16 1, i16 1, i32 0, ptr @_QMtest_0Edata_int_to, ptr @.offloading.entry_name{{.*}}, i64 4, i64 0, ptr null }, section "llvm_offload_entries"
   // CHECK-DAG: !{{.*}} = !{i32 {{.*}}, !"_QMtest_0Edata_int_to", i32 {{.*}}, i32 {{.*}}}
-  llvm.mlir.global external @_QMtest_0Edata_int_to() {addr_space = 0 : i32, omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (to)>} : i32 {
+  llvm.mlir.global external @_QMtest_0Edata_int_to() {addr_space = 0 : i32, omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = to>} : i32 {
     %0 = llvm.mlir.constant(5 : i32) : i32
     llvm.return %0 : i32
   }
@@ -128,7 +128,7 @@ module attributes {llvm.target_triple = "x86_64-unknown-linux-gnu", omp.is_targe
   // CHECK-DAG: @.offloading.entry_name{{.*}} = internal unnamed_addr constant [25 x i8] c"_QMtest_0Edata_int_enter\00"
   // CHECK-DAG: @.offloading.entry._QMtest_0Edata_int_enter = weak constant %struct.__tgt_offload_entry { i64 0, i16 1, i16 1, i32 0, ptr @_QMtest_0Edata_int_enter, ptr @.offloading.entry_name{{.*}}, i64 4, i64 0, ptr null }, section "llvm_offload_entries"
   // CHECK-DAG: !{{.*}} = !{i32 {{.*}}, !"_QMtest_0Edata_int_enter", i32 {{.*}}, i32 {{.*}}}
-  llvm.mlir.global external @_QMtest_0Edata_int_enter() {addr_space = 0 : i32, omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (enter)>} : i32 {
+  llvm.mlir.global external @_QMtest_0Edata_int_enter() {addr_space = 0 : i32, omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = enter>} : i32 {
     %0 = llvm.mlir.constant(5 : i32) : i32
     llvm.return %0 : i32
   }
@@ -137,7 +137,7 @@ module attributes {llvm.target_triple = "x86_64-unknown-linux-gnu", omp.is_targe
   // CHECK-DAG: @.offloading.entry_name{{.*}} = internal unnamed_addr constant [19 x i8] c"_QFEinternal_enter\00"
   // CHECK-DAG: @.offloading.entry._QFEinternal_enter = weak constant %struct.__tgt_offload_entry { i64 0, i16 1, i16 1, i32 0, ptr @_QFEinternal_enter, ptr @.offloading.entry_name{{.*}}, i64 4, i64 0, ptr null }, section "llvm_offload_entries"
   // CHECK-DAG: !{{.*}} = !{i32 {{.*}}, !"_QFEinternal_enter", i32 {{.*}}, i32 {{.*}}}
-  llvm.mlir.global internal @_QFEinternal_enter() {addr_space = 0 : i32, omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (enter)>} : i32 {
+  llvm.mlir.global internal @_QFEinternal_enter() {addr_space = 0 : i32, omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = enter>} : i32 {
     %0 = llvm.mlir.constant(7 : i32) : i32
     llvm.return %0 : i32
   }
@@ -147,7 +147,7 @@ module attributes {llvm.target_triple = "x86_64-unknown-linux-gnu", omp.is_targe
   // CHECK-DAG: @.offloading.entry._QFEhidden_enter_decl_tgt_entry = weak constant %struct.__tgt_offload_entry { i64 0, i16 1, i16 1, i32 0, ptr @_QFEhidden_enter_decl_tgt_entry, ptr @.offloading.entry_name{{.*}}, i64 4, i64 0, ptr null }, section "llvm_offload_entries"
   // CHECK-DAG: @_QFEhidden_enter_decl_tgt_entry = weak alias i32, ptr @_QFEhidden_enter
   // CHECK-DAG: !{{.*}} = !{i32 {{.*}}, !"_QFEhidden_enter_decl_tgt_entry", i32 {{.*}}, i32 {{.*}}}
-  llvm.mlir.global external hidden @_QFEhidden_enter() {addr_space = 0 : i32, omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (enter)>} : i32 {
+  llvm.mlir.global external hidden @_QFEhidden_enter() {addr_space = 0 : i32, omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = enter>} : i32 {
     %0 = llvm.mlir.constant(8 : i32) : i32
     llvm.return %0 : i32
   }
@@ -157,7 +157,7 @@ module attributes {llvm.target_triple = "x86_64-unknown-linux-gnu", omp.is_targe
   // CHECK-DAG: @.offloading.entry_name{{.*}} = internal unnamed_addr constant [31 x i8] c"_QMtest_0Ept1_decl_tgt_ref_ptr\00"
   // CHECK-DAG: @.offloading.entry._QMtest_0Ept1_decl_tgt_ref_ptr = weak constant %struct.__tgt_offload_entry { i64 0, i16 1, i16 1, i32 1, ptr @_QMtest_0Ept1_decl_tgt_ref_ptr, ptr @.offloading.entry_name{{.*}}, i64 8, i64 0, ptr null }, section "llvm_offload_entries"
   // CHECK-DAG: !{{.*}} = !{i32 {{.*}}, !"_QMtest_0Ept1_decl_tgt_ref_ptr", i32 {{.*}}, i32 {{.*}}}
-  llvm.mlir.global external @_QMtest_0Ept1() {addr_space = 0 : i32, omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (link)>} : !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8)> {
+  llvm.mlir.global external @_QMtest_0Ept1() {addr_space = 0 : i32, omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = link>} : !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8)> {
     %0 = llvm.mlir.zero : !llvm.ptr
     %1 = llvm.mlir.constant(9 : i32) : i32
     %2 = llvm.mlir.zero : !llvm.ptr
@@ -188,7 +188,7 @@ module attributes {llvm.target_triple = "x86_64-unknown-linux-gnu", omp.is_targe
   // CHECK-DAG: @.offloading.entry_name{{.*}} = internal unnamed_addr constant [35 x i8] c"_QMtest_0Ept2_tar_decl_tgt_ref_ptr\00"
   // CHECK-DAG: @.offloading.entry._QMtest_0Ept2_tar_decl_tgt_ref_ptr = weak constant %struct.__tgt_offload_entry { i64 0, i16 1, i16 1, i32 1, ptr @_QMtest_0Ept2_tar_decl_tgt_ref_ptr, ptr @.offloading.entry_name{{.*}}, i64 8, i64 0, ptr null }, section "llvm_offload_entries"
   // CHECK-DAG: !{{.*}} = !{i32 {{.*}}, !"_QMtest_0Ept2_tar_decl_tgt_ref_ptr", i32 {{.*}}, i32 {{.*}}}
-  llvm.mlir.global external @_QMtest_0Ept2_tar() {addr_space = 0 : i32, omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (link)>} : i32 {
+  llvm.mlir.global external @_QMtest_0Ept2_tar() {addr_space = 0 : i32, omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = link>} : i32 {
     %0 = llvm.mlir.constant(5 : i32) : i32
     llvm.return %0 : i32
   }
diff --git a/mlir/test/Target/LLVMIR/omptarget-declare-target-module-rewrite-device.mlir b/mlir/test/Target/LLVMIR/omptarget-declare-target-module-rewrite-device.mlir
index 837e89d5357ea..0980f19f3a9c6 100644
--- a/mlir/test/Target/LLVMIR/omptarget-declare-target-module-rewrite-device.mlir
+++ b/mlir/test/Target/LLVMIR/omptarget-declare-target-module-rewrite-device.mlir
@@ -10,7 +10,7 @@
 
 module attributes {llvm.target_triple = "amdgcn-amd-amdhsa", omp.is_target_device = true} {
   // CHECK-DAG: @_QMtest_0Esp_decl_tgt_ref_ptr = weak global ptr null, align 8
-  llvm.mlir.global external @_QMtest_0Esp() {addr_space = 0 : i32, omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (link)>} : i32 {
+  llvm.mlir.global external @_QMtest_0Esp() {addr_space = 0 : i32, omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = link>} : i32 {
     %0 = llvm.mlir.constant(0 : i32) : i32
     llvm.return %0 : i32
   }
@@ -18,7 +18,7 @@ module attributes {llvm.target_triple = "amdgcn-amd-amdhsa", omp.is_target_devic
   // CHECK-LABEL: define {{.*}} @_QMtest_0Puse_global
   // CHECK: %[[REF:.*]] = load ptr, ptr @_QMtest_0Esp_decl_tgt_ref_ptr, align 8
   // CHECK: store i32 2, ptr %[[REF]], align 4
-  llvm.func @_QMtest_0Puse_global() attributes {omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (enter)>} {
+  llvm.func @_QMtest_0Puse_global() attributes {omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = enter>} {
     %0 = llvm.mlir.addressof @_QMtest_0Esp : !llvm.ptr
     %1 = llvm.mlir.constant(2 : i32) : i32
     llvm.store %1, %0 : i32, !llvm.ptr
@@ -52,7 +52,7 @@ module attributes {llvm.target_triple = "amdgcn-amd-amdhsa", omp.is_target_devic
 
 module attributes {llvm.target_triple = "amdgcn-amd-amdhsa", omp.is_target_device = true} {
   // CHECK-DAG: @_QMtest_0Esp_decl_tgt_ref_ptr = weak global ptr null, align 8
-  llvm.mlir.global external @_QMtest_0Esp() {addr_space = 0 : i32, omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (link)>} : i32 {
+  llvm.mlir.global external @_QMtest_0Esp() {addr_space = 0 : i32, omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = link>} : i32 {
     %0 = llvm.mlir.constant(0 : i32) : i32
     llvm.return %0 : i32
   }
@@ -70,7 +70,7 @@ module attributes {llvm.target_triple = "amdgcn-amd-amdhsa", omp.is_target_devic
   // CHECK: [[MERGE]]:
   // CHECK: %[[PHI:.*]] = phi ptr [ %[[PHI_B]], %[[BB_B]] ], [ %[[PHI_A]], %[[BB_A]] ]
   // CHECK: store i32 2, ptr %[[PHI]], align 4
-  llvm.func @_QMtest_0Puse_global(%cond : i1) attributes {omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (enter)>} {
+  llvm.func @_QMtest_0Puse_global(%cond : i1) attributes {omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = enter>} {
     %0 = llvm.mlir.addressof @_QMtest_0Esp : !llvm.ptr
     llvm.cond_br %cond, ^bb1(%0 : !llvm.ptr), ^bb2(%0 : !llvm.ptr)
   ^bb1(%arg1 : !llvm.ptr):
@@ -93,7 +93,7 @@ module attributes {llvm.target_triple = "amdgcn-amd-amdhsa", omp.is_target_devic
 
 module attributes {llvm.target_triple = "amdgcn-amd-amdhsa", omp.is_target_device = true} {
   // CHECK-DAG: @_QMtest_0Esp_decl_tgt_ref_ptr = weak global ptr null, align 8
-  llvm.mlir.global external @_QMtest_0Esp() {addr_space = 2 : i32, omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (link)>} : i32 {
+  llvm.mlir.global external @_QMtest_0Esp() {addr_space = 2 : i32, omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = link>} : i32 {
     %0 = llvm.mlir.constant(0 : i32) : i32
     llvm.return %0 : i32
   }
@@ -122,7 +122,7 @@ module attributes {llvm.target_triple = "amdgcn-amd-amdhsa", omp.is_target_devic
   // CHECK: [[M2]]:
   // CHECK: %[[PHI2:.*]] = phi ptr [ %[[PD]], %[[D]] ], [ %[[PC]], %[[C]] ]
   // CHECK: store i32 3, ptr %[[PHI2]], align 4
-  llvm.func @_QMtest_0Puse_global_nested(%cond1 : i1, %cond2 : i1) attributes {omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (enter)>} {
+  llvm.func @_QMtest_0Puse_global_nested(%cond1 : i1, %cond2 : i1) attributes {omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = enter>} {
     %g = llvm.mlir.addressof @_QMtest_0Esp : !llvm.ptr<2>
     %gc = llvm.addrspacecast %g : !llvm.ptr<2> to !llvm.ptr
     llvm.cond_br %cond1, ^bb1(%gc : !llvm.ptr), ^bb2(%gc : !llvm.ptr)
@@ -160,13 +160,13 @@ module attributes {llvm.target_triple = "amdgcn-amd-amdhsa", omp.is_target_devic
   // CHECK-NOT: @_QMtest_0Evar_to_decl_tgt_ref_ptr
   // CHECK-NOT: @_QMtest_0Evar_enter_decl_tgt_ref_ptr
   // CHECK-DAG: @_QMtest_0Evar_to = global i32
-  llvm.mlir.global external @_QMtest_0Evar_to() {addr_space = 0 : i32, omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (to)>} : i32 {
+  llvm.mlir.global external @_QMtest_0Evar_to() {addr_space = 0 : i32, omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = to>} : i32 {
     %0 = llvm.mlir.constant(1 : i32) : i32
     llvm.return %0 : i32
   }
 
   // CHECK-DAG: @_QMtest_0Evar_enter = global i32
-  llvm.mlir.global external @_QMtest_0Evar_enter() {addr_space = 0 : i32, omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (enter)>} : i32 {
+  llvm.mlir.global external @_QMtest_0Evar_enter() {addr_space = 0 : i32, omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = enter>} : i32 {
     %0 = llvm.mlir.constant(2 : i32) : i32
     llvm.return %0 : i32
   }
@@ -176,7 +176,7 @@ module attributes {llvm.target_triple = "amdgcn-amd-amdhsa", omp.is_target_devic
   // CHECK-NOT: load ptr, ptr @_QMtest_0Evar_enter_decl_tgt_ref_ptr
   // CHECK-DAG: store i32 100, ptr @_QMtest_0Evar_to, align 4
   // CHECK-DAG: store i32 200, ptr @_QMtest_0Evar_enter, align 4
-  llvm.func @_QMtest_0Puse_global() attributes {omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (enter)>} {
+  llvm.func @_QMtest_0Puse_global() attributes {omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = enter>} {
     %0 = llvm.mlir.addressof @_QMtest_0Evar_to : !llvm.ptr
     %1 = llvm.mlir.addressof @_QMtest_0Evar_enter : !llvm.ptr
     %c100 = llvm.mlir.constant(100 : i32) : i32
@@ -221,13 +221,13 @@ module attributes {llvm.target_triple = "amdgcn-amd-amdhsa", omp.is_target_devic
 
 module attributes {llvm.target_triple = "amdgcn-amd-amdhsa", omp.is_target_device = true, omp.requires = #omp<clause_requires unified_shared_memory>} {
   // CHECK-DAG: @_QMtest_0Evar_to_usm_decl_tgt_ref_ptr = weak global ptr null, align 8
-  llvm.mlir.global external @_QMtest_0Evar_to_usm() {addr_space = 0 : i32, omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (to)>} : i32 {
+  llvm.mlir.global external @_QMtest_0Evar_to_usm() {addr_space = 0 : i32, omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = to>} : i32 {
     %0 = llvm.mlir.constant(1 : i32) : i32
     llvm.return %0 : i32
   }
 
   // CHECK-DAG: @_QMtest_0Evar_enter_usm_decl_tgt_ref_ptr = weak global ptr null, align 8
-  llvm.mlir.global external @_QMtest_0Evar_enter_usm() {addr_space = 0 : i32, omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (enter)>} : i32 {
+  llvm.mlir.global external @_QMtest_0Evar_enter_usm() {addr_space = 0 : i32, omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = enter>} : i32 {
     %0 = llvm.mlir.constant(2 : i32) : i32
     llvm.return %0 : i32
   }
@@ -237,7 +237,7 @@ module attributes {llvm.target_triple = "amdgcn-amd-amdhsa", omp.is_target_devic
   // CHECK-DAG: store i32 100, ptr %[[TO_REF]], align 4
   // CHECK-DAG: %[[ENTER_REF:.*]] = load ptr, ptr @_QMtest_0Evar_enter_usm_decl_tgt_ref_ptr, align 8
   // CHECK-DAG: store i32 200, ptr %[[ENTER_REF]], align 4
-  llvm.func @_QMtest_0Puse_global() attributes {omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (enter)>} {
+  llvm.func @_QMtest_0Puse_global() attributes {omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = enter>} {
     %0 = llvm.mlir.addressof @_QMtest_0Evar_to_usm : !llvm.ptr
     %1 = llvm.mlir.addressof @_QMtest_0Evar_enter_usm : !llvm.ptr
     %c100 = llvm.mlir.constant(100 : i32) : i32
diff --git a/mlir/test/Target/LLVMIR/omptarget-declare-target-to-device.mlir b/mlir/test/Target/LLVMIR/omptarget-declare-target-to-device.mlir
index fd4c024d5cdae..dfae4fd52567f 100644
--- a/mlir/test/Target/LLVMIR/omptarget-declare-target-to-device.mlir
+++ b/mlir/test/Target/LLVMIR/omptarget-declare-target-to-device.mlir
@@ -7,7 +7,7 @@
 
 module attributes {llvm.target_triple = "amdgcn-amd-amdhsa", omp.is_gpu = true, omp.is_target_device = true} {
   // CHECK-DAG: @_QMtest_0Ezii = global [11 x float] zeroinitializer
-  llvm.mlir.global external @_QMtest_0Ezii() {addr_space = 0 : i32, omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (to)>} : !llvm.array<11 x f32> {
+  llvm.mlir.global external @_QMtest_0Ezii() {addr_space = 0 : i32, omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = to>} : !llvm.array<11 x f32> {
     %0 = llvm.mlir.zero : !llvm.array<11 x f32>
     llvm.return %0 : !llvm.array<11 x f32>
   }
diff --git a/mlir/test/Target/LLVMIR/omptarget-declare-target-to-host.mlir b/mlir/test/Target/LLVMIR/omptarget-declare-target-to-host.mlir
index b1c0a1ea78603..cf0f332f45098 100644
--- a/mlir/test/Target/LLVMIR/omptarget-declare-target-to-host.mlir
+++ b/mlir/test/Target/LLVMIR/omptarget-declare-target-to-host.mlir
@@ -5,7 +5,7 @@ module attributes {llvm.target_triple = "x86_64-unknown-linux-gnu", omp.is_gpu =
   // CHECK-DAG: @.offload_sizes = private unnamed_addr constant [2 x i64] [i64 48, i64 0]
   // CHECK-DAG: @.offload_maptypes = private unnamed_addr constant [2 x i64] [i64 3, i64 288]
   // CHECK-DAG: @.offloading.entry._QMtest_0Ezii = weak constant %struct.__tgt_offload_entry {{.*}} ptr @_QMtest_0Ezii, {{.*}}, i64 44,{{.*}}
-  llvm.mlir.global external @_QMtest_0Ezii() {addr_space = 0 : i32, omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (to)>} : !llvm.array<11 x f32> {
+  llvm.mlir.global external @_QMtest_0Ezii() {addr_space = 0 : i32, omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = to>} : !llvm.array<11 x f32> {
     %0 = llvm.mlir.zero : !llvm.array<11 x f32>
     llvm.return %0 : !llvm.array<11 x f32>
   }
diff --git a/mlir/test/Target/LLVMIR/omptarget-device-shared-mem.mlir b/mlir/test/Target/LLVMIR/omptarget-device-shared-mem.mlir
index 6fccc0127b347..3838ab7312cc6 100644
--- a/mlir/test/Target/LLVMIR/omptarget-device-shared-mem.mlir
+++ b/mlir/test/Target/LLVMIR/omptarget-device-shared-mem.mlir
@@ -3,7 +3,7 @@
 module attributes {dlti.dl_spec = #dlti.dl_spec<#dlti.dl_entry<"dlti.alloca_memory_space", 5 : ui32>>, llvm.data_layout = "e-p:64:64-p1:64:64-p2:32:32-p3:32:32-p4:64:64-p5:32:32-p6:32:32-p7:160:256:256:32-p8:128:128:128:48-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64-S32-A5-G1-ni:7:8:9", llvm.target_triple = "amdgcn-amd-amdhsa", omp.is_gpu = true, omp.is_target_device = true} {
   // CHECK-LABEL: define hidden void @device_shared_mem(
   // CHECK-SAME:  i32 %[[N0:.*]], i64 %[[N1:.*]])
-  llvm.func @device_shared_mem(%n0: i32, %n1: i64) attributes {omp.declare_target = #omp.declaretarget<device_type = (nohost), capture_clause = (to)>} {
+  llvm.func @device_shared_mem(%n0: i32, %n1: i64) attributes {omp.declare_target = #omp.declaretarget<device_type = nohost, capture_clause = to>} {
     // CHECK:      %[[CAST_N0:.*]] = zext i32 %[[N0]] to i64
     // CHECK-NEXT: %[[ALLOC0_SZ:.*]] = mul i64 8, %[[CAST_N0]]
     // CHECK-NEXT: %[[ALLOC0:.*]] = call align 8 ptr @__kmpc_alloc_shared(i64 %[[ALLOC0_SZ]])
diff --git a/mlir/test/Target/LLVMIR/omptarget-multi-reduction.mlir b/mlir/test/Target/LLVMIR/omptarget-multi-reduction.mlir
index 10b8d8479399e..4d6eecf5caa35 100644
--- a/mlir/test/Target/LLVMIR/omptarget-multi-reduction.mlir
+++ b/mlir/test/Target/LLVMIR/omptarget-multi-reduction.mlir
@@ -23,7 +23,7 @@ module attributes {dlti.dl_spec = #dlti.dl_spec<#dlti.dl_entry<"dlti.alloca_memo
     %0 = llvm.fadd %arg0, %arg1 {fastmathFlags = #llvm.fastmath<contract>} : f64
     omp.yield(%0 : f64)
   }
-  llvm.func @_QQmain() attributes {fir.bindc_name = "reduction", frame_pointer = #llvm.framePointerKind<all>, omp.declare_target = #omp.declaretarget<device_type = (host), capture_clause = (to)>, target_cpu = "gfx1030", target_features = #llvm.target_features<["+16-bit-insts", "+ci-insts", "+dl-insts", "+dot1-insts", "+dot10-insts", "+dot2-insts", "+dot5-insts", "+dot6-insts", "+dot7-insts", "+dpp", "+gfx10-3-insts", "+gfx10-insts", "+gfx8-insts", "+gfx9-insts", "+gws", "+image-insts", "+s-memrealtime", "+s-memtime-inst", "+vmem-to-lds-load-insts", "+wavefrontsize32"]>} {
+  llvm.func @_QQmain() attributes {fir.bindc_name = "reduction", frame_pointer = #llvm.framePointerKind<all>, omp.declare_target = #omp.declaretarget<device_type = host, capture_clause = to>, target_cpu = "gfx1030", target_features = #llvm.target_features<["+16-bit-insts", "+ci-insts", "+dl-insts", "+dot1-insts", "+dot10-insts", "+dot2-insts", "+dot5-insts", "+dot6-insts", "+dot7-insts", "+dpp", "+gfx10-3-insts", "+gfx10-insts", "+gfx8-insts", "+gfx9-insts", "+gws", "+image-insts", "+s-memrealtime", "+s-memtime-inst", "+vmem-to-lds-load-insts", "+wavefrontsize32"]>} {
     %0 = llvm.mlir.constant(1 : i64) : i64
     %1 = llvm.alloca %0 x i32 {bindc_name = "k"} : (i64) -> !llvm.ptr<5>
     %2 = llvm.addrspacecast %1 : !llvm.ptr<5> to !llvm.ptr
diff --git a/mlir/test/Target/LLVMIR/omptarget-parallel-llvm.mlir b/mlir/test/Target/LLVMIR/omptarget-parallel-llvm.mlir
index d05b2c4c06173..db220b222f6e1 100644
--- a/mlir/test/Target/LLVMIR/omptarget-parallel-llvm.mlir
+++ b/mlir/test/Target/LLVMIR/omptarget-parallel-llvm.mlir
@@ -4,7 +4,7 @@
 // for omp target parallel construct
 
 module attributes {dlti.dl_spec = #dlti.dl_spec<#dlti.dl_entry<"dlti.alloca_memory_space", 5 : ui32>>, llvm.data_layout = "e-p:64:64-p1:64:64-p2:32:32-p3:32:32-p4:64:64-p5:32:32-p6:32:32-p7:160:256:256:32-p8:128:128:128:48-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64-S32-A5-G1-ni:7:8:9", llvm.target_triple = "amdgcn-amd-amdhsa", omp.is_gpu = true, omp.is_target_device = true} {
-  llvm.func @_QQmain_omp_outline_1(%arg0: !llvm.ptr) attributes {omp.declare_target = #omp.declaretarget<device_type = (host), capture_clause = (to)>} {
+  llvm.func @_QQmain_omp_outline_1(%arg0: !llvm.ptr) attributes {omp.declare_target = #omp.declaretarget<device_type = host, capture_clause = to>} {
     %0 = omp.map.info var_ptr(%arg0 : !llvm.ptr, i32) map_clauses(from) capture(ByRef) name("d") -> !llvm.ptr
     omp.target kernel_type(generic) map_entries(%0 -> %arg2 : !llvm.ptr) {
       omp.parallel {
@@ -17,7 +17,7 @@ module attributes {dlti.dl_spec = #dlti.dl_spec<#dlti.dl_entry<"dlti.alloca_memo
   llvm.return
   }
 
-  llvm.func @_test_num_threads(%arg0: !llvm.ptr) attributes {omp.declare_target = #omp.declaretarget<device_type = (host), capture_clause = (to)>} {
+  llvm.func @_test_num_threads(%arg0: !llvm.ptr) attributes {omp.declare_target = #omp.declaretarget<device_type = host, capture_clause = to>} {
     %0 = omp.map.info var_ptr(%arg0 : !llvm.ptr, i32) map_clauses(from) capture(ByRef) name("d") -> !llvm.ptr
     omp.target kernel_type(generic) map_entries(%0 -> %arg2 : !llvm.ptr) {
       %1 = llvm.mlir.constant(156 : i32) : i32
diff --git a/mlir/test/Target/LLVMIR/omptarget-parallel-wsloop.mlir b/mlir/test/Target/LLVMIR/omptarget-parallel-wsloop.mlir
index 838223b337fd1..eca9117c096c8 100644
--- a/mlir/test/Target/LLVMIR/omptarget-parallel-wsloop.mlir
+++ b/mlir/test/Target/LLVMIR/omptarget-parallel-wsloop.mlir
@@ -4,7 +4,7 @@
 // for nested omp do loop inside omp target region
 
 module attributes {dlti.dl_spec = #dlti.dl_spec<#dlti.dl_entry<"dlti.alloca_memory_space", 5 : ui32>>, llvm.data_layout = "e-p:64:64-p1:64:64-p2:32:32-p3:32:32-p4:64:64-p5:32:32-p6:32:32-p7:160:256:256:32-p8:128:128:128:48-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64-S32-A5-G1-ni:7:8", llvm.target_triple = "amdgcn-amd-amdhsa", omp.is_gpu = true, omp.is_target_device = true } {
-  llvm.func @target_parallel_wsloop(%arg0: !llvm.ptr) attributes {omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (to)>,
+  llvm.func @target_parallel_wsloop(%arg0: !llvm.ptr) attributes {omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = to>,
     target_cpu = "gfx90a",
     target_features = #llvm.target_features<["+gfx9-insts", "+wavefrontsize64"]>}
    {
diff --git a/mlir/test/Target/LLVMIR/omptarget-private-llvm.mlir b/mlir/test/Target/LLVMIR/omptarget-private-llvm.mlir
index a27f23618abdd..891df1b650146 100644
--- a/mlir/test/Target/LLVMIR/omptarget-private-llvm.mlir
+++ b/mlir/test/Target/LLVMIR/omptarget-private-llvm.mlir
@@ -5,10 +5,10 @@
 
 module attributes {dlti.dl_spec = #dlti.dl_spec<#dlti.dl_entry<"dlti.alloca_memory_space", 5 : ui32>>, llvm.data_layout = "e-p:64:64-p1:64:64-p2:32:32-p3:32:32-p4:64:64-p5:32:32-p6:32:32-p7:160:256:256:32-p8:128:128:128:48-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64-S32-A5-G1-ni:7:8:9", llvm.target_triple = "amdgcn-amd-amdhsa", omp.is_gpu = true, omp.is_target_device = true} {
   omp.private {type = private} @_QMmodFfailingEi_private_i32 : i32
-  llvm.func @_QMotherProutine(%arg0: !llvm.ptr {fir.bindc_name = "i", llvm.nocapture}) attributes {frame_pointer = #llvm.framePointerKind<all>, omp.declare_target = #omp.declaretarget<device_type = (nohost), capture_clause = (to)>, target_cpu = "gfx90a", target_features = #llvm.target_features<["+16-bit-insts", "+atomic-buffer-global-pk-add-f16-insts", "+atomic-fadd-rtn-insts", "+ci-insts", "+dl-insts", "+dot1-insts", "+dot10-insts", "+dot2-insts", "+dot3-insts", "+dot4-insts", "+dot5-insts", "+dot6-insts", "+dot7-insts", "+dpp", "+gfx8-insts", "+gfx9-insts", "+gfx90a-insts", "+gws", "+image-insts", "+mai-insts", "+s-memrealtime", "+s-memtime-inst", "+wavefrontsize64"]>} {
+  llvm.func @_QMotherProutine(%arg0: !llvm.ptr {fir.bindc_name = "i", llvm.nocapture}) attributes {frame_pointer = #llvm.framePointerKind<all>, omp.declare_target = #omp.declaretarget<device_type = nohost, capture_clause = to>, target_cpu = "gfx90a", target_features = #llvm.target_features<["+16-bit-insts", "+atomic-buffer-global-pk-add-f16-insts", "+atomic-fadd-rtn-insts", "+ci-insts", "+dl-insts", "+dot1-insts", "+dot10-insts", "+dot2-insts", "+dot3-insts", "+dot4-insts", "+dot5-insts", "+dot6-insts", "+dot7-insts", "+dpp", "+gfx8-insts", "+gfx9-insts", "+gfx90a-insts", "+gws", "+image-insts", "+mai-insts", "+s-memrealtime", "+s-memtime-inst", "+wavefrontsize64"]>} {
     llvm.return
   }
-  llvm.func @_QMmodPfailing(%arg0: !llvm.ptr {fir.bindc_name = "d", llvm.nocapture}) attributes {frame_pointer = #llvm.framePointerKind<all>, omp.declare_target = #omp.declaretarget<device_type = (host), capture_clause = (to)>, target_cpu = "gfx90a", target_features = #llvm.target_features<["+16-bit-insts", "+atomic-buffer-global-pk-add-f16-insts", "+atomic-fadd-rtn-insts", "+ci-insts", "+dl-insts", "+dot1-insts", "+dot10-insts", "+dot2-insts", "+dot3-insts", "+dot4-insts", "+dot5-insts", "+dot6-insts", "+dot7-insts", "+dpp", "+gfx8-insts", "+gfx9-insts", "+gfx90a-insts", "+gws", "+image-insts", "+mai-insts", "+s-memrealtime", "+s-memtime-inst", "+wavefrontsize64"]>} {
+  llvm.func @_QMmodPfailing(%arg0: !llvm.ptr {fir.bindc_name = "d", llvm.nocapture}) attributes {frame_pointer = #llvm.framePointerKind<all>, omp.declare_target = #omp.declaretarget<device_type = host, capture_clause = to>, target_cpu = "gfx90a", target_features = #llvm.target_features<["+16-bit-insts", "+atomic-buffer-global-pk-add-f16-insts", "+atomic-fadd-rtn-insts", "+ci-insts", "+dl-insts", "+dot1-insts", "+dot10-insts", "+dot2-insts", "+dot3-insts", "+dot4-insts", "+dot5-insts", "+dot6-insts", "+dot7-insts", "+dpp", "+gfx8-insts", "+gfx9-insts", "+gfx90a-insts", "+gws", "+image-insts", "+mai-insts", "+s-memrealtime", "+s-memtime-inst", "+wavefrontsize64"]>} {
     %0 = llvm.mlir.constant(1 : i64) : i64
     %1 = llvm.alloca %0 x i32 {bindc_name = "i"} : (i64) -> !llvm.ptr<5>
     %2 = llvm.addrspacecast %1 : !llvm.ptr<5> to !llvm.ptr
diff --git a/mlir/test/Target/LLVMIR/omptarget-teams-distribute-reduction-array-descriptor.mlir b/mlir/test/Target/LLVMIR/omptarget-teams-distribute-reduction-array-descriptor.mlir
index 44e824e3a0dd1..696b522234f39 100644
--- a/mlir/test/Target/LLVMIR/omptarget-teams-distribute-reduction-array-descriptor.mlir
+++ b/mlir/test/Target/LLVMIR/omptarget-teams-distribute-reduction-array-descriptor.mlir
@@ -21,7 +21,7 @@ module attributes {dlti.dl_spec = #dlti.dl_spec<"dlti.alloca_memory_space" = 5 :
     omp.yield(%0 : !llvm.ptr)
   }
 
-  llvm.func @test_array_reduction_() attributes {omp.declare_target = #omp.declaretarget<device_type = (host), capture_clause = (to)>} {
+  llvm.func @test_array_reduction_() attributes {omp.declare_target = #omp.declaretarget<device_type = host, capture_clause = to>} {
     %0 = llvm.mlir.constant(1 : i64) : i64
     %1 = llvm.alloca %0 x !llvm.array<4 x i32> : (i64) -> !llvm.ptr<5>
     %2 = llvm.addrspacecast %1 : !llvm.ptr<5> to !llvm.ptr
@@ -91,7 +91,7 @@ module attributes {llvm.target_triple = "nvptx64-nvidia-cuda", omp.is_gpu = true
     omp.yield(%0 : !llvm.ptr)
   }
 
-  llvm.func @test_array_reduction_() attributes {omp.declare_target = #omp.declaretarget<device_type = (host), capture_clause = (to)>} {
+  llvm.func @test_array_reduction_() attributes {omp.declare_target = #omp.declaretarget<device_type = host, capture_clause = to>} {
     %0 = llvm.mlir.constant(1 : i64) : i64
     %1 = llvm.alloca %0 x !llvm.array<4 x i32> : (i64) -> !llvm.ptr<5>
     %2 = llvm.addrspacecast %1 : !llvm.ptr<5> to !llvm.ptr
diff --git a/mlir/test/Target/LLVMIR/omptarget-teams-distribute-reduction.mlir b/mlir/test/Target/LLVMIR/omptarget-teams-distribute-reduction.mlir
index 31bfbeaedecba..e59cba663a69d 100644
--- a/mlir/test/Target/LLVMIR/omptarget-teams-distribute-reduction.mlir
+++ b/mlir/test/Target/LLVMIR/omptarget-teams-distribute-reduction.mlir
@@ -14,7 +14,7 @@ module attributes {dlti.dl_spec = #dlti.dl_spec<#dlti.dl_entry<"dlti.alloca_memo
     %0 = llvm.add %arg0, %arg1 : i32
     omp.yield(%0 : i32)
   }
-  llvm.func @simple_target_teams_only_reduction_() attributes {fir.internal_name = "_QPsimple_target_teams_only_reduction", frame_pointer = #llvm.framePointerKind<all>, omp.declare_target = #omp.declaretarget<device_type = (host), capture_clause = (to)>, target_cpu = "gfx1030", target_features = #llvm.target_features<["+16-bit-insts", "+ci-insts", "+dl-insts", "+dot1-insts", "+dot10-insts", "+dot2-insts", "+dot5-insts", "+dot6-insts", "+dot7-insts", "+dpp", "+gfx10-3-insts", "+gfx10-insts", "+gfx8-insts", "+gfx9-insts", "+gws", "+image-insts", "+s-memrealtime", "+s-memtime-inst", "+wavefrontsize32"]>} {
+  llvm.func @simple_target_teams_only_reduction_() attributes {fir.internal_name = "_QPsimple_target_teams_only_reduction", frame_pointer = #llvm.framePointerKind<all>, omp.declare_target = #omp.declaretarget<device_type = host, capture_clause = to>, target_cpu = "gfx1030", target_features = #llvm.target_features<["+16-bit-insts", "+ci-insts", "+dl-insts", "+dot1-insts", "+dot10-insts", "+dot2-insts", "+dot5-insts", "+dot6-insts", "+dot7-insts", "+dpp", "+gfx10-3-insts", "+gfx10-insts", "+gfx8-insts", "+gfx9-insts", "+gws", "+image-insts", "+s-memrealtime", "+s-memtime-inst", "+wavefrontsize32"]>} {
     %0 = llvm.mlir.constant(1 : i64) : i64
     %1 = llvm.alloca %0 x i32 {bindc_name = "sum"} : (i64) -> !llvm.ptr<5>
     %2 = llvm.addrspacecast %1 : !llvm.ptr<5> to !llvm.ptr
diff --git a/mlir/test/Target/LLVMIR/omptarget-teams-llvm.mlir b/mlir/test/Target/LLVMIR/omptarget-teams-llvm.mlir
index c5f89eb2c3274..c3db2e9c31658 100644
--- a/mlir/test/Target/LLVMIR/omptarget-teams-llvm.mlir
+++ b/mlir/test/Target/LLVMIR/omptarget-teams-llvm.mlir
@@ -5,7 +5,7 @@
 
 module attributes {omp.is_target_device = true} {
   llvm.func @foo(i32)
-  llvm.func @omp_target_teams_shared_simple(%arg0 : i32)  attributes {omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (to)>} {
+  llvm.func @omp_target_teams_shared_simple(%arg0 : i32)  attributes {omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = to>} {
     omp.teams {
       llvm.call @foo(%arg0) : (i32) -> ()
       omp.terminator
diff --git a/mlir/test/Target/LLVMIR/omptarget-teams-reduction.mlir b/mlir/test/Target/LLVMIR/omptarget-teams-reduction.mlir
index 635015acf3813..ef82f5c8b53f7 100644
--- a/mlir/test/Target/LLVMIR/omptarget-teams-reduction.mlir
+++ b/mlir/test/Target/LLVMIR/omptarget-teams-reduction.mlir
@@ -13,7 +13,7 @@ module attributes {dlti.dl_spec = #dlti.dl_spec<#dlti.dl_entry<"dlti.alloca_memo
     %0 = llvm.add %arg0, %arg1 : i32
     omp.yield(%0 : i32)
   }
-  llvm.func @simple_target_teams_only_reduction_() attributes {fir.internal_name = "_QPsimple_target_teams_only_reduction", frame_pointer = #llvm.framePointerKind<all>, omp.declare_target = #omp.declaretarget<device_type = (host), capture_clause = (to)>, target_cpu = "gfx1030", target_features = #llvm.target_features<["+16-bit-insts", "+ci-insts", "+dl-insts", "+dot1-insts", "+dot10-insts", "+dot2-insts", "+dot5-insts", "+dot6-insts", "+dot7-insts", "+dpp", "+gfx10-3-insts", "+gfx10-insts", "+gfx8-insts", "+gfx9-insts", "+gws", "+image-insts", "+s-memrealtime", "+s-memtime-inst", "+wavefrontsize32"]>} {
+  llvm.func @simple_target_teams_only_reduction_() attributes {fir.internal_name = "_QPsimple_target_teams_only_reduction", frame_pointer = #llvm.framePointerKind<all>, omp.declare_target = #omp.declaretarget<device_type = host, capture_clause = to>, target_cpu = "gfx1030", target_features = #llvm.target_features<["+16-bit-insts", "+ci-insts", "+dl-insts", "+dot1-insts", "+dot10-insts", "+dot2-insts", "+dot5-insts", "+dot6-insts", "+dot7-insts", "+dpp", "+gfx10-3-insts", "+gfx10-insts", "+gfx8-insts", "+gfx9-insts", "+gws", "+image-insts", "+s-memrealtime", "+s-memtime-inst", "+wavefrontsize32"]>} {
     %0 = llvm.mlir.constant(1 : i64) : i64
     %1 = llvm.alloca %0 x i32 {bindc_name = "sum"} : (i64) -> !llvm.ptr<5>
     %2 = llvm.addrspacecast %1 : !llvm.ptr<5> to !llvm.ptr
diff --git a/mlir/test/Target/LLVMIR/omptarget-wsloop-collapsed.mlir b/mlir/test/Target/LLVMIR/omptarget-wsloop-collapsed.mlir
index 4cc0211e076f2..edcd304d6ea29 100644
--- a/mlir/test/Target/LLVMIR/omptarget-wsloop-collapsed.mlir
+++ b/mlir/test/Target/LLVMIR/omptarget-wsloop-collapsed.mlir
@@ -4,7 +4,7 @@
 // for nested omp do loop with collapse clause inside omp target region
 
 module attributes {dlti.dl_spec = #dlti.dl_spec<#dlti.dl_entry<"dlti.alloca_memory_space", 5 : ui32>>, llvm.data_layout = "e-p:64:64-p1:64:64-p2:32:32-p3:32:32-p4:64:64-p5:32:32-p6:32:32-p7:160:256:256:32-p8:128:128:128:48-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64-S32-A5-G1-ni:7:8", llvm.target_triple = "amdgcn-amd-amdhsa", omp.is_gpu = true, omp.is_target_device = true } {
-  llvm.func @target_collapsed_wsloop(%arg0: !llvm.ptr) attributes {omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (to)>} {
+  llvm.func @target_collapsed_wsloop(%arg0: !llvm.ptr) attributes {omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = to>} {
     %loop_ub = llvm.mlir.constant(99 : i32) : i32
     %loop_lb = llvm.mlir.constant(0 : i32) : i32
     %loop_step = llvm.mlir.constant(1 : i32) : i32
diff --git a/mlir/test/Target/LLVMIR/omptarget-wsloop.mlir b/mlir/test/Target/LLVMIR/omptarget-wsloop.mlir
index 04458af9654c3..acbb3ec916113 100644
--- a/mlir/test/Target/LLVMIR/omptarget-wsloop.mlir
+++ b/mlir/test/Target/LLVMIR/omptarget-wsloop.mlir
@@ -4,7 +4,7 @@
 // for nested omp do loop inside omp target region
 
 module attributes {dlti.dl_spec = #dlti.dl_spec<#dlti.dl_entry<"dlti.alloca_memory_space", 5 : ui32>>, llvm.data_layout = "e-p:64:64-p1:64:64-p2:32:32-p3:32:32-p4:64:64-p5:32:32-p6:32:32-p7:160:256:256:32-p8:128:128:128:48-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64-S32-A5-G1-ni:7:8", llvm.target_triple = "amdgcn-amd-amdhsa", omp.is_gpu = true, omp.is_target_device = true } {
-  llvm.func @target_wsloop(%arg0: !llvm.ptr ) attributes {omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (to)>} {
+  llvm.func @target_wsloop(%arg0: !llvm.ptr ) attributes {omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = to>} {
       %loop_ub = llvm.mlir.constant(9 : i32) : i32
       %loop_lb = llvm.mlir.constant(0 : i32) : i32
       %loop_step = llvm.mlir.constant(1 : i32) : i32
@@ -18,7 +18,7 @@ module attributes {dlti.dl_spec = #dlti.dl_spec<#dlti.dl_entry<"dlti.alloca_memo
     llvm.return
   }
 
-  llvm.func @target_empty_wsloop() attributes {omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (to)>} {
+  llvm.func @target_empty_wsloop() attributes {omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = to>} {
       %loop_ub = llvm.mlir.constant(9 : i32) : i32
       %loop_lb = llvm.mlir.constant(0 : i32) : i32
       %loop_step = llvm.mlir.constant(1 : i32) : i32
diff --git a/mlir/test/Target/LLVMIR/openmp-data-target-device.mlir b/mlir/test/Target/LLVMIR/openmp-data-target-device.mlir
index 506669aea22db..3dd960784790c 100644
--- a/mlir/test/Target/LLVMIR/openmp-data-target-device.mlir
+++ b/mlir/test/Target/LLVMIR/openmp-data-target-device.mlir
@@ -5,7 +5,7 @@
 // CHECK: {{.*}} = add i32 {{.*}}, 1
 module attributes {omp.target_triples = ["amdgcn-amd-amdhsa"]} {
   llvm.mlir.global weak_odr hidden local_unnamed_addr constant @__oclc_ABI_version(400 : i32) {addr_space = 4 : i32} : i32
-  llvm.func @_QQmain() attributes {fir.bindc_name = "main", omp.declare_target = #omp.declaretarget<device_type = (host), capture_clause = (to)>} {
+  llvm.func @_QQmain() attributes {fir.bindc_name = "main", omp.declare_target = #omp.declaretarget<device_type = host, capture_clause = to>} {
     %0 = llvm.mlir.constant(99 : i64) : i64
     %1 = llvm.mlir.constant(0 : i64) : i64
     %2 = llvm.mlir.constant(1 : i64) : i64
diff --git a/mlir/test/Target/LLVMIR/openmp-llvm-invalid.mlir b/mlir/test/Target/LLVMIR/openmp-llvm-invalid.mlir
index 5942e6da08582..f2a45c7ed7e32 100644
--- a/mlir/test/Target/LLVMIR/openmp-llvm-invalid.mlir
+++ b/mlir/test/Target/LLVMIR/openmp-llvm-invalid.mlir
@@ -191,7 +191,7 @@ module attributes {llvm.target_triple = "amdgcn-amd-amdhsa", omp.is_target_devic
 // -----
 
 module attributes {llvm.target_triple = "amdgcn-amd-amdhsa", omp.is_target_device = true} {
-  llvm.func @target_data_in_device(%arg0 : !llvm.ptr) attributes {omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (enter)>} {
+  llvm.func @target_data_in_device(%arg0 : !llvm.ptr) attributes {omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = enter>} {
     %0 = omp.map.info var_ptr(%arg0 : !llvm.ptr, !llvm.array<1024 x i32>) map_clauses(tofrom) capture(ByRef) name("") -> !llvm.ptr
     // expected-error @below {{op not allowed in a target device}}
     // expected-error @below {{LLVM Translation failed for operation: omp.target_data}}
@@ -205,7 +205,7 @@ module attributes {llvm.target_triple = "amdgcn-amd-amdhsa", omp.is_target_devic
 // -----
 
 module attributes {llvm.target_triple = "amdgcn-amd-amdhsa", omp.is_target_device = true} {
-  llvm.func @target_update_in_device(%arg0 : !llvm.ptr) attributes {omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (enter)>} {
+  llvm.func @target_update_in_device(%arg0 : !llvm.ptr) attributes {omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = enter>} {
     %0 = omp.map.info var_ptr(%arg0 : !llvm.ptr, !llvm.array<1024 x i32>) map_clauses(to) capture(ByRef) name("") -> !llvm.ptr
     // expected-error @below {{op not allowed in a target device}}
     // expected-error @below {{LLVM Translation failed for operation: omp.target_update}}
@@ -217,7 +217,7 @@ module attributes {llvm.target_triple = "amdgcn-amd-amdhsa", omp.is_target_devic
 // -----
 
 module attributes {llvm.target_triple = "amdgcn-amd-amdhsa", omp.is_target_device = true} {
-  llvm.func @target_enter_data_in_device(%arg0 : !llvm.ptr) attributes {omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (enter)>} {
+  llvm.func @target_enter_data_in_device(%arg0 : !llvm.ptr) attributes {omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = enter>} {
     %0 = omp.map.info var_ptr(%arg0 : !llvm.ptr, !llvm.array<1024 x i32>) map_clauses(to) capture(ByRef) name("") -> !llvm.ptr
     // expected-error @below {{op not allowed in a target device}}
     // expected-error @below {{LLVM Translation failed for operation: omp.target_enter_data}}
@@ -229,7 +229,7 @@ module attributes {llvm.target_triple = "amdgcn-amd-amdhsa", omp.is_target_devic
 // -----
 
 module attributes {llvm.target_triple = "amdgcn-amd-amdhsa", omp.is_target_device = true} {
-  llvm.func @target_exit_data_in_device(%arg0 : !llvm.ptr) attributes {omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (enter)>} {
+  llvm.func @target_exit_data_in_device(%arg0 : !llvm.ptr) attributes {omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = enter>} {
     %0 = omp.map.info var_ptr(%arg0 : !llvm.ptr, !llvm.array<1024 x i32>) map_clauses(from) capture(ByRef) name("") -> !llvm.ptr
     // expected-error @below {{op not allowed in a target device}}
     // expected-error @below {{LLVM Translation failed for operation: omp.target_exit_data}}
diff --git a/mlir/test/Target/LLVMIR/openmp-llvm.mlir b/mlir/test/Target/LLVMIR/openmp-llvm.mlir
index 7be951a8f49c9..794c2ff577c9b 100644
--- a/mlir/test/Target/LLVMIR/openmp-llvm.mlir
+++ b/mlir/test/Target/LLVMIR/openmp-llvm.mlir
@@ -3898,7 +3898,7 @@ module attributes {omp.is_target_device = false} {
   llvm.func @filter_nohost() -> ()
       attributes {
         omp.declare_target =
-          #omp.declaretarget<device_type = (nohost), capture_clause = (to)>
+          #omp.declaretarget<device_type = nohost, capture_clause = to>
       } {
     llvm.return
   }
@@ -3907,7 +3907,7 @@ module attributes {omp.is_target_device = false} {
   llvm.func @filter_host() -> ()
       attributes {
         omp.declare_target =
-          #omp.declaretarget<device_type = (host), capture_clause = (to)>
+          #omp.declaretarget<device_type = host, capture_clause = to>
       } {
     llvm.return
   }
@@ -3920,7 +3920,7 @@ module attributes {omp.is_target_device = false} {
   llvm.func @filter_nohost() -> ()
       attributes {
         omp.declare_target =
-          #omp.declaretarget<device_type = (nohost), capture_clause = (enter)>
+          #omp.declaretarget<device_type = nohost, capture_clause = enter>
       } {
     llvm.return
   }
@@ -3929,7 +3929,7 @@ module attributes {omp.is_target_device = false} {
   llvm.func @filter_host() -> ()
       attributes {
         omp.declare_target =
-          #omp.declaretarget<device_type = (host), capture_clause = (enter)>
+          #omp.declaretarget<device_type = host, capture_clause = enter>
       } {
     llvm.return
   }
@@ -3942,7 +3942,7 @@ module attributes {omp.is_target_device = true} {
   llvm.func @filter_nohost() -> ()
       attributes {
         omp.declare_target =
-          #omp.declaretarget<device_type = (nohost), capture_clause = (to)>
+          #omp.declaretarget<device_type = nohost, capture_clause = to>
       } {
     llvm.return
   }
@@ -3951,7 +3951,7 @@ module attributes {omp.is_target_device = true} {
   llvm.func @filter_host() -> ()
       attributes {
         omp.declare_target =
-          #omp.declaretarget<device_type = (host), capture_clause = (to)>
+          #omp.declaretarget<device_type = host, capture_clause = to>
       } {
     llvm.return
   }
@@ -3964,7 +3964,7 @@ module attributes {omp.is_target_device = true} {
   llvm.func @filter_nohost() -> ()
       attributes {
         omp.declare_target =
-          #omp.declaretarget<device_type = (nohost), capture_clause = (enter)>
+          #omp.declaretarget<device_type = nohost, capture_clause = enter>
       } {
     llvm.return
   }
@@ -3973,7 +3973,7 @@ module attributes {omp.is_target_device = true} {
   llvm.func @filter_host() -> ()
       attributes {
         omp.declare_target =
-          #omp.declaretarget<device_type = (host), capture_clause = (enter)>
+          #omp.declaretarget<device_type = host, capture_clause = enter>
       } {
     llvm.return
   }
@@ -4251,7 +4251,7 @@ llvm.mlir.global internal @any() : i32
 llvm.mlir.global internal @host() : i32
 llvm.mlir.global internal @nohost() : i32
 llvm.func @omp_groupprivate_device() attributes {
-    omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (to)>} {
+    omp.declare_target = #omp.declaretarget<device_type = any, capture_clause = to>} {
   %0 = llvm.mlir.constant(1 : i32) : i32
   %2 = omp.groupprivate @any device_type(any) : !llvm.ptr
   llvm.store %0, %2 : i32, !llvm.ptr
diff --git a/mlir/test/Target/LLVMIR/openmp-target-private-shared-mem.mlir b/mlir/test/Target/LLVMIR/openmp-target-private-shared-mem.mlir
index 4df2a504779bc..775ae98ae0b51 100644
--- a/mlir/test/Target/LLVMIR/openmp-target-private-shared-mem.mlir
+++ b/mlir/test/Target/LLVMIR/openmp-target-private-shared-mem.mlir
@@ -13,10 +13,10 @@ module attributes {omp.is_target_device = true, llvm.target_triple = "amdgcn-amd
   }
 
   // CHECK-LABEL: declare void @device_func(ptr)
-  llvm.func @device_func(!llvm.ptr) attributes {omp.declare_target = #omp.declaretarget<device_type = (nohost), capture_clause = (to)>}
+  llvm.func @device_func(!llvm.ptr) attributes {omp.declare_target = #omp.declaretarget<device_type = nohost, capture_clause = to>}
   
   // CHECK-NOT: define {{.*}} void @target_map_single_shared_mem_private
-  llvm.func @target_map_single_shared_mem_private() attributes {omp.declare_target = #omp.declaretarget<device_type = (host), capture_clause = (to)>} {
+  llvm.func @target_map_single_shared_mem_private() attributes {omp.declare_target = #omp.declaretarget<device_type = host, capture_clause = to>} {
     %0 = llvm.mlir.constant(1 : i64) : i64
     %1 = llvm.alloca %0 x i32 : (i64) -> !llvm.ptr<5>
     %2 = llvm.addrspacecast %1 : !llvm.ptr<5> to !llvm.ptr
diff --git a/mlir/test/lib/Dialect/Test/TestAttrDefs.td b/mlir/test/lib/Dialect/Test/TestAttrDefs.td
index 415b27aeda905..e153eeeed74dd 100644
--- a/mlir/test/lib/Dialect/Test/TestAttrDefs.td
+++ b/mlir/test/lib/Dialect/Test/TestAttrDefs.td
@@ -366,6 +366,34 @@ def TestSimpleEnumAttr : EnumAttr<Test_Dialect, TestSimpleEnum, "simple_enum"> {
 def TestArrayOfEnums : ArrayOfAttr<Test_Dialect, "ArrayOfEnums",
     "array_of_enums", "SimpleEnumAttr">;
 
+def TestStructEnumAttr
+    : EnumAttr<Test_Dialect, TestStructEnum, "struct_enum_value"> {
+  let assemblyFormat = "`<` $value `>`";
+}
+
+def TestAttrEnumAttrStruct : Test_Attr<"TestAttrEnumAttrStruct"> {
+  let parameters = (ins
+    EnumAttrParameter<TestStructEnumAttr>:$required,
+    OptionalEnumAttrParameter<TestStructEnumAttr>:$optional
+  );
+  let mnemonic = "enum_attr_struct";
+  let assemblyFormat = "`<` struct(params) `>`";
+}
+
+def TestStructBitEnumAttr
+    : EnumAttr<Test_Dialect, TestStructBitEnum, "struct_bit_enum_value"> {
+  let assemblyFormat = "`<` $value `>`";
+}
+
+def TestAttrBitEnumAttrStruct : Test_Attr<"TestAttrBitEnumAttrStruct"> {
+  let parameters = (ins
+    EnumAttrParameter<TestStructBitEnumAttr>:$flags,
+    "int64_t":$count
+  );
+  let mnemonic = "bit_enum_attr_struct";
+  let assemblyFormat = "`<` struct(params) `>`";
+}
+
 // Test custom directive as optional group anchor.
 def TestCustomAnchor : Test_Attr<"TestCustomAnchor"> {
   let parameters = (ins "int":$a, OptionalParameter<"std::optional<int>">:$b);
diff --git a/mlir/test/lib/Dialect/Test/TestEnumDefs.td b/mlir/test/lib/Dialect/Test/TestEnumDefs.td
index 98b8823f73ef5..c98be29a04896 100644
--- a/mlir/test/lib/Dialect/Test/TestEnumDefs.td
+++ b/mlir/test/lib/Dialect/Test/TestEnumDefs.td
@@ -47,6 +47,16 @@ def TestEnum
   let cppNamespace = "test";
 }
 
+def TestStructEnum
+    : I32EnumAttr<"TestStructEnum", "an enum nested in a struct parameter", [
+        I32EnumAttrCase<"First", 0, "first">,
+        I32EnumAttrCase<"Second", 1, "second">,
+        I32EnumAttrCase<"Third", 2, "third">,
+      ]> {
+  let genSpecializedAttr = 0;
+  let cppNamespace = "test";
+}
+
 def TestOtherEnum
     : I32Enum<"TestOtherEnum", "another test enum", [
         I32EnumCase<"Dog", 0, "dog">,
@@ -125,6 +135,16 @@ def TestBitEnumVerticalBar
   let separator = " | ";
 }
 
+def TestStructBitEnum
+    : I32BitEnum<"TestStructBitEnum", "a bit enum nested in a struct", [
+        TestBitEnumNone,
+        I32BitEnumCaseBit<"Read", 0, "read">,
+        I32BitEnumCaseBit<"Write", 1, "write">,
+      ]> {
+  let cppNamespace = "test";
+  let separator = ", ";
+}
+
 //===----------------------------------------------------------------------===//
 // Test Patterns (Multi-result Ops)
 //===----------------------------------------------------------------------===//
diff --git a/mlir/test/mlir-tblgen/attr-or-type-format-roundtrip.mlir b/mlir/test/mlir-tblgen/attr-or-type-format-roundtrip.mlir
index e7545afa7e4ad..62abd3a9f68fe 100644
--- a/mlir/test/mlir-tblgen/attr-or-type-format-roundtrip.mlir
+++ b/mlir/test/mlir-tblgen/attr-or-type-format-roundtrip.mlir
@@ -48,6 +48,19 @@ attributes {
   // Single-element array in non-last position is still wrapped.
   // CHECK: #test.arr_struct<elements = [7], count = 1>
   attr_arr_struct_single = #test.arr_struct<count = 1, elements = [7]>,
+  // A non-final comma-separated bit enum is bracketed to disambiguate its
+  // separator from the struct's comma separator.
+  // CHECK: #test.bit_enum_attr_struct<flags = [read, write], count = 2>
+  attr_bit_enum_attr_struct =
+      #test.bit_enum_attr_struct<count = 2, flags = [read, write]>,
+  // EnumAttr parameters use their underlying enum syntax inside a struct,
+  // independent of the EnumAttr's `<value>` assembly format.
+  // CHECK: #test.enum_attr_struct<required = first, optional = second>
+  attr_enum_attr_struct =
+      #test.enum_attr_struct<optional = second, required = first>,
+  // CHECK: #test.enum_attr_struct<required = third>
+  attr_enum_attr_struct_optional =
+      #test.enum_attr_struct<required = third>,
   // OptionalArrayRefParameter in non-last struct position (present).
   // CHECK: #test.opt_arr_struct<elements = [4, 5], count = 9>
   attr_opt_arr_struct = #test.opt_arr_struct<count = 9, elements = [4, 5]>,
diff --git a/mlir/test/mlir-tblgen/attr-or-type-format.td b/mlir/test/mlir-tblgen/attr-or-type-format.td
index 3a464592d038c..279b174768d87 100644
--- a/mlir/test/mlir-tblgen/attr-or-type-format.td
+++ b/mlir/test/mlir-tblgen/attr-or-type-format.td
@@ -229,6 +229,66 @@ def EnumAttrB : EnumAttr<Test_Dialect, TestEnumB, "EnumAttrB"> {
   let assemblyFormat = "$value";
 }
 
+def TestStructEnum : I32EnumAttr<"TestStructEnum", "TestStructEnumType", [
+  I32EnumAttrCase<"first", 0>,
+  I32EnumAttrCase<"second", 1>,
+]> {
+  let genSpecializedAttr = 0;
+}
+
+def EnumAttrC : EnumAttr<Test_Dialect, TestStructEnum, "EnumAttrC"> {
+  let assemblyFormat = "`<` $value `>`";
+}
+
+// EnumAttr parameters in a struct use the underlying enum syntax rather than
+// the EnumAttr's assembly format.
+// ATTR-LABEL: AttrWithEnumAttrStructAttr::parse
+// ATTR: _result_required = [&]() -> ::mlir::FailureOr<::TestStructEnumAttr> {
+// ATTR-NEXT: auto odsEnumValue = ::mlir::FieldParser<::TestStructEnum>::parse(odsParser);
+// ATTR: return ::TestStructEnumAttr::get(odsParser.getContext(), *odsEnumValue);
+// ATTR-LABEL: AttrWithEnumAttrStructAttr::print
+// ATTR: odsPrinter << getRequired().getValue();
+// ATTR: odsPrinter << getOptional().getValue();
+def AttrWithEnumAttrStruct : TestAttr<"AttrWithEnumAttrStruct"> {
+  let parameters = (ins
+    EnumAttrParameter<EnumAttrC>:$required,
+    OptionalEnumAttrParameter<EnumAttrC>:$optional
+  );
+  let mnemonic = "enum_attr_struct";
+  let assemblyFormat = "`<` struct(params) `>`";
+}
+
+def TestStructBitEnum : I32BitEnum<"TestStructBitEnum", "", [
+  I32BitEnumCaseNone<"none">,
+  I32BitEnumCaseBit<"read", 0>,
+  I32BitEnumCaseBit<"write", 1>,
+]> {
+  let separator = ", ";
+}
+
+def EnumAttrD : EnumAttr<Test_Dialect, TestStructBitEnum, "EnumAttrD"> {
+  let assemblyFormat = "`<` $value `>`";
+}
+
+// A non-final comma-separated bit enum is bracketed so its commas are not
+// confused with the struct separator.
+// ATTR-LABEL: AttrWithBitEnumAttrStructAttr::parse
+// ATTR: if (odsParser.parseLSquare()) return {};
+// ATTR: FieldParser<::TestStructBitEnum>::parse(odsParser)
+// ATTR: if (odsParser.parseRSquare()) return {};
+// ATTR-LABEL: AttrWithBitEnumAttrStructAttr::print
+// ATTR: odsPrinter << "[";
+// ATTR: odsPrinter << getFlags().getValue();
+// ATTR: odsPrinter << "]";
+def AttrWithBitEnumAttrStruct : TestAttr<"AttrWithBitEnumAttrStruct"> {
+  let parameters = (ins
+    EnumAttrParameter<EnumAttrD>:$flags,
+    "int64_t":$count
+  );
+  let mnemonic = "bit_enum_attr_struct";
+  let assemblyFormat = "`<` struct(params) `>`";
+}
+
 /// Test type parser and printer that mix variables and struct are generated
 /// correctly.
 
diff --git a/mlir/tools/mlir-tblgen/AttrOrTypeFormatGen.cpp b/mlir/tools/mlir-tblgen/AttrOrTypeFormatGen.cpp
index d8778c6f59d28..eed05558447de 100644
--- a/mlir/tools/mlir-tblgen/AttrOrTypeFormatGen.cpp
+++ b/mlir/tools/mlir-tblgen/AttrOrTypeFormatGen.cpp
@@ -10,6 +10,7 @@
 #include "FormatGen.h"
 #include "mlir/Support/LLVM.h"
 #include "mlir/TableGen/AttrOrTypeDef.h"
+#include "mlir/TableGen/EnumInfo.h"
 #include "mlir/TableGen/Format.h"
 #include "mlir/TableGen/GenInfo.h"
 #include "llvm/ADT/BitVector.h"
@@ -109,6 +110,31 @@ static bool isUndelimitedArrayRefParam(const ParameterElement *el) {
          defInit->getDef()->isSubClassOf("OptionalArrayRefParameter");
 }
 
+/// If the parameter wraps an EnumAttr, return its definition.
+static const llvm::Record *getEnumAttrDef(const ParameterElement *el) {
+  const auto *defInit = dyn_cast<llvm::DefInit>(el->getParam().getDef());
+  if (!defInit || !defInit->getDef()->isSubClassOf("EnumAttrParameter"))
+    return nullptr;
+  return defInit->getDef()->getValueAsDef("attr");
+}
+
+/// Returns true if the parameter wraps an unquoted, comma-separated bit enum.
+/// Its underlying parser may consume the comma that separates struct entries.
+static bool isUndelimitedCommaBitEnumParam(const ParameterElement *el) {
+  const llvm::Record *enumAttr = getEnumAttrDef(el);
+  if (!enumAttr)
+    return false;
+  EnumInfo enumInfo(enumAttr->getValueAsDef("enum"));
+  return enumInfo.isBitEnum() && !enumInfo.printBitEnumQuoted() &&
+         enumInfo.getDef().getValueAsString("separator").trim() == ",";
+}
+
+/// Returns true if a non-final struct parameter needs brackets to separate its
+/// value from the following key-value pair.
+static bool needsStructBrackets(const ParameterElement *el) {
+  return isUndelimitedArrayRefParam(el) || isUndelimitedCommaBitEnumParam(el);
+}
+
 /// Shorthand functions that can be used with ranged-based conditions.
 static bool paramIsOptional(ParameterElement *el) { return el->isOptional(); }
 static bool formatIsOptional(FormatElement *el) {
@@ -220,7 +246,12 @@ class DefFormat {
   void genLiteralParser(StringRef value, FmtContext &ctx, MethodBody &os,
                         bool isOptional = false);
   /// Generate the parser code for a variable.
-  void genVariableParser(ParameterElement *el, FmtContext &ctx, MethodBody &os);
+  void
+  genVariableParser(ParameterElement *el, FmtContext &ctx, MethodBody &os,
+                    std::optional<StringRef> parserOverride = std::nullopt);
+  /// Generate a stripped parser for an EnumAttr parameter in a `struct`.
+  void genStructParameterParser(ParameterElement *el, FmtContext &ctx,
+                                MethodBody &os);
   /// Generate the parser code for a `params` directive.
   void genParamsParser(ParamsDirective *el, FmtContext &ctx, MethodBody &os);
   /// Generate the parser code for a `struct` directive.
@@ -237,12 +268,18 @@ class DefFormat {
   /// Generate the printer code for a literal.
   void genLiteralPrinter(StringRef value, FmtContext &ctx, MethodBody &os);
   /// Generate the printer code for a variable.
-  void genVariablePrinter(ParameterElement *el, FmtContext &ctx, MethodBody &os,
-                          bool skipGuard = false);
+  void
+  genVariablePrinter(ParameterElement *el, FmtContext &ctx, MethodBody &os,
+                     bool skipGuard = false,
+                     std::optional<StringRef> printerOverride = std::nullopt,
+                     std::optional<StringRef> selfOverride = std::nullopt);
+  /// Generate a stripped printer for an EnumAttr parameter in a `struct`.
+  void genStructParameterPrinter(ParameterElement *el, FmtContext &ctx,
+                                 MethodBody &os);
   /// Generate a printer for comma-separated format elements.
   void genCommaSeparatedPrinter(
       ArrayRef<FormatElement *> params, FmtContext &ctx, MethodBody &os,
-      function_ref<void(FormatElement *)> extra,
+      function_ref<void(FormatElement *)> extra, bool stripEnumAttrs = false,
       function_ref<void(FormatElement *)> extraPost = nullptr);
   /// Generate the printer code for a `params` directive.
   void genParamsPrinter(ParamsDirective *el, FmtContext &ctx, MethodBody &os);
@@ -432,10 +469,11 @@ void DefFormat::genLiteralParser(StringRef value, FmtContext &ctx,
 }
 
 void DefFormat::genVariableParser(ParameterElement *el, FmtContext &ctx,
-                                  MethodBody &os) {
+                                  MethodBody &os,
+                                  std::optional<StringRef> parserOverride) {
   // Check for a custom parser. Use the default attribute parser otherwise.
   const AttrOrTypeParameter &param = el->getParam();
-  auto customParser = param.getParser();
+  auto customParser = parserOverride ? parserOverride : param.getParser();
   auto parser =
       customParser ? *customParser : StringRef(defaultParameterParser);
 
@@ -464,6 +502,29 @@ void DefFormat::genVariableParser(ParameterElement *el, FmtContext &ctx,
                 dialectLoading);
 }
 
+void DefFormat::genStructParameterParser(ParameterElement *el, FmtContext &ctx,
+                                         MethodBody &os) {
+  const llvm::Record *enumAttr = getEnumAttrDef(el);
+  if (!enumAttr)
+    return genVariableParser(el, ctx, os);
+
+  const AttrOrTypeParameter &param = el->getParam();
+  EnumInfo enumInfo(enumAttr->getValueAsDef("enum"));
+  std::string enumType =
+      (enumInfo.getCppNamespace() + "::" + enumInfo.getEnumClassName()).str();
+
+  std::string parser;
+  llvm::raw_string_ostream parserOS(parser);
+  parserOS << "[&]() -> ::mlir::FailureOr<" << param.getCppStorageType()
+           << "> {\n  auto odsEnumValue = "
+           << tgfmt(defaultParameterParser, &ctx, enumType)
+           << ";\n  if (::mlir::failed(odsEnumValue))\n"
+              "    return ::mlir::failure();\n  return "
+           << param.getCppStorageType() << "::get(" << tgfmt("$_ctxt", &ctx)
+           << ", *odsEnumValue);\n}()";
+  genVariableParser(el, ctx, os, parserOS.str());
+}
+
 void DefFormat::genParamsParser(ParamsDirective *el, FmtContext &ctx,
                                 MethodBody &os) {
   os << "// Parse parameter list\n";
@@ -603,14 +664,14 @@ void DefFormat::genStructParser(StructDirective *el, FmtContext &ctx,
     // An `ArrayRefParameter` without a custom parser in a non-last position
     // uses `[...]` delimiters to avoid ambiguity with the struct-level comma.
     bool useBrackets = isa<ParameterElement>(arg) &&
-                       isUndelimitedArrayRefParam(param) &&
+                       needsStructBrackets(param) &&
                        idx != structElems.size() - 1;
     if (useBrackets) {
       os.indent();
       genLiteralParser("[", ctx, os);
     }
     if (isa<ParameterElement>(arg))
-      genVariableParser(param, ctx, os.indent());
+      genStructParameterParser(param, ctx, os.indent());
     else if (auto *custom = dyn_cast<CustomDirective>(arg))
       genCustomParser(custom, ctx, os.indent());
     if (useBrackets) {
@@ -826,9 +887,13 @@ void DefFormat::genLiteralPrinter(StringRef value, FmtContext &ctx,
 }
 
 void DefFormat::genVariablePrinter(ParameterElement *el, FmtContext &ctx,
-                                   MethodBody &os, bool skipGuard) {
+                                   MethodBody &os, bool skipGuard,
+                                   std::optional<StringRef> printerOverride,
+                                   std::optional<StringRef> selfOverride) {
   const AttrOrTypeParameter &param = el->getParam();
-  ctx.withSelf(param.getAccessorName() + "()");
+  std::string self =
+      selfOverride ? selfOverride->str() : param.getAccessorName() + "()";
+  ctx.withSelf(self);
 
   // Guard the printer on the presence of optional parameters and that they
   // aren't equal to their default values (if they have one).
@@ -843,7 +908,9 @@ void DefFormat::genVariablePrinter(ParameterElement *el, FmtContext &ctx,
   shouldEmitSpace = true;
   lastWasPunctuation = false;
 
-  if (el->shouldBeQualified())
+  if (printerOverride)
+    os << tgfmt(*printerOverride, &ctx) << ";\n";
+  else if (el->shouldBeQualified())
     os << tgfmt(qualifiedParameterPrinter, &ctx) << ";\n";
   else if (auto printer = param.getPrinter())
     os << tgfmt(*printer, &ctx) << ";\n";
@@ -854,6 +921,17 @@ void DefFormat::genVariablePrinter(ParameterElement *el, FmtContext &ctx,
     os.unindent() << "}\n";
 }
 
+void DefFormat::genStructParameterPrinter(ParameterElement *el, FmtContext &ctx,
+                                          MethodBody &os) {
+  const llvm::Record *enumAttr = getEnumAttrDef(el);
+  if (!enumAttr || el->shouldBeQualified())
+    return genVariablePrinter(el, ctx, os);
+
+  std::string self = el->getParam().getAccessorName() + "().getValue()";
+  genVariablePrinter(el, ctx, os, /*skipGuard=*/false, "$_printer << $_self",
+                     self);
+}
+
 /// Generate code to guard printing on the presence of any optional parameters.
 template <typename ParameterRange>
 static void guardOnAny(FmtContext &ctx, MethodBody &os, ParameterRange &&params,
@@ -884,7 +962,7 @@ static void guardOnAnyOptional(FmtContext &ctx, MethodBody &os,
 
 void DefFormat::genCommaSeparatedPrinter(
     ArrayRef<FormatElement *> args, FmtContext &ctx, MethodBody &os,
-    function_ref<void(FormatElement *)> extra,
+    function_ref<void(FormatElement *)> extra, bool stripEnumAttrs,
     function_ref<void(FormatElement *)> extraPost) {
   // Emit a space if necessary, but only if the struct is present.
   if (shouldEmitSpace || !lastWasPunctuation) {
@@ -911,9 +989,12 @@ void DefFormat::genCommaSeparatedPrinter(
       extra(arg);
       shouldEmitSpace = false;
       lastWasPunctuation = true;
-      if (auto *realParam = dyn_cast<ParameterElement>(arg))
-        genVariablePrinter(realParam, ctx, os);
-      else if (auto *custom = dyn_cast<CustomDirective>(arg))
+      if (auto *realParam = dyn_cast<ParameterElement>(arg)) {
+        if (stripEnumAttrs)
+          genStructParameterPrinter(realParam, ctx, os);
+        else
+          genVariablePrinter(realParam, ctx, os);
+      } else if (auto *custom = dyn_cast<CustomDirective>(arg))
         genCustomPrinter(custom, ctx, os);
       if (extraPost)
         extraPost(arg);
@@ -930,16 +1011,18 @@ void DefFormat::genParamsPrinter(ParamsDirective *el, FmtContext &ctx,
       el->getElements(), [](ParameterElement *param) -> FormatElement * {
         return static_cast<FormatElement *>(param);
       });
-  genCommaSeparatedPrinter(args, ctx, os, [&](FormatElement *param) {});
+  genCommaSeparatedPrinter(
+      args, ctx, os, [&](FormatElement *param) {},
+      /*stripEnumAttrs=*/false);
 }
 
 void DefFormat::genStructPrinter(StructDirective *el, FmtContext &ctx,
                                  MethodBody &os) {
   ArrayRef<FormatElement *> elems = el->getElements();
-  // An `ArrayRefParameter` without a custom printer in a non-last struct
-  // position must be wrapped in `[...]` to avoid ambiguity with the
-  // struct-level comma separator. Track the element index via elemIdx, which is
-  // incremented once per element in the extraPost callback.
+  // A non-final parameter whose parser may consume commas must be wrapped in
+  // `[...]` to avoid ambiguity with the struct-level comma separator. Track the
+  // element index via elemIdx, which is incremented once per element in the
+  // extraPost callback.
   size_t elemIdx = 0;
   genCommaSeparatedPrinter(
       elems, ctx, os,
@@ -947,13 +1030,14 @@ void DefFormat::genStructPrinter(StructDirective *el, FmtContext &ctx,
         ParameterElement *param = getEncapsulatedParameterElement(arg);
         os << tgfmt("$_printer << \"$0 = \";\n", &ctx, param->getName());
         auto *paramEl = dyn_cast<ParameterElement>(arg);
-        if (paramEl && isUndelimitedArrayRefParam(paramEl) &&
+        if (paramEl && needsStructBrackets(paramEl) &&
             elemIdx + 1 < elems.size())
           os << tgfmt("$_printer << \"[\";\n", &ctx);
       },
+      /*stripEnumAttrs=*/true,
       [&](FormatElement *arg) {
         auto *paramEl = dyn_cast<ParameterElement>(arg);
-        if (paramEl && isUndelimitedArrayRefParam(paramEl) &&
+        if (paramEl && needsStructBrackets(paramEl) &&
             elemIdx + 1 < elems.size())
           os << tgfmt("$_printer << \"]\";\n", &ctx);
         ++elemIdx;



More information about the flang-commits mailing list