[Mlir-commits] [mlir] [mlir][llvm] support DICompileUnit source language dialect (PR #214301)

Gibran Essa llvmlistbot at llvm.org
Thu Aug 6 08:21:12 PDT 2026


https://github.com/gibwrong updated https://github.com/llvm/llvm-project/pull/214301

>From 4c3a836323ddb30f33aba40bbff574268d9983ea Mon Sep 17 00:00:00 2001
From: Gibran Essa <gessa at nvidia.com>
Date: Tue, 4 Aug 2026 18:29:49 +0000
Subject: [PATCH] add dialect field to llvm dialect compile unit

---
 mlir/include/mlir-c/Dialect/LLVM.h            |   10 +
 .../mlir/Dialect/LLVMIR/LLVMAttrDefs.td       | 1818 -----------------
 .../Dialect/LLVMIR/LLVMDialectBytecode.td     |  363 ----
 mlir/lib/CAPI/Dialect/LLVM.cpp                |   18 +-
 mlir/lib/Dialect/LLVMIR/IR/LLVMAttrs.cpp      |   10 +-
 mlir/lib/Target/LLVMIR/DebugImporter.cpp      |   11 +-
 mlir/lib/Target/LLVMIR/DebugTranslation.cpp   |   13 +-
 mlir/test/CAPI/llvm.c                         |   17 +-
 mlir/test/Dialect/LLVMIR/bytecode.mlir        |    2 +-
 mlir/test/Dialect/LLVMIR/debuginfo.mlir       |    5 +-
 mlir/test/Target/LLVMIR/Import/debug-info.ll  |   19 +
 mlir/test/Target/LLVMIR/llvmir-debug.mlir     |   22 +
 12 files changed, 104 insertions(+), 2204 deletions(-)

diff --git a/mlir/include/mlir-c/Dialect/LLVM.h b/mlir/include/mlir-c/Dialect/LLVM.h
index 28c4cdb98931d..30137faaaa8d8 100644
--- a/mlir/include/mlir-c/Dialect/LLVM.h
+++ b/mlir/include/mlir-c/Dialect/LLVM.h
@@ -376,6 +376,16 @@ MLIR_CAPI_EXPORTED MlirAttribute mlirLLVMDICompileUnitAttrGet(
     MlirAttribute splitDebugFilename, intptr_t nImportedEntities,
     MlirAttribute const *importedEntities);
 
+/// Creates a LLVM DICompileUnit attribute with a source language dialect.
+MLIR_CAPI_EXPORTED MlirAttribute
+mlirLLVMDICompileUnitAttrGetWithSourceLanguageDialect(
+    MlirContext ctx, MlirAttribute recId, bool isRecSelf, MlirAttribute id,
+    unsigned int sourceLanguage, unsigned int sourceLanguageDialect,
+    MlirAttribute file, MlirAttribute producer, bool isOptimized,
+    MlirLLVMDIEmissionKind emissionKind, bool isDebugInfoForProfiling,
+    MlirLLVMDINameTableKind nameTableKind, MlirAttribute splitDebugFilename,
+    intptr_t nImportedEntities, MlirAttribute const *importedEntities);
+
 MLIR_CAPI_EXPORTED MlirStringRef mlirLLVMDICompileUnitAttrGetName(void);
 
 /// Creates a LLVM DIFlags attribute.
diff --git a/mlir/include/mlir/Dialect/LLVMIR/LLVMAttrDefs.td b/mlir/include/mlir/Dialect/LLVMIR/LLVMAttrDefs.td
index 55bbf2a02f706..e69de29bb2d1d 100644
--- a/mlir/include/mlir/Dialect/LLVMIR/LLVMAttrDefs.td
+++ b/mlir/include/mlir/Dialect/LLVMIR/LLVMAttrDefs.td
@@ -1,1818 +0,0 @@
-//===-- LLVMAttrDefs.td - LLVM Attributes definition file --*- tablegen -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVMIR_ATTRDEFS
-#define LLVMIR_ATTRDEFS
-
-include "mlir/Dialect/LLVMIR/LLVMDialect.td"
-include "mlir/Dialect/LLVMIR/LLVMInterfaces.td"
-include "mlir/Dialect/Ptr/IR/MemorySpaceInterfaces.td"
-include "mlir/IR/AttrTypeBase.td"
-include "mlir/IR/CommonAttrConstraints.td"
-include "mlir/Interfaces/DataLayoutInterfaces.td"
-
-// All of the attributes will extend this class.
-class LLVM_Attr<string name, string attrMnemonic,
-                list<Trait> traits = [],
-                string baseCppClass = "::mlir::Attribute">
-    : AttrDef<LLVM_Dialect, name, traits, baseCppClass> {
-  let mnemonic = attrMnemonic;
-}
-
-//===----------------------------------------------------------------------===//
-// AddressSpaceAttr
-//===----------------------------------------------------------------------===//
-
-def LLVM_AddressSpaceAttr :
-    LLVM_Attr<"AddressSpace", "address_space", [
-    LLVM_LLVMAddrSpaceAttrInterface,
-    DeclareAttrInterfaceMethods<MemorySpaceAttrInterface>
-  ]> {
-  let summary = "LLVM address space";
-  let description = [{
-    The `address_space` attribute represents an LLVM address space. It takes an
-    unsigned integer parameter that specifies the address space number.
-
-    Different address spaces in LLVM can have different properties:
-    - Address space 0 is the default/generic address space
-    - Other address spaces may have specific semantics (e.g., shared memory,
-      constant memory, etc.) depending on the target architecture
-
-    Example:
-
-    ```mlir
-    // Address space 0 (default)
-    #llvm.address_space<0>
-
-    // Address space 1 (e.g., global memory on some targets)
-    #llvm.address_space<1>
-
-    // Address space 3 (e.g., shared memory on some GPU targets)
-    #llvm.address_space<3>
-    ```
-  }];
-  let parameters = (ins "unsigned":$addressSpace);
-  let assemblyFormat = "`<` $addressSpace `>`";
-}
-
-//===----------------------------------------------------------------------===//
-// CConvAttr
-//===----------------------------------------------------------------------===//
-
-def CConvAttr : LLVM_Attr<"CConv", "cconv"> {
-  let parameters = (ins "CConv":$CallingConv);
-  let assemblyFormat = "`<` $CallingConv `>`";
-}
-
-//===----------------------------------------------------------------------===//
-// ComdatAttr
-//===----------------------------------------------------------------------===//
-
-def ComdatAttr : LLVM_Attr<"Comdat", "comdat"> {
-  let parameters = (ins "comdat::Comdat":$comdat);
-  let assemblyFormat = "$comdat";
-}
-
-//===----------------------------------------------------------------------===//
-// LinkageAttr
-//===----------------------------------------------------------------------===//
-
-def LinkageAttr : LLVM_Attr<"Linkage", "linkage"> {
-  let parameters = (ins "linkage::Linkage":$linkage);
-  let assemblyFormat = "`<` $linkage `>`";
-}
-
-//===----------------------------------------------------------------------===//
-// FramePointerKindAttr
-//===----------------------------------------------------------------------===//
-
-def FramePointerKindAttr : LLVM_Attr<"FramePointerKind", "framePointerKind"> {
-  let parameters = (ins "framePointerKind::FramePointerKind":$framePointerKind);
-  let assemblyFormat = "`<` $framePointerKind `>`";
-}
-
-//===----------------------------------------------------------------------===//
-// FunctionEntryCountAttr
-//===----------------------------------------------------------------------===//
-
-def LLVM_FunctionEntryCountAttr
-    : LLVM_Attr<"FunctionEntryCount", "function_entry_count"> {
-  let summary = "LLVM function entry count profile metadata";
-  let description = [{
-    Models function-level `!prof` entry-count metadata. The `entry_count` field
-    stores the unsigned 64-bit counter bit pattern. The `count_type` field
-    defaults to real and selects whether the metadata is emitted as
-    `"function_entry_count"` or `"synthetic_function_entry_count"`. The optional
-    `imports` field stores the trailing import GUID operands used by ThinLTO
-    sample PGO.
-  }];
-  let parameters = (ins "uint64_t":$entry_count,
-                        DefaultValuedParameter<"ProfileCountType",
-                                               "ProfileCountType::Real">:$count_type,
-                        OptionalArrayRefParameter<"uint64_t">:$imports);
-  let assemblyFormat = "`<` struct(params) `>`";
-}
-
-//===----------------------------------------------------------------------===//
-// Loop Attributes
-//===----------------------------------------------------------------------===//
-
-def LoopVectorizeAttr : LLVM_Attr<"LoopVectorize", "loop_vectorize"> {
-  let description = [{
-    This attribute defines vectorization specific loop annotations that map to
-    the "!llvm.loop.vectorize" metadata.
-  }];
-
-  let parameters = (ins
-    OptionalParameter<"BoolAttr">:$disable,
-    OptionalParameter<"BoolAttr">:$predicateEnable,
-    OptionalParameter<"BoolAttr">:$scalableEnable,
-    OptionalParameter<"IntegerAttr">:$width,
-    OptionalParameter<"LoopAnnotationAttr">:$followupVectorized,
-    OptionalParameter<"LoopAnnotationAttr">:$followupEpilogue,
-    OptionalParameter<"LoopAnnotationAttr">:$followupAll
-  );
-
-  let assemblyFormat = "`<` struct(params) `>`";
-
-  // Generate mnemonic alias for the attribute.
-  let genMnemonicAlias = 1;
-}
-
-def LoopInterleaveAttr : LLVM_Attr<"LoopInterleave", "loop_interleave"> {
-  let description = [{
-    This attribute defines interleaving specific loop annotations that map to
-    the "!llvm.loop.interleave" metadata.
-  }];
-
-  let parameters = (ins
-    "IntegerAttr":$count
-  );
-
-  let assemblyFormat = "`<` struct(params) `>`";
-
-  // Generate mnemonic alias for the attribute.
-  let genMnemonicAlias = 1;
-}
-
-def LoopUnrollAttr : LLVM_Attr<"LoopUnroll", "loop_unroll"> {
-  let description = [{
-    This attribute defines unrolling specific loop annotations that map to
-    the "!llvm.loop.unroll" metadata.
-  }];
-
-  let parameters = (ins
-    OptionalParameter<"BoolAttr">:$disable,
-    OptionalParameter<"IntegerAttr">:$count,
-    OptionalParameter<"BoolAttr">:$runtimeDisable,
-    OptionalParameter<"BoolAttr">:$full,
-    OptionalParameter<"LoopAnnotationAttr">:$followupUnrolled,
-    OptionalParameter<"LoopAnnotationAttr">:$followupRemainder,
-    OptionalParameter<"LoopAnnotationAttr">:$followupAll
-  );
-
-  let assemblyFormat = "`<` struct(params) `>`";
-
-  // Generate mnemonic alias for the attribute.
-  let genMnemonicAlias = 1;
-}
-
-def LoopUnrollAndJamAttr : LLVM_Attr<"LoopUnrollAndJam", "loop_unroll_and_jam"> {
-  let description = [{
-    This attribute defines "unroll and jam" specific loop annotations that map to
-    the "!llvm.loop.unroll_and_jam" metadata.
-  }];
-
-  let parameters = (ins
-    OptionalParameter<"BoolAttr">:$disable,
-    OptionalParameter<"IntegerAttr">:$count,
-    OptionalParameter<"LoopAnnotationAttr">:$followupOuter,
-    OptionalParameter<"LoopAnnotationAttr">:$followupInner,
-    OptionalParameter<"LoopAnnotationAttr">:$followupRemainderOuter,
-    OptionalParameter<"LoopAnnotationAttr">:$followupRemainderInner,
-    OptionalParameter<"LoopAnnotationAttr">:$followupAll
-  );
-
-  let assemblyFormat = "`<` struct(params) `>`";
-
-  // Generate mnemonic alias for the attribute.
-  let genMnemonicAlias = 1;
-}
-
-def LoopLICMAttr : LLVM_Attr<"LoopLICM", "loop_licm"> {
-  let description = [{
-    This attribute encapsulates loop invariant code motion (licm) specific loop
-    annotations. The fields correspond to the "!llvm.licm.disable" and the
-    "!llvm.loop.licm_versioning.disable" metadata.
-  }];
-
-  let parameters = (ins
-    OptionalParameter<"BoolAttr">:$disable,
-    OptionalParameter<"BoolAttr">:$versioningDisable
-  );
-
-  let assemblyFormat = "`<` struct(params) `>`";
-
-  // Generate mnemonic alias for the attribute.
-  let genMnemonicAlias = 1;
-}
-
-def LoopDistributeAttr : LLVM_Attr<"LoopDistribute", "loop_distribute"> {
-  let description = [{
-    This attribute defines distribution specific loop annotations that map to
-    the "!llvm.loop.distribute" metadata.
-  }];
-
-  let parameters = (ins
-    OptionalParameter<"BoolAttr">:$disable,
-    OptionalParameter<"LoopAnnotationAttr">:$followupCoincident,
-    OptionalParameter<"LoopAnnotationAttr">:$followupSequential,
-    OptionalParameter<"LoopAnnotationAttr">:$followupFallback,
-    OptionalParameter<"LoopAnnotationAttr">:$followupAll
-  );
-
-  let assemblyFormat = "`<` struct(params) `>`";
-
-  // Generate mnemonic alias for the attribute.
-  let genMnemonicAlias = 1;
-}
-
-def LoopPipelineAttr : LLVM_Attr<"LoopPipeline", "loop_pipeline"> {
-  let description = [{
-    This attribute defines pipelining specific loop annotations that map to
-    the "!llvm.loop.pipeline" metadata.
-  }];
-
-  let parameters = (ins
-    OptionalParameter<"BoolAttr">:$disable,
-    OptionalParameter<"IntegerAttr">:$initiationinterval
-  );
-
-  let assemblyFormat = "`<` struct(params) `>`";
-
-  // Generate mnemonic alias for the attribute.
-  let genMnemonicAlias = 1;
-}
-
-def LoopPeeledAttr : LLVM_Attr<"LoopPeeled", "loop_peeled"> {
-  let description = [{
-    This attribute defines pipelining specific loop annotations that map to
-    the "!llvm.loop.peeled" metadata.
-  }];
-
-  let parameters = (ins
-    OptionalParameter<"IntegerAttr">:$count
-  );
-
-  let assemblyFormat = "`<` struct(params) `>`";
-
-  // Generate mnemonic alias for the attribute.
-  let genMnemonicAlias = 1;
-}
-
-def LoopUnswitchAttr : LLVM_Attr<"LoopUnswitch", "loop_unswitch"> {
-  let description = [{
-    This attribute defines pipelining specific loop annotations that map to
-    the "!llvm.loop.unswitch" metadata.
-  }];
-
-  let parameters = (ins
-    OptionalParameter<"BoolAttr">:$partialDisable
-  );
-
-  let assemblyFormat = "`<` struct(params) `>`";
-
-  // Generate mnemonic alias for the attribute.
-  let genMnemonicAlias = 1;
-}
-
-def LoopAnnotationAttr : LLVM_Attr<"LoopAnnotation", "loop_annotation"> {
-  let description = [{
-    This attributes encapsulates "loop metadata". It is meant to decorate
-    branches that are "latches" (loop backedges) and maps to the `!llvm.loop`
-    metadatas: https://llvm.org/docs/LangRef.html#llvm-loop
-    It stores annotations in attribute parameters and groups related options in
-    nested attributes to provide structured access.
-  }];
-
-  let parameters = (ins
-    OptionalParameter<"BoolAttr">:$disableNonforced,
-    OptionalParameter<"LoopVectorizeAttr">:$vectorize,
-    OptionalParameter<"LoopInterleaveAttr">:$interleave,
-    OptionalParameter<"LoopUnrollAttr">:$unroll,
-    OptionalParameter<"LoopUnrollAndJamAttr">:$unrollAndJam,
-    OptionalParameter<"LoopLICMAttr">:$licm,
-    OptionalParameter<"LoopDistributeAttr">:$distribute,
-    OptionalParameter<"LoopPipelineAttr">:$pipeline,
-    OptionalParameter<"LoopPeeledAttr">:$peeled,
-    OptionalParameter<"LoopUnswitchAttr">:$unswitch,
-    OptionalParameter<"BoolAttr">:$mustProgress,
-    OptionalParameter<"BoolAttr">:$isVectorized,
-    OptionalParameter<"FusedLoc">:$startLoc,
-    OptionalParameter<"FusedLoc">:$endLoc,
-    OptionalArrayRefParameter<"AccessGroupAttr">:$parallelAccesses
-  );
-
-  let assemblyFormat = "`<` struct(params) `>`";
-
-  // Generate mnemonic alias for the attribute.
-  let genMnemonicAlias = 1;
-}
-
-//===----------------------------------------------------------------------===//
-// DebugInfo Attributes
-//===----------------------------------------------------------------------===//
-
-class LLVM_DIParameter<string summary, string default, string parseName,
-                       string errorCase, string printName = parseName>
-    : AttrOrTypeParameter<"unsigned", "debug info " # summary> {
-  let parser = [{ [&]() -> FailureOr<unsigned> {
-    SMLoc tagLoc = $_parser.getCurrentLocation();
-    StringRef name;
-    if ($_parser.parseKeyword(&name))
-      return failure();
-
-    unsigned tag = llvm::dwarf::get}] # parseName # [{(name);
-    if (tag == }] # errorCase # [{)
-      return $_parser.emitError(tagLoc)
-        << "invalid debug info }] # summary # [{ name: " << name;
-    return tag;
-  }() }];
-  let printer = "$_printer << llvm::dwarf::" # printName # "String($_self)";
-  let defaultValue = default;
-}
-
-def LLVM_DICallingConventionParameter : LLVM_DIParameter<
-  "calling convention", /*default=*/"0", "CallingConvention", /*errorCase=*/"0",
-  "Convention"
->;
-
-def LLVM_DIEncodingParameter : LLVM_DIParameter<
-  "encoding", /*default=*/"0", "AttributeEncoding", /*errorCase=*/"0"
->;
-
-def LLVM_DILanguageParameter : LLVM_DIParameter<
-  "language", /*default=*/"0", "Language", /*errorCase=*/"0"
->;
-
-def LLVM_DITagParameter : LLVM_DIParameter<
-  "tag", /*default=*/"0", "Tag", /*errorCase=*/"llvm::dwarf::DW_TAG_invalid"
->;
-
-def LLVM_DIOperationEncodingParameter : LLVM_DIParameter<
-  "operation encoding", /*default=*/"", "OperationEncoding", /*errorCase=*/"0"
->;
-
-//===----------------------------------------------------------------------===//
-// DIExpressionAttr
-//===----------------------------------------------------------------------===//
-
-def LLVM_DIExpressionElemAttr : LLVM_Attr<"DIExpressionElem",
-                                          "di_expression_elem"> {
-  let parameters = (ins
-    LLVM_DIOperationEncodingParameter:$opcode,
-    OptionalArrayRefParameter<"uint64_t">:$arguments);
-  let assemblyFormat = [{
-    `` $opcode ( `(` custom<ExpressionArg>(ref($opcode), $arguments)^ `)` ) : (``)?
-  }];
-}
-
-def LLVM_DIExpressionAttr : LLVM_Attr<"DIExpression", "di_expression"> {
-  let parameters = (ins
-    OptionalArrayRefParameter<"DIExpressionElemAttr">:$operations
-  );
-  let builders = [
-    AttrBuilder<(ins)>
-  ];
-  let constBuilderCall =
-            "::mlir::LLVM::DIExpressionAttr::get($_builder.getContext(), $0)";
-  let assemblyFormat = "`<` ( `[` $operations^ `]` ) : (``)? `>`";
-}
-
-//===----------------------------------------------------------------------===//
-// DINullTypeAttr
-//===----------------------------------------------------------------------===//
-
-def LLVM_DINullTypeAttr : LLVM_Attr<"DINullType", "di_null_type",
-                                    /*traits=*/[], "DITypeAttr"> {
-  let parameters = (ins);
-
-  // Generate mnemonic alias for the attribute.
-  let genMnemonicAlias = 1;
-}
-
-//===----------------------------------------------------------------------===//
-// DIBasicTypeAttr
-//===----------------------------------------------------------------------===//
-
-def LLVM_DIBasicTypeAttr : LLVM_Attr<"DIBasicType", "di_basic_type",
-                                     /*traits=*/[], "DITypeAttr"> {
-  let parameters = (ins
-    LLVM_DITagParameter:$tag,
-    OptionalParameter<"StringAttr">:$name,
-    OptionalParameter<"uint64_t">:$sizeInBits,
-    LLVM_DIEncodingParameter:$encoding
-  );
-
-  let builders = [
-    TypeBuilder<(ins
-      "unsigned":$tag, "const Twine &":$name, "uint64_t":$sizeInBits,
-      "unsigned":$encoding
-    ), [{
-      return $_get($_ctxt, tag, StringAttr::get($_ctxt, name), sizeInBits,
-                   encoding);
-    }]>
-  ];
-  let assemblyFormat = "`<` struct(params) `>`";
-
-  // Generate mnemonic alias for the attribute.
-  let genMnemonicAlias = 1;
-}
-
-//===----------------------------------------------------------------------===//
-// DICompileUnitAttr
-//===----------------------------------------------------------------------===//
-
-def LLVM_DICompileUnitAttr : LLVM_Attr<"DICompileUnit", "di_compile_unit",
-                                       [LLVM_DIRecursiveTypeAttrInterface],
-                                       "DIScopeAttr"> {
-  let parameters = (ins
-    // DIRecursiveTypeAttrInterface specific parameters.
-    OptionalParameter<"DistinctAttr">:$recId,
-    OptionalParameter<"bool">:$isRecSelf,
-    // DICompileUnitAttr specific parameters.
-    OptionalParameter<"DistinctAttr">:$id,
-    LLVM_DILanguageParameter:$sourceLanguage,
-    OptionalParameter<"DIFileAttr">:$file,
-    OptionalParameter<"StringAttr">:$producer,
-    OptionalParameter<"bool">:$isOptimized,
-    OptionalParameter<"DIEmissionKind">:$emissionKind,
-    OptionalParameter<"bool">:$isDebugInfoForProfiling,
-    OptionalParameter<"DINameTableKind">:$nameTableKind,
-    OptionalParameter<"StringAttr">:$splitDebugFilename,
-    OptionalArrayRefParameter<"DINodeAttr">:$importedEntities
-  );
-  let builders = [
-    AttrBuilderWithInferredContext<(ins
-      "DistinctAttr":$id, "unsigned":$sourceLanguage, "DIFileAttr":$file,
-      "StringAttr":$producer, "bool":$isOptimized,
-      "DIEmissionKind":$emissionKind,
-      CArg<"bool", "false">:$isDebugInfoForProfiling,
-      CArg<"DINameTableKind", "DINameTableKind::Default">:$nameTableKind,
-      CArg<"StringAttr", "{}">:$splitDebugFilename,
-      CArg<"ArrayRef<DINodeAttr>", "{}">:$importedEntities
-    ), [{
-      return $_get(id.getContext(), /*recId=*/nullptr, /*isRecSelf=*/false, id,
-                   sourceLanguage, file, producer, isOptimized, emissionKind,
-                   isDebugInfoForProfiling, nameTableKind, splitDebugFilename,
-                   importedEntities);
-    }]>
-  ];
-  let assemblyFormat = "`<` struct(params) `>`";
-  let extraClassDeclaration = [{
-    /// Requirements of DIRecursiveTypeAttrInterface.
-    /// @{
-
-    /// Get a copy of this attr but with the recursive ID set to `recId`.
-    DIRecursiveTypeAttrInterface withRecId(DistinctAttr recId);
-
-    /// Build a rec-self instance using the provided `recId`.
-    static DIRecursiveTypeAttrInterface getRecSelf(DistinctAttr recId);
-
-    /// @}
-  }];
-
-  // Generate mnemonic alias for the attribute.
-  let genMnemonicAlias = 1;
-}
-
-//===----------------------------------------------------------------------===//
-// DICompositeTypeAttr
-//===----------------------------------------------------------------------===//
-
-def LLVM_DICompositeTypeAttr : LLVM_Attr<"DICompositeType", "di_composite_type",
-                                         [LLVM_DIRecursiveTypeAttrInterface],
-                                         "DITypeAttr"> {
-  let parameters = (ins
-    // DIRecursiveTypeAttrInterface specific parameters.
-    OptionalParameter<"DistinctAttr">:$recId,
-    OptionalParameter<"bool">:$isRecSelf,
-    // DICompositeType specific parameters.
-    LLVM_DITagParameter:$tag,
-    OptionalParameter<"StringAttr">:$name,
-    OptionalParameter<"DIFileAttr">:$file,
-    OptionalParameter<"uint32_t">:$line,
-    OptionalParameter<"DIScopeAttr">:$scope,
-    OptionalParameter<"DITypeAttr">:$baseType,
-    OptionalParameter<"DIFlags">:$flags,
-    OptionalParameter<"uint64_t">:$sizeInBits,
-    OptionalParameter<"uint64_t">:$alignInBits,
-    OptionalParameter<"DIExpressionAttr">:$dataLocation,
-    OptionalParameter<"DIExpressionAttr">:$rank,
-    OptionalParameter<"DIExpressionAttr">:$allocated,
-    OptionalParameter<"DIExpressionAttr">:$associated,
-    OptionalParameter<"StringAttr">:$identifier,
-    OptionalParameter<"DIDerivedTypeAttr">:$discriminator,
-    OptionalArrayRefParameter<"DINodeAttr">:$elements
-  );
-  let builders = [
-    AttrBuilder<(ins
-      "unsigned":$tag, "StringAttr":$name, "DIFileAttr":$file,
-      "uint32_t":$line, "DIScopeAttr":$scope, "DITypeAttr":$baseType,
-      "DIFlags":$flags, "uint64_t":$sizeInBits, "uint64_t":$alignInBits,
-      "DIExpressionAttr":$dataLocation, "DIExpressionAttr":$rank,
-      "DIExpressionAttr":$allocated, "DIExpressionAttr":$associated,
-      "StringAttr":$identifier, "DIDerivedTypeAttr":$discriminator,
-      "ArrayRef<DINodeAttr>":$elements
-    ), [{
-      return $_get($_ctxt, /*recId=*/nullptr, /*isRecSelf=*/false,
-                   tag, name, file, line, scope, baseType, flags, sizeInBits,
-                   alignInBits, dataLocation, rank, allocated,
-                   associated, identifier, discriminator, elements);
-    }]>
-  ];
-  let assemblyFormat = "`<` struct(params) `>`";
-  let extraClassDeclaration = [{
-    /// Requirements of DIRecursiveTypeAttrInterface.
-    /// @{
-
-    /// Get a copy of this type attr but with the recursive ID set to `recId`.
-    DIRecursiveTypeAttrInterface withRecId(DistinctAttr recId);
-
-    /// Build a rec-self instance using the provided `recId`.
-    static DIRecursiveTypeAttrInterface getRecSelf(DistinctAttr recId);
-
-    /// @}
-  }];
-
-  // Generate mnemonic alias for the attribute.
-  let genMnemonicAlias = 1;
-}
-
-//===----------------------------------------------------------------------===//
-// DIDerivedTypeAttr
-//===----------------------------------------------------------------------===//
-
-def LLVM_DIDerivedTypeAttr : LLVM_Attr<"DIDerivedType", "di_derived_type",
-                                       /*traits=*/[], "DITypeAttr"> {
-  let parameters = (ins
-    LLVM_DITagParameter:$tag,
-    OptionalParameter<"StringAttr">:$name,
-    OptionalParameter<"DIFileAttr">:$file,
-    OptionalParameter<"uint32_t">:$line,
-    OptionalParameter<"DIScopeAttr">:$scope,
-    OptionalParameter<"DITypeAttr">:$baseType,
-    OptionalParameter<"uint64_t">:$sizeInBits,
-    OptionalParameter<"uint32_t">:$alignInBits,
-    OptionalParameter<"uint64_t">:$offsetInBits,
-    OptionalParameter<"std::optional<unsigned>">:$dwarfAddressSpace,
-    OptionalParameter<"DIFlags", "DIFlags::Zero">:$flags,
-    OptionalParameter<"Attribute">:$extraData
-  );
-  let assemblyFormat = "`<` struct(params) `>`";
-  let genVerifyDecl = 1;
-
-  // Generate mnemonic alias for the attribute.
-  let genMnemonicAlias = 1;
-}
-
-//===----------------------------------------------------------------------===//
-// DIFileAttr
-//===----------------------------------------------------------------------===//
-
-def LLVM_DIFileAttr : LLVM_Attr<"DIFile", "di_file", /*traits=*/[], "DIScopeAttr"> {
-  let parameters = (ins "StringAttr":$name, "StringAttr":$directory);
-  let builders = [AttrBuilder<(ins "StringRef":$name, "StringRef":$directory), [{
-      return $_get($_ctxt, StringAttr::get($_ctxt, name),
-                   StringAttr::get($_ctxt, directory));
-    }]>
-  ];
-  let assemblyFormat = "`<` $name `in` $directory `>`";
-
-  // Generate mnemonic alias for the attribute.
-  let genMnemonicAlias = 1;
-}
-
-//===----------------------------------------------------------------------===//
-// DIGlobalVariableExpressionAttr
-//===----------------------------------------------------------------------===//
-
-def LLVM_DIGlobalVariableExpressionAttr
-    : LLVM_Attr<"DIGlobalVariableExpression", "di_global_variable_expression"> {
-  let parameters = (ins
-    "DIGlobalVariableAttr":$var,
-    OptionalParameter<"DIExpressionAttr">:$expr
-  );
-  let assemblyFormat = "`<` struct(params) `>`";
-  let constBuilderCall = "$0";
-
-  // Generate mnemonic alias for the attribute.
-  let genMnemonicAlias = 1;
-}
-
-def DIGlobalVariableExpressionArrayAttr :
-  TypedArrayAttrBase<LLVM_DIGlobalVariableExpressionAttr,
-  "an array of variable expressions">;
-
-//===----------------------------------------------------------------------===//
-// DIGlobalVariableAttr
-//===----------------------------------------------------------------------===//
-
-def LLVM_DIGlobalVariable : LLVM_Attr<"DIGlobalVariable", "di_global_variable",
-                                      /*traits=*/[], "DINodeAttr"> {
-  let parameters = (ins
-    OptionalParameter<"DIScopeAttr">:$scope,
-    OptionalParameter<"StringAttr">:$name,
-    OptionalParameter<"StringAttr">:$linkageName,
-    "DIFileAttr":$file,
-    "unsigned":$line,
-    "DITypeAttr":$type,
-    OptionalParameter<"bool">:$isLocalToUnit,
-    OptionalParameter<"bool">:$isDefined,
-    OptionalParameter<"unsigned">:$alignInBits);
-  let assemblyFormat = "`<` struct(params) `>`";
-
-  // Generate mnemonic alias for the attribute.
-  let genMnemonicAlias = 1;
-}
-
-//===----------------------------------------------------------------------===//
-// DILexicalBlockAttr
-//===----------------------------------------------------------------------===//
-
-def LLVM_DILexicalBlockAttr : LLVM_Attr<"DILexicalBlock", "di_lexical_block",
-                                        /*traits=*/[], "DILocalScopeAttr"> {
-  let parameters = (ins
-    "DIScopeAttr":$scope,
-    OptionalParameter<"DIFileAttr">:$file,
-    OptionalParameter<"unsigned">:$line,
-    OptionalParameter<"unsigned">:$column
-  );
-  let builders = [
-    AttrBuilderWithInferredContext<(ins
-      "DIScopeAttr":$scope, "DIFileAttr":$file, "unsigned":$line,
-      "unsigned":$column
-    ), [{
-      return $_get(scope.getContext(), scope, file, line, column);
-    }]>
-  ];
-  let assemblyFormat = "`<` struct(params) `>`";
-
-  // Generate mnemonic alias for the attribute.
-  let genMnemonicAlias = 1;
-}
-
-//===----------------------------------------------------------------------===//
-// DILexicalBlockFileAttr
-//===----------------------------------------------------------------------===//
-
-def LLVM_DILexicalBlockFile : LLVM_Attr<"DILexicalBlockFile", "di_lexical_block_file",
-                                        /*traits=*/[], "DILocalScopeAttr"> {
-  let parameters = (ins
-    "DIScopeAttr":$scope,
-    OptionalParameter<"DIFileAttr">:$file,
-    "unsigned":$discriminator
-  );
-  let builders = [
-    AttrBuilderWithInferredContext<(ins
-      "DIScopeAttr":$scope, "DIFileAttr":$file, "unsigned":$discriminator
-    ), [{
-      return $_get(scope.getContext(), scope, file, discriminator);
-    }]>
-  ];
-  let assemblyFormat = "`<` struct(params) `>`";
-
-  // Generate mnemonic alias for the attribute.
-  let genMnemonicAlias = 1;
-}
-
-//===----------------------------------------------------------------------===//
-// DILocalVariableAttr
-//===----------------------------------------------------------------------===//
-
-def LLVM_DILocalVariableAttr : LLVM_Attr<"DILocalVariable", "di_local_variable",
-                                         /*traits=*/[], "DINodeAttr"> {
-  let parameters = (ins
-    "DIScopeAttr":$scope,
-    OptionalParameter<"StringAttr">:$name,
-    OptionalParameter<"DIFileAttr">:$file,
-    OptionalParameter<"unsigned">:$line,
-    OptionalParameter<"unsigned">:$arg,
-    OptionalParameter<"unsigned">:$alignInBits,
-    OptionalParameter<"DITypeAttr">:$type,
-    OptionalParameter<"DIFlags", "DIFlags::Zero">:$flags
-  );
-  let builders = [
-    AttrBuilderWithInferredContext<(ins
-      "DIScopeAttr":$scope, "StringRef":$name, "DIFileAttr":$file,
-      "unsigned":$line, "unsigned":$arg, "unsigned":$alignInBits,
-      "DITypeAttr":$type, "DIFlags":$flags
-    ), [{
-      MLIRContext *ctx = scope.getContext();
-      return $_get(ctx, scope, StringAttr::get(ctx, name), file, line,
-                   arg, alignInBits, type, flags);
-    }]>
-  ];
-  let assemblyFormat = "`<` struct(params) `>`";
-
-  // Generate mnemonic alias for the attribute.
-  let genMnemonicAlias = 1;
-}
-
-//===----------------------------------------------------------------------===//
-// DISubprogramAttr
-//===----------------------------------------------------------------------===//
-
-def LLVM_DISubprogramAttr : LLVM_Attr<"DISubprogram", "di_subprogram",
-                                      [LLVM_DIRecursiveTypeAttrInterface],
-                                      "DILocalScopeAttr"> {
-  let parameters = (ins
-      // DIRecursiveTypeAttrInterface specific parameters.
-      OptionalParameter<"DistinctAttr">:$recId,
-      OptionalParameter<"bool">:$isRecSelf,
-      // DISubprogramAttr specific parameters.
-      OptionalParameter<"DistinctAttr">:$id,
-      OptionalParameter<"DICompileUnitAttr">:$compileUnit,
-      OptionalParameter<"DIScopeAttr">:$scope,
-      OptionalParameter<"StringAttr">:$name,
-      OptionalParameter<"StringAttr">:$linkageName,
-      OptionalParameter<"DIFileAttr">:$file,
-      OptionalParameter<"unsigned">:$line,
-      OptionalParameter<"unsigned">:$scopeLine,
-      OptionalParameter<"DISubprogramFlags">:$subprogramFlags,
-      OptionalParameter<"DISubroutineTypeAttr">:$type,
-      OptionalArrayRefParameter<"Attribute">:$retainedNodes,
-      OptionalArrayRefParameter<"DINodeAttr">:$annotations);
-  let builders = [AttrBuilder<
-      (ins "DistinctAttr":$id, "DICompileUnitAttr":$compileUnit,
-          "DIScopeAttr":$scope, "StringAttr":$name, "StringAttr":$linkageName,
-          "DIFileAttr":$file, "unsigned":$line, "unsigned":$scopeLine,
-          "DISubprogramFlags":$subprogramFlags, "DISubroutineTypeAttr":$type,
-          "ArrayRef<Attribute>":$retainedNodes,
-          "ArrayRef<DINodeAttr>":$annotations),
-      [{
-      return $_get($_ctxt, /*recId=*/nullptr, /*isRecSelf=*/false, id, compileUnit,
-                   scope, name, linkageName, file, line, scopeLine,
-                   subprogramFlags, type, retainedNodes, annotations);
-    }]>];
-  let assemblyFormat = "`<` struct(params) `>`";
-  let extraClassDeclaration = [{
-    /// Requirements of DIRecursiveTypeAttrInterface.
-    /// @{
-
-    /// Get a copy of this type attr but with the recursive ID set to `recId`.
-    DIRecursiveTypeAttrInterface withRecId(DistinctAttr recId);
-
-    /// Build a rec-self instance using the provided `recId`.
-    static DIRecursiveTypeAttrInterface getRecSelf(DistinctAttr recId);
-
-    /// @}
-  }];
-
-  // Generate mnemonic alias for the attribute.
-  let genMnemonicAlias = 1;
-}
-
-//===----------------------------------------------------------------------===//
-// DIModuleAttr
-//===----------------------------------------------------------------------===//
-
-def LLVM_DIModuleAttr : LLVM_Attr<"DIModule", "di_module",
-                                      /*traits=*/[], "DIScopeAttr"> {
-  let parameters = (ins
-    OptionalParameter<"DIFileAttr">:$file,
-    OptionalParameter<"DIScopeAttr">:$scope,
-    OptionalParameter<"StringAttr">:$name,
-    OptionalParameter<"StringAttr">:$configMacros,
-    OptionalParameter<"StringAttr">:$includePath,
-    OptionalParameter<"StringAttr">:$apinotes,
-    OptionalParameter<"unsigned">:$line,
-    OptionalParameter<"bool">:$isDecl
-  );
-
-  let assemblyFormat = "`<` struct(params) `>`";
-
-  // Generate mnemonic alias for the attribute.
-  let genMnemonicAlias = 1;
-}
-
-//===----------------------------------------------------------------------===//
-// DINamespaceAttr
-//===----------------------------------------------------------------------===//
-
-def LLVM_DINamespaceAttr : LLVM_Attr<"DINamespace", "di_namespace",
-                                      /*traits=*/[], "DIScopeAttr"> {
-  let parameters = (ins
-    OptionalParameter<"StringAttr">:$name,
-    OptionalParameter<"DIScopeAttr">:$scope,
-    "bool":$exportSymbols
-  );
-
-  let assemblyFormat = "`<` struct(params) `>`";
-
-  // Generate mnemonic alias for the attribute.
-  let genMnemonicAlias = 1;
-}
-
-//===----------------------------------------------------------------------===//
-// DIImportedEntityAttr
-//===----------------------------------------------------------------------===//
-
-def LLVM_DIImportedEntityAttr : LLVM_Attr<"DIImportedEntity", "di_imported_entity",
-                                           /*traits=*/[], "DINodeAttr"> {
-  let parameters = (ins
-    LLVM_DITagParameter:$tag,
-    "DIScopeAttr":$scope,
-    "DINodeAttr":$entity,
-    OptionalParameter<"DIFileAttr">:$file,
-    OptionalParameter<"unsigned">:$line,
-    OptionalParameter<"StringAttr">:$name,
-    OptionalArrayRefParameter<"DINodeAttr">:$elements
-  );
-
-  let assemblyFormat = "`<` struct(params) `>`";
-
-  // Generate mnemonic alias for the attribute.
-  let genMnemonicAlias = 1;
-}
-
-//===----------------------------------------------------------------------===//
-// DIAnnotationAttr
-//===----------------------------------------------------------------------===//
-
-def LLVM_DIAnnotationAttr : LLVM_Attr<"DIAnnotation",
-                                      "di_annotation",
-                                      /*traits=*/[], "DINodeAttr"> {
-  let parameters = (ins
-    "StringAttr":$name,
-    "StringAttr":$value
-  );
-
-  let assemblyFormat = "`<` struct(params) `>`";
-}
-
-//===----------------------------------------------------------------------===//
-// DISubrangeAttr
-//===----------------------------------------------------------------------===//
-
-def LLVM_DISubrangeAttr : LLVM_Attr<"DISubrange", "di_subrange", /*traits=*/[],
-                                    "DINodeAttr"> {
-  let parameters = (ins
-    OptionalParameter<"::mlir::Attribute">:$count,
-    OptionalParameter<"::mlir::Attribute">:$lowerBound,
-    OptionalParameter<"::mlir::Attribute">:$upperBound,
-    OptionalParameter<"::mlir::Attribute">:$stride
-  );
-  let assemblyFormat = "`<` struct(params) `>`";
-}
-
-//===----------------------------------------------------------------------===//
-// DICommonBlockAttr
-//===----------------------------------------------------------------------===//
-
-def LLVM_DICommonBlockAttr : LLVM_Attr<"DICommonBlock", "di_common_block",
-                                       /*traits=*/[], "DIScopeAttr"> {
-  let parameters = (ins
-    "DIScopeAttr":$scope,
-    OptionalParameter<"DIGlobalVariableAttr">:$decl,
-    "StringAttr":$name,
-    OptionalParameter<"DIFileAttr">:$file,
-    OptionalParameter<"unsigned">:$line
-  );
-  let assemblyFormat = "`<` struct(params) `>`";
-
-  // Generate mnemonic alias for the attribute.
-  let genMnemonicAlias = 1;
-}
-
-//===----------------------------------------------------------------------===//
-// DIGenericSubrangeAttr
-//===----------------------------------------------------------------------===//
-
-def LLVM_DIGenericSubrangeAttr : LLVM_Attr<"DIGenericSubrange",
-                                           "di_generic_subrange", /*traits=*/[],
-                                           "DINodeAttr"> {
-  let parameters = (ins
-    OptionalParameter<"::mlir::Attribute">:$count,
-    "::mlir::Attribute":$lowerBound,
-    OptionalParameter<"::mlir::Attribute">:$upperBound,
-    "::mlir::Attribute":$stride
-  );
-  let assemblyFormat = "`<` struct(params) `>`";
-}
-
-//===----------------------------------------------------------------------===//
-// DISubroutineTypeAttr
-//===----------------------------------------------------------------------===//
-
-def LLVM_DISubroutineTypeAttr : LLVM_Attr<"DISubroutineType", "di_subroutine_type",
-                                          /*traits=*/[], "DITypeAttr"> {
-  let parameters = (ins
-    LLVM_DICallingConventionParameter:$callingConvention,
-    OptionalArrayRefParameter<"DITypeAttr">:$types
-  );
-  let builders = [
-    TypeBuilder<(ins "ArrayRef<DITypeAttr>":$types), [{
-      return $_get($_ctxt, /*callingConvention=*/0, types);
-    }]>
-  ];
-  let assemblyFormat = "`<` struct(params) `>`";
-
-  // Generate mnemonic alias for the attribute.
-  let genMnemonicAlias = 1;
-}
-
-//===----------------------------------------------------------------------===//
-// DILabelAttr
-//===----------------------------------------------------------------------===//
-
-def LLVM_DILabelAttr : LLVM_Attr<"DILabel", "di_label",
-                                 /*traits=*/[], "DINodeAttr"> {
-  let parameters = (ins
-    "DIScopeAttr":$scope,
-    OptionalParameter<"StringAttr">:$name,
-    OptionalParameter<"DIFileAttr">:$file,
-    OptionalParameter<"unsigned">:$line
-  );
-  let builders = [
-    AttrBuilderWithInferredContext<(ins
-      "DIScopeAttr":$scope, "StringRef":$name, "DIFileAttr":$file,
-      "unsigned":$line
-    ), [{
-      MLIRContext *ctx = scope.getContext();
-      return $_get(ctx, scope, StringAttr::get(ctx, name), file, line);
-    }]>
-  ];
-
-  let assemblyFormat = "`<` struct(params) `>`";
-
-  // Generate mnemonic alias for the attribute.
-  let genMnemonicAlias = 1;
-}
-
-//===----------------------------------------------------------------------===//
-// DIStringTypeAttr
-//===----------------------------------------------------------------------===//
-
-def LLVM_DIStringTypeAttr : LLVM_Attr<"DIStringType", "di_string_type",
-                                     /*traits=*/[], "DITypeAttr"> {
-  let parameters = (ins
-    LLVM_DITagParameter:$tag,
-    OptionalParameter<"StringAttr">:$name,
-    OptionalParameter<"uint64_t">:$sizeInBits,
-    OptionalParameter<"uint32_t">:$alignInBits,
-    OptionalParameter<"DIVariableAttr">:$stringLength,
-    OptionalParameter<"DIExpressionAttr">:$stringLengthExp,
-    OptionalParameter<"DIExpressionAttr">:$stringLocationExp,
-    LLVM_DIEncodingParameter:$encoding
-  );
-  let assemblyFormat = "`<` struct(params) `>`";
-
-  // Generate mnemonic alias for the attribute.
-  let genMnemonicAlias = 1;
-}
-
-//===----------------------------------------------------------------------===//
-// MemoryEffectsAttr
-//===----------------------------------------------------------------------===//
-
-def LLVM_MemoryEffectsAttr : LLVM_Attr<"MemoryEffects", "memory_effects"> {
-  let parameters = (ins "ModRefInfo":$other, "ModRefInfo":$argMem,
-      "ModRefInfo":$inaccessibleMem, "ModRefInfo":$errnoMem,
-      "ModRefInfo":$targetMem0, "ModRefInfo":$targetMem1);
-  let extraClassDeclaration = [{
-    bool isReadWrite();
-  }];
-  let builders = [
-    TypeBuilder<(ins "ArrayRef<ModRefInfo>":$memInfoArgs)>
-  ];
-  let assemblyFormat = "`<` struct(params) `>`";
-}
-
-//===----------------------------------------------------------------------===//
-// DenormalFPEnvAttr
-//===----------------------------------------------------------------------===//
-
-def LLVM_DenormalFPEnvAttr : LLVM_Attr<"DenormalFPEnv", "denormal_fpenv"> {
-  let parameters = (ins "DenormalModeKind":$default_output_mode,
-                        "DenormalModeKind":$default_input_mode,
-                        "DenormalModeKind":$float_output_mode,
-                        "DenormalModeKind":$float_input_mode);
-  let assemblyFormat = "`<` struct(params) `>`";
-}
-
-//===----------------------------------------------------------------------===//
-// AliasScopeDomainAttr
-//===----------------------------------------------------------------------===//
-
-def LLVM_AliasScopeDomainAttr : LLVM_Attr<"AliasScopeDomain",
-                                          "alias_scope_domain"> {
-  let parameters = (ins
-    "Attribute":$id,
-    OptionalParameter<"StringAttr">:$description
-  );
-
-  let builders = [
-    AttrBuilder<(ins CArg<"StringAttr", "{}">:$description), [{
-      return $_get($_ctxt, DistinctAttr::create(UnitAttr::get($_ctxt)), description);
-    }]>
-  ];
-
-  let summary = "LLVM dialect alias scope domain metadata";
-
-  let description = [{
-    Defines a domain that may be associated with an alias scope.
-
-    See the following link for more details:
-    https://llvm.org/docs/LangRef.html#noalias-and-alias-scope-metadata
-  }];
-
-  let assemblyFormat = "`<` struct(params) `>`";
-
-  // Generate mnemonic alias for the attribute.
-  let genMnemonicAlias = 1;
-}
-
-//===----------------------------------------------------------------------===//
-// AliasScopeAttr
-//===----------------------------------------------------------------------===//
-
-def LLVM_AliasScopeAttr : LLVM_Attr<"AliasScope", "alias_scope"> {
-  let parameters = (ins
-    "Attribute":$id,
-    "AliasScopeDomainAttr":$domain,
-    OptionalParameter<"StringAttr">:$description
-  );
-
-  let builders = [
-    AttrBuilderWithInferredContext<(ins
-      "AliasScopeDomainAttr":$domain,
-      CArg<"StringAttr", "{}">:$description
-    ), [{
-      MLIRContext *ctx = domain.getContext();
-      return $_get(ctx, DistinctAttr::create(UnitAttr::get(ctx)), domain, description);
-    }]>
-  ];
-
-  let description = [{
-    Defines an alias scope that can be attached to a memory-accessing operation.
-    Such scopes can be used in combination with `noalias` metadata to indicate
-    that sets of memory-affecting operations in one scope do not alias with
-    memory-affecting operations in another scope.
-
-    Example:
-    ```mlir
-    #domain = #llvm.alias_scope_domain<id = distinct[1]<>, description = "Optional domain description">
-    #scope1 = #llvm.alias_scope<id = distinct[2]<>, domain = #domain>
-    #scope2 = #llvm.alias_scope<id = distinct[3]<>, domain = #domain, description = "Optional scope description">
-    llvm.func @foo(%ptr1 : !llvm.ptr) {
-        %c0 = llvm.mlir.constant(0 : i32) : i32
-        %c4 = llvm.mlir.constant(4 : i32) : i32
-        %1 = llvm.ptrtoint %ptr1 : !llvm.ptr to i32
-        %2 = llvm.add %1, %c1 : i32
-        %ptr2 = llvm.inttoptr %2 : i32 to !llvm.ptr
-        llvm.store %c0, %ptr1 { alias_scopes = [#scope1], llvm.noalias = [#scope2] } : i32, !llvm.ptr
-        llvm.store %c4, %ptr2 { alias_scopes = [#scope2], llvm.noalias = [#scope1] } : i32, !llvm.ptr
-        llvm.return
-    }
-    ```
-
-    The first attribute can either be a DistinctAttr or a StringAttr.
-
-    See the following link for more details:
-    https://llvm.org/docs/LangRef.html#noalias-and-alias-scope-metadata
-  }];
-
-  let summary = "LLVM dialect alias scope";
-
-  let assemblyFormat = "`<` struct(params) `>`";
-
-  let genVerifyDecl = 1;
-
-  // Generate mnemonic alias for the attribute.
-  let genMnemonicAlias = 1;
-}
-
-def LLVM_AliasScopeArrayAttr
-    : TypedArrayAttrBase<LLVM_AliasScopeAttr,
-                         LLVM_AliasScopeAttr.summary # " array"> {
-  let constBuilderCall = ?;
-}
-
-//===----------------------------------------------------------------------===//
-// AccessGroupAttr
-//===----------------------------------------------------------------------===//
-
-def LLVM_AccessGroupAttr : LLVM_Attr<"AccessGroup", "access_group"> {
-
-  let parameters = (ins "DistinctAttr":$id);
-
-  let builders = [
-    AttrBuilder<(ins), [{
-      return $_get($_ctxt, DistinctAttr::create(UnitAttr::get($_ctxt)));
-    }]>
-  ];
-
-  let summary = "LLVM dialect access group metadata";
-
-  let description = [{
-    Defines an access group metadata that can be set on any instruction
-    that potentially accesses memory via the `AccessGroupOpInterface` or on
-    branch instructions in the loop latch block via the `parallelAccesses`
-    parameter of `LoopAnnotationAttr`.
-
-    See the following link for more details:
-    https://llvm.org/docs/LangRef.html#llvm-access-group-metadata
-  }];
-
-  let assemblyFormat = "`<` struct(params) `>`";
-
-  // Generate mnemonic alias for the attribute.
-  let genMnemonicAlias = 1;
-}
-
-def LLVM_AccessGroupArrayAttr
-    : TypedArrayAttrBase<LLVM_AccessGroupAttr,
-                         LLVM_AccessGroupAttr.summary # " array"> {
-  let constBuilderCall = ?;
-}
-
-//===----------------------------------------------------------------------===//
-// TBAARootAttr
-//===----------------------------------------------------------------------===//
-
-def LLVM_TBAARootAttr : LLVM_Attr<"TBAARoot", "tbaa_root", [], "TBAANodeAttr"> {
-  let parameters = (ins OptionalParameter<"StringAttr">:$id);
-
-  let summary = "LLVM dialect TBAA root metadata";
-  let description = [{
-    Defines a TBAA root node.
-
-    Example:
-    ```mlir
-    #cpp_root = #llvm.tbaa_root<identity = "Simple C/C++ TBAA">
-    #other_root = #llvm.tbaa_root
-    ```
-
-    See the following link for more details:
-    https://llvm.org/docs/LangRef.html#tbaa-metadata
-  }];
-
-  let assemblyFormat = "(`<` struct(params)^ `>`)?";
-
-  // Generate mnemonic alias for the attribute.
-  let genMnemonicAlias = 1;
-}
-
-//===----------------------------------------------------------------------===//
-// TBAATypeDescriptorAttr
-//===----------------------------------------------------------------------===//
-
-def LLVM_TBAAMemberAttr : LLVM_Attr<"TBAAMember", "tbaa_member"> {
-  let parameters = (ins
-    "TBAANodeAttr":$typeDesc,
-    "int64_t":$offset
-  );
-
-  let builders = [
-    AttrBuilderWithInferredContext<(ins "TBAANodeAttr":$typeDesc,
-                                        "int64_t":$offset), [{
-      return $_get(typeDesc.getContext(), typeDesc, offset);
-    }]>
-  ];
-
-  let assemblyFormat = "`<` params `>`";
-}
-
-def LLVM_TBAAMemberAttrArray : ArrayRefParameter<"TBAAMemberAttr"> {
-  let printer = [{
-    $_printer << '{';
-    llvm::interleaveComma($_self, $_printer, [&](TBAAMemberAttr attr) {
-        $_printer.printStrippedAttrOrType(attr);
-    });
-    $_printer << '}';
-  }];
-
-  let parser = [{
-    [&]() -> FailureOr<SmallVector<TBAAMemberAttr>> {
-        using Result = SmallVector<TBAAMemberAttr>;
-        if ($_parser.parseLBrace())
-            return failure();
-        FailureOr<Result> result = FieldParser<Result>::parse($_parser);
-        if (failed(result))
-            return failure();
-        if ($_parser.parseRBrace())
-            return failure();
-        return result;
-    }()
-  }];
-}
-
-def LLVM_TBAATypeDescriptorAttr : LLVM_Attr<"TBAATypeDescriptor",
-    "tbaa_type_desc", [], "TBAANodeAttr"> {
-  let parameters = (ins
-    StringRefParameter<>:$id,
-    LLVM_TBAAMemberAttrArray:$members
-  );
-
-  let summary = "LLVM dialect TBAA type metadata";
-
-  let description = [{
-    Defines a TBAA node describing a type.
-
-    Example:
-    ```mlir
-    #tbaa_root = #llvm.tbaa_root<identity = "Simple C/C++ TBAA">
-    #tbaa_type_desc1 = #llvm.tbaa_type_desc<id = "omnipotent char", members = {<#tbaa_root, 0>}>
-    #tbaa_type_desc2 = #llvm.tbaa_type_desc<id = "long long", members = {<#tbaa_root, 0>}>
-    #tbaa_type_desc3 = #llvm.tbaa_type_desc<id = "agg2_t", members = {<#tbaa_type_desc2, 0>, <#tbaa_type_desc2, 8>}>
-    #tbaa_type_desc4 = #llvm.tbaa_type_desc<id = "int", members = {<#tbaa_type_desc1, 0>}>
-    #tbaa_type_desc5 = #llvm.tbaa_type_desc<id = "agg1_t", members = {<#tbaa_type_desc4, 0>, <#tbaa_type_desc4, 4>}>
-    ```
-
-    See the following link for more details:
-    https://llvm.org/docs/LangRef.html#tbaa-metadata
-  }];
-
-  let assemblyFormat = "`<` struct(params) `>`";
-
-  // Generate mnemonic alias for the attribute.
-  let genMnemonicAlias = 1;
-}
-
-//===----------------------------------------------------------------------===//
-// TBAATagAttr
-//===----------------------------------------------------------------------===//
-
-def LLVM_TBAATagAttr : LLVM_Attr<"TBAATag", "tbaa_tag"> {
-  let parameters = (ins
-    "TBAATypeDescriptorAttr":$base_type,
-    "TBAATypeDescriptorAttr":$access_type,
-    "int64_t":$offset,
-    DefaultValuedParameter<"bool", "false">:$constant
-  );
-
-  let builders = [
-    AttrBuilderWithInferredContext<(ins "TBAATypeDescriptorAttr":$baseType,
-                                        "TBAATypeDescriptorAttr":$accessType,
-                                        "int64_t":$offset), [{
-      return $_get(baseType.getContext(), baseType, accessType, offset,
-                    /*constant=*/false);
-    }]>
-  ];
-
-  let summary = "LLVM dialect TBAA tag metadata";
-
-  let description = [{
-    Defines a TBAA node describing a memory access.
-
-    Example:
-    ```mlir
-    #tbaa_root = #llvm.tbaa_root<identity = "Simple C/C++ TBAA">
-    #tbaa_type_desc1 = #llvm.tbaa_type_desc<id = "omnipotent char", members = {<#tbaa_root, 0>}>
-    #tbaa_type_desc2 = #llvm.tbaa_type_desc<id = "int", members = {<#tbaa_type_desc1, 0>}>
-    #tbaa_type_desc3 = #llvm.tbaa_type_desc<id = "agg1_t", members = {<#tbaa_type_desc4, 0>, <#tbaa_type_desc4, 4>}>
-    #tbaa_tag = #llvm.tbaa_tag<base_type = #tbaa_type_desc3, access_type = #tbaa_type_desc2, offset = 0, constant = true>
-    ```
-
-    See the following link for more details:
-    https://llvm.org/docs/LangRef.html#tbaa-metadata
-  }];
-
-  let assemblyFormat = "`<` struct(params) `>`";
-
-  // Generate mnemonic alias for the attribute.
-  let genMnemonicAlias = 1;
-}
-
-def LLVM_TBAATagArrayAttr
-    : TypedArrayAttrBase<LLVM_TBAATagAttr,
-                         LLVM_TBAATagAttr.summary # " array"> {
-  let constBuilderCall = ?;
-}
-
-//===----------------------------------------------------------------------===//
-// MMRATagAttr
-//===----------------------------------------------------------------------===//
-
-def LLVM_MMRATagAttr : LLVM_Attr<"MMRATag", "mmra_tag"> {
-  let parameters = (ins
-    StringRefParameter<>:$prefix,
-    StringRefParameter<>:$suffix
-  );
-
-  let summary = "MLIR wrapper around a prefix:suffix MMRA tag";
-
-  let description = [{
-    Defines a single memory model relaxation annotation (MMRA) entry
-    with prefix `$prefix` and suffix `$suffix`. This corresponds directly
-    to a LLVM `!{prefix, suffix}` metadata tuple, which is often written
-    `prefix:shuffix` as shorthand.
-
-    Example:
-    ```mlir
-    #mmra_tag = #llvm.mmmra_tag<"amdgpu-synchronize-as":"local">
-    #mmra_tag1 = #llvm.mmra_tag<"foo":"bar">
-    ```
-
-    Either one MMRA tag or an array of them may be added to any LLVM
-    operation that operates on memory.
-
-    ```mlir
-    %v = llvm.load %ptr {llvm.mmra = #mmra_tag} : !llvm.ptr -> i8
-    llvm.store %v, %ptr2 {llvm.mmra [#mmra_tag, #mmra_tag1]} : i8, !llvm.ptr
-    ```
-
-    See the following link for more details:
-    https://llvm.org/docs/MemoryModelRelaxationAnnotations.html
-  }];
-
-  let assemblyFormat = "`<` $prefix `` `:` `` $suffix `>`";
-
-  let genMnemonicAlias = 1;
-}
-
-//===----------------------------------------------------------------------===//
-// ConstantRangeAttr
-//===----------------------------------------------------------------------===//
-def LLVM_ConstantRangeAttr : LLVM_Attr<"ConstantRange", "constant_range"> {
-  let parameters = (ins
-    APIntParameter<"">:$lower,
-    APIntParameter<"">:$upper
-  );
-  let summary = "A range of two integers, corresponding to LLVM's ConstantRange";
-  let description = [{
-    A pair of two integers, mapping to the ConstantRange structure in LLVM IR,
-    which is allowed to wrap or be empty.
-
-    The range represented is [Lower, Upper), and is either signed or unsigned
-    depending on context.
-
-    `lower` and `upper` must have the same width.
-
-    Syntax:
-    ```
-    `<` `i`(width($lower)) $lower `,` $upper `>`
-    ```
-  }];
-
-  let builders = [
-    AttrBuilder<(ins "uint32_t":$bitWidth, "int64_t":$lower, "int64_t":$upper), [{
-      return $_get($_ctxt, ::llvm::APInt(bitWidth, lower), ::llvm::APInt(bitWidth, upper));
-    }]>
-  ];
-
-  let hasCustomAssemblyFormat = 1;
-  let genVerifyDecl = 1;
-}
-
-
-//===----------------------------------------------------------------------===//
-// VScaleRangeAttr
-//===----------------------------------------------------------------------===//
-
-def LLVM_VScaleRangeAttr : LLVM_Attr<"VScaleRange", "vscale_range"> {
-  let parameters =  (ins
-    "IntegerAttr":$minRange,
-    "IntegerAttr":$maxRange);
-  let assemblyFormat = "`<` struct(params) `>`";
-}
-
-//===----------------------------------------------------------------------===//
-// TargetFeaturesAttr
-//===----------------------------------------------------------------------===//
-
-def LLVM_TargetFeaturesAttr : LLVM_Attr<"TargetFeatures", "target_features",
-                                        [DLTIQueryInterface]>
-{
-  let summary = "LLVM target features attribute";
-
-  let description = [{
-    Represents the LLVM target features as a list that can be checked within
-    passes/rewrites.
-
-    Example:
-    ```mlir
-    #llvm.target_features<["+sme", "+sve", "+sme-f64f64"]>
-    ```
-
-    Then within a pass or rewrite the features active at an op can be queried:
-
-    ```c++
-    auto targetFeatures = LLVM::TargetFeaturesAttr::featuresAt(op);
-
-    if (!targetFeatures.contains("+sme-f64f64"))
-      return failure();
-    ```
-  }];
-
-  let parameters = (ins OptionalArrayRefParameter<"StringAttr">:$features);
-
-  let builders = [
-    TypeBuilder<(ins "::llvm::StringRef":$features)>,
-    TypeBuilder<(ins "::llvm::ArrayRef<::llvm::StringRef>":$features)>
-  ];
-
-  let extraClassDeclaration = [{
-    /// Checks if a feature is contained within the features list.
-    /// Note: Using a StringAttr allows doing pointer-comparisons.
-    bool contains(::mlir::StringAttr feature) const;
-    bool contains(::llvm::StringRef feature) const;
-
-    bool nullOrEmpty() const {
-      // Checks if this attribute is null, or the features are empty.
-      return !bool(*this) || getFeatures().empty();
-    }
-
-    /// Returns the list of features as an LLVM-compatible string.
-    std::string getFeaturesString() const;
-
-    /// Finds the target features on the parent FunctionOpInterface.
-    /// Note: This assumes the attribute name matches the return value of
-    /// `getAttributeName()`.
-    static TargetFeaturesAttr featuresAt(Operation* op);
-
-    /// Canonical name for this attribute within MLIR.
-    static constexpr StringLiteral getAttributeName() {
-      return StringLiteral("target_features");
-    }
-
-    /// Returns the attribute associated with the key.
-    FailureOr<Attribute> query(DataLayoutEntryKey key);
-  }];
-
-  let assemblyFormat = "`<` `[` (`]`) : ($features^ `]`)? `>`";
-  let genVerifyDecl = 1;
-}
-
-//===----------------------------------------------------------------------===//
-// TargetAttr
-//===----------------------------------------------------------------------===//
-
-def LLVM_TargetAttr : LLVM_Attr<"Target", "target",
-                                [LLVM_TargetAttrInterface]> {
-  let summary = "LLVM target info: triple, chip, features";
-  let description = [{
-    An attribute to hold LLVM target information, specifying LLVM's target
-    `triple` string, the target `chip` string (i.e. the `cpu` string), and
-    target `features` string as an attribute. The latter is optional.
-
-    Responds to DLTI-queries on the keys:
-      * A query for `"triple"` returns the `StringAttr` for the `triple`.
-      * A query for `"chip"` returns the `StringAttr` for the `chip`/`cpu`.
-      * A query for `"features"` returns the `StringAttr`, if provided.
-  }];
-  let parameters = (ins "StringAttr":$triple,
-                        "StringAttr":$chip,
-                        OptionalParameter<"TargetFeaturesAttr", "">:$features);
-
-  let assemblyFormat = [{`<` struct($triple, $chip, $features) `>`}];
-
-  let extraClassDeclaration = [{
-    FailureOr<Attribute> query(DataLayoutEntryKey key);
-  }];
-}
-
-//===----------------------------------------------------------------------===//
-// UndefAttr
-//===----------------------------------------------------------------------===//
-
-/// Folded into from LLVM::UndefOp.
-def LLVM_UndefAttr : LLVM_Attr<"Undef", "undef">;
-
-//===----------------------------------------------------------------------===//
-// PoisonAttr
-//===----------------------------------------------------------------------===//
-
-/// Folded into from LLVM::PoisonOp.
-def LLVM_PoisonAttr : LLVM_Attr<"Poison", "poison">;
-
-//===----------------------------------------------------------------------===//
-// DSOLocalEquivalentAttr
-//===----------------------------------------------------------------------===//
-
-/// Folded into from LLVM::DSOLocalEquivalentOp.
-def LLVM_DSOLocalEquivalentAttr : LLVM_Attr<"DSOLocalEquivalent",
-                                            "dso_local_equivalent"> {
-  let parameters = (ins "FlatSymbolRefAttr":$sym);
-  let assemblyFormat = "$sym";
-}
-
-//===----------------------------------------------------------------------===//
-// BlockAddressAttr
-//===----------------------------------------------------------------------===//
-
-def LLVM_BlockTagAttr : LLVM_Attr<"BlockTag", "blocktag"> {
-  let parameters = (ins "uint32_t":$id);
-  let assemblyFormat = "`<` struct(params) `>`";
-}
-
-/// Folded into from LLVM_BlockAddressAttr.
-def LLVM_BlockAddressAttr : LLVM_Attr<"BlockAddress", "blockaddress"> {
-  let description = [{
-    Describes a block address identified by a pair of `$function` and `$tag`.
-  }];
-  let parameters = (ins "FlatSymbolRefAttr":$function,
-                        "BlockTagAttr":$tag);
-  let assemblyFormat = "`<` struct(params) `>`";
-}
-
-//===----------------------------------------------------------------------===//
-// VecTypeHintAttr
-//===----------------------------------------------------------------------===//
-
-def LLVM_VecTypeHintAttr : LLVM_Attr<"VecTypeHint", "vec_type_hint"> {
-  let summary = "Explicit vectorization compiler hint";
-  let description = [{
-    A hint to the compiler that indicates most operations used in the function
-    are explictly vectorized using a particular vector type. `$hint` is the
-    vector or scalar type in particular. `$is_signed` can be used with integer
-    types to state whether the type is signed.
-  }];
-  let parameters = (ins "TypeAttr":$hint,
-                        DefaultValuedParameter<"bool", "false">:$is_signed);
-  let assemblyFormat = "`<` struct(params) `>`";
-}
-
-//===----------------------------------------------------------------------===//
-// ZeroAttr
-//===----------------------------------------------------------------------===//
-
-/// Folded into from LLVM::ZeroOp.
-def LLVM_ZeroAttr : LLVM_Attr<"Zero", "zero">;
-
-//===----------------------------------------------------------------------===//
-// TailCallKindAttr
-//===----------------------------------------------------------------------===//
-
-def TailCallKindAttr : LLVM_Attr<"TailCallKind", "tailcallkind"> {
-  let parameters = (ins "TailCallKind":$tailCallKind);
-  let assemblyFormat = "`<` $tailCallKind `>`";
-}
-
-//===----------------------------------------------------------------------===//
-// WorkgroupAttributionAttr
-//===----------------------------------------------------------------------===//
-
-def WorkgroupAttributionAttr
-    : LLVM_Attr<"WorkgroupAttribution", "mlir.workgroup_attribution"> {
-  let summary = "GPU workgroup attribution information";
-  let description = [{
-    GPU workgroup attributions are `gpu.func` attributes encoding memory
-    allocations in the workgroup address space. These might be encoded as
-    `llvm.ptr` function arguments in our dialect, but then type and size
-    information would be dropped. This attribute can be attached to `llvm.ptr`
-    function arguments encoding GPU workgroup attributions to mark them as
-    arguments encoding workgroup attributions and keeping type and size
-    information in our dialect.
-  }];
-  let parameters = (ins "IntegerAttr":$num_elements,
-                        "TypeAttr":$element_type);
-  let assemblyFormat = "`<` $num_elements `,` $element_type `>`";
-}
-
-//===----------------------------------------------------------------------===//
-// DereferenceableAttr
-//===----------------------------------------------------------------------===//
-
-def LLVM_DereferenceableAttr : LLVM_Attr<"Dereferenceable", "dereferenceable"> {
-  let summary = "LLVM dereferenceable attribute";
-  let description = [{
-    Defines `dereferenceable` or `dereferenceable_or_null` metadata that can
-    be set via the `DereferenceableOpInterface` on an `inttoptr` operation or
-    on a `load` operation which loads a pointer. The attribute is used to
-    denote that the result of these operations is dereferenceable up to a
-    certain number of bytes, represented by `$bytes`. The optional `$mayBeNull`
-    parameter is set to true if the attribute defines `dereferenceable_or_null`
-    metadata.
-
-    See the following links for more details:
-    https://llvm.org/docs/LangRef.html#dereferenceable-metadata
-    https://llvm.org/docs/LangRef.html#dereferenceable-or-null-metadata
-  }];
-  let parameters = (ins "uint64_t":$bytes,
-                        DefaultValuedParameter<"bool", "false">:$mayBeNull);
-  let assemblyFormat = "`<` struct(params) `>`";
-}
-
-//===----------------------------------------------------------------------===//
-// ModuleFlagAttr & related
-//===----------------------------------------------------------------------===//
-
-def ModuleFlagAttr
-    : LLVM_Attr<"ModuleFlag", "mlir.module_flag",
-                [DeclareAttrInterfaceMethods<LLVM_ModuleFlagAttrInterface>]> {
-  let summary = "LLVM module flag metadata";
-  let description = [{
-    Represents a single entry of llvm.module.flags metadata
-    (llvm::Module::ModuleFlagEntry in LLVM). The first element is a behavior
-    flag described by `ModFlagBehaviorAttr`, the second is a string ID
-    and third is the value of the flag. Supported keys and values include:
-      - Arbitrary `key`s holding integer constants, integer-like dialect
-        attributes, strings, or non-empty string arrays.
-      - Domain specific keys (e.g "CG Profile"), holding lists of supported
-        module flag values (e.g. `llvm.cgprofile_entry`).
-
-    Example:
-    ```mlir
-      llvm.module_flags [
-          #llvm.mlir.module_flag<error, "wchar_size", 4>,
-          #llvm.mlir.module_flag<error, "probe-stack", "inline-asm">,
-          #llvm.mlir.module_flag<append, "CG Profile", [
-            #llvm.cgprofile_entry<from = @from, to = @to, count = 222>,
-            #llvm.cgprofile_entry<from = @from, to = @from, count = 222>,
-            #llvm.cgprofile_entry<from = @to, to = @from, count = 222>
-          ]
-      >]
-    ```
-  }];
-  let parameters = (ins "ModFlagBehavior":$behavior,
-                        "StringAttr":$key,
-                        "Attribute":$value);
-  let assemblyFormat = "`<` $behavior `,` $key `,` $value `>`";
-  let genVerifyDecl = 1;
-}
-
-def ModuleFlagCGProfileEntryAttr
-    : LLVM_Attr<"ModuleFlagCGProfileEntry", "cgprofile_entry"> {
-  let summary = "CG profile module flag entry";
-  let description = [{
-    Describes a single entry for a CG profile module flag. Example:
-    ```mlir
-      llvm.module_flags [
-        #llvm.mlir.module_flag<append, "CG Profile",
-          [#llvm.cgprofile_entry<from = @from, to = @to, count = 222>,
-           ...
-          ]>]
-    ```
-  }];
-  let parameters = (
-    ins OptionalParameter<"FlatSymbolRefAttr">:$from,
-        OptionalParameter<"FlatSymbolRefAttr">:$to,
-        "uint64_t":$count);
-
-  let assemblyFormat = "`<` struct(params) `>`";
-}
-
-def ModuleFlagProfileSummaryDetailedAttr
-    : LLVM_Attr<"ModuleFlagProfileSummaryDetailed", "profile_summary_detailed"> {
-  let summary = "ProfileSummary detailed information";
-  let description = [{
-    Contains detailed information pertinent to "ProfileSummary" attribute.
-    A `#llvm.profile_summary` may contain several of it.
-    ```mlir
-    llvm.module_flags [ ...
-        detailed_summary =
-        <cut_off = 10000, min_count = 86427, num_counts = 1>,
-        <cut_off = 100000, min_count = 86427, num_counts = 1>
-    ```
-  }];
-  let parameters = (ins "uint32_t":$cut_off,
-                        "uint64_t":$min_count,
-                        "uint32_t":$num_counts);
-  let assemblyFormat = "`<` struct(params) `>`";
-}
-
-def ModuleFlagProfileSummaryAttr
-    : LLVM_Attr<"ModuleFlagProfileSummary", "profile_summary"> {
-  let summary = "ProfileSummary module flag";
-  let description = [{
-    Describes ProfileSummary gathered data in a module. Example:
-    ```mlir
-    llvm.module_flags [#llvm.mlir.module_flag<error, "ProfileSummary",
-      #llvm.profile_summary<format = InstrProf, total_count = 263646, max_count = 86427,
-        max_internal_count = 86427, max_function_count = 4691,
-        num_counts = 3712, num_functions = 796,
-        is_partial_profile = 0,
-        partial_profile_ratio = 0.000000e+00 : f64,
-        detailed_summary =
-          <cut_off = 10000, min_count = 86427, num_counts = 1>,
-          <cut_off = 100000, min_count = 86427, num_counts = 1>
-    >>]
-    ```
-  }];
-  let parameters = (ins "ProfileSummaryFormatKind":$format,
-    "uint64_t":$total_count, "uint64_t":$max_count,
-    "uint64_t":$max_internal_count, "uint64_t":$max_function_count,
-    "uint64_t":$num_counts, "uint64_t":$num_functions,
-    OptionalParameter<"std::optional<uint64_t>">:$is_partial_profile,
-    OptionalParameter<"FloatAttr">:$partial_profile_ratio,
-    ArrayRefParameter<"ModuleFlagProfileSummaryDetailedAttr">:$detailed_summary);
-
-  let assemblyFormat = "`<` struct(params) `>`";
-}
-
-//===----------------------------------------------------------------------===//
-// LLVM_DependentLibrariesAttr
-//===----------------------------------------------------------------------===//
-
-def LLVM_DependentLibrariesAttr
-    : LLVM_Attr<"DependentLibraries", "dependent_libraries"> {
-  let summary = "LLVM dependent libraries attribute";
-  let description = [{
-    Represents the list of dependent libraries for the current module.
-    This attribute is used to specify the libraries that the module depends
-    on, and it can be used for linking purposes.
-
-    See the following links for more details:
-    https://llvm.org/docs/LangRef.html#dependent-libs-named-metadata
-  }];
-  let parameters = (ins OptionalArrayRefParameter<"StringAttr">:$libs);
-  let assemblyFormat = "`<` $libs `>`";
-}
-
-//===----------------------------------------------------------------------===//
-// UWTableKindAttr
-//===----------------------------------------------------------------------===//
-
-def UWTableKindAttr : LLVM_Attr<"UWTableKind", "uwtableKind"> {
-  let parameters = (ins "uwtable::UWTableKind":$uwtableKind);
-  let assemblyFormat = "`<` $uwtableKind `>`";
-}
-
-//===----------------------------------------------------------------------===//
-// Metadata Attributes
-//===----------------------------------------------------------------------===//
-//
-// These attributes model LLVM IR metadata nodes (llvm::Metadata and its
-// subclasses). They can be nested to form arbitrary metadata trees and are
-// translated to their LLVM IR counterparts during MLIR-to-LLVM-IR conversion.
-
-def LLVM_MDStringAttr : LLVM_Attr<"MDString", "md_string"> {
-  let summary = "LLVM metadata string";
-  let description = [{
-    Wraps a string as an LLVM metadata node, corresponding to
-    `llvm::MDString` in LLVM IR.
-
-    Example:
-    ```mlir
-    #llvm.md_string<"foo.buffer">
-    ```
-  }];
-  let parameters = (ins "StringAttr":$value);
-  let assemblyFormat = "`<` $value `>`";
-}
-
-def LLVM_MDConstantAttr : LLVM_Attr<"MDConstant", "md_const"> {
-  let summary = "LLVM constant-as-metadata";
-  let description = [{
-    Wraps an attribute as an LLVM metadata node, corresponding to
-    `llvm::ConstantAsMetadata` wrapping a `llvm::Constant*` in LLVM IR.
-    Currently, only integers/IntegerAttrs supported.
-
-    Example:
-    ```mlir
-    #llvm.md_const<42 : i32>
-    ```
-  }];
-  let parameters = (ins "Attribute":$value);
-  let assemblyFormat = "`<` $value `>`";
-}
-
-def LLVM_MDGlobalValueAttr : LLVM_Attr<"MDGlobalValue", "md_global_value"> {
-  let summary = "LLVM global value-as-metadata";
-  let description = [{
-    References a symbol-backed global value as LLVM metadata, corresponding to
-    `llvm::ValueAsMetadata::get(value)` in LLVM IR.
-
-    Example:
-    ```mlir
-    #llvm.md_global_value<@my_kernel>
-    ```
-  }];
-  let parameters = (ins "FlatSymbolRefAttr":$name);
-  let assemblyFormat = "`<` $name `>`";
-}
-
-def LLVM_MDNodeAttr : LLVM_Attr<"MDNode", "md_node"> {
-  let summary = "LLVM metadata node";
-  let description = [{
-    Represents an LLVM metadata node. The operands
-    can be any combination of metadata attributes: `#llvm.md_string`,
-    `#llvm.md_const`, `#llvm.md_global_value`, or nested `#llvm.md_node`.
-
-    Example:
-    ```mlir
-    #llvm.md_node<#llvm.md_const<0 : i32>, #llvm.md_string<"foo.buffer">>
-    #llvm.md_node<>
-    ```
-  }];
-  let parameters = (ins OptionalArrayRefParameter<"Attribute">:$operands);
-  let assemblyFormat = "`<` (`>`) : ($operands^ `>`)?";
-}
-
-def LLVM_MDNodeArrayAttr
-    : TypedArrayAttrBase<LLVM_MDNodeAttr,
-                         "array of #llvm.md_node attributes">;
-
-def LLVM_AnyMDAttr : AnyAttrOf<[
-    LLVM_MDStringAttr, LLVM_MDConstantAttr, LLVM_MDGlobalValueAttr,
-    LLVM_MDNodeAttr],
-    "LLVM metadata attribute (md_string, md_const, md_global_value, or md_node)">;
-
-#endif // LLVMIR_ATTRDEFS
diff --git a/mlir/include/mlir/Dialect/LLVMIR/LLVMDialectBytecode.td b/mlir/include/mlir/Dialect/LLVMIR/LLVMDialectBytecode.td
index b25a8c8a9829e..e69de29bb2d1d 100644
--- a/mlir/include/mlir/Dialect/LLVMIR/LLVMDialectBytecode.td
+++ b/mlir/include/mlir/Dialect/LLVMIR/LLVMDialectBytecode.td
@@ -1,363 +0,0 @@
-//===-- LLVMDialectBytecode.td - LLVM bytecode defs --------*- tablegen -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-//
-// This is the LLVM bytecode reader/writer definition file.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_DIALECT_BYTECODE
-#define LLVM_DIALECT_BYTECODE
-
-include "mlir/IR/BytecodeBase.td"
-
-//===----------------------------------------------------------------------===//
-// Bytecode classes for attributes and types.
-//===----------------------------------------------------------------------===//
-
-def String :
-  WithParser <"succeeded($_reader.readString($_var))",
-  WithBuilder<"$_args",
-  WithPrinter<"$_writer.writeOwnedString($_getter)",
-  WithType   <"StringRef">>>>;
-
-class Attr<string type> : WithType<type, Attribute>;
-
-class OptionalAttribute<string type> :
-  WithParser <"succeeded($_reader.readOptionalAttribute($_var))",
-  WithPrinter<"$_writer.writeOptionalAttribute($_getter)",
-  WithType<type, Attribute>>>;
-
-class OptionalInt<string type> :
-  WithParser <"succeeded(readOptionalInt($_reader, $_var))",
-  WithPrinter<"writeOptionalInt($_writer, $_getter)",
-  WithType<"std::optional<" # type # ">", VarInt>>>;
-
-class OptionalArrayRef<string eltType> :
-  WithParser <"succeeded(readOptionalArrayRef<"
-    # eltType # ">($_reader, $_var))",
-  WithPrinter<"writeOptionalArrayRef<"
-    # eltType # ">($_writer, $_getter)",
-  WithType<"SmallVector<"
-    # eltType # ">", Attribute>>>;
-
-class EnumClassFlag<string flag, string getter> :
-    WithParser<"succeeded($_reader.readVarInt($_var))",
-    WithBuilder<"(" # flag # ")$_args",
-    WithPrinter<"$_writer.writeVarInt((uint64_t)$_name." # getter # ")",
-    WithType<"uint64_t", VarInt>>>>;
-
-//===----------------------------------------------------------------------===//
-// General notes
-// - For each attribute or type entry, the argument names should match
-//   LLVMAttrDefs.td
-// - The mnemonics are either LLVM or builtin MLIR attributes and types, but
-//   regular C++ types are also allowed to match builders and parsers.
-// - DIScopeAttr and DINodeAttr are empty base classes, custom encoding not
-//   needed.
-//===----------------------------------------------------------------------===//
-
-//===----------------------------------------------------------------------===//
-// DIBasicTypeAttr
-//===----------------------------------------------------------------------===//
-
-def DIBasicTypeAttr : DialectAttribute<(attr
-  VarInt:$tag,
-  String:$name,
-  VarInt:$sizeInBits,
-  VarInt:$encoding
-)>;
-
-//===----------------------------------------------------------------------===//
-// DIExpressionAttr, DIExpressionElemAttr
-//===----------------------------------------------------------------------===//
-
-def DIExpressionElemAttr : DialectAttribute<(attr
-  VarInt:$opcode,
-  OptionalArrayRef<"uint64_t">:$arguments
-)>;
-
-def DIExpressionAttr : DialectAttribute<(attr
-  OptionalArrayRef<"DIExpressionElemAttr">:$operations
-)>;
-
-//===----------------------------------------------------------------------===//
-// DIFileAttr
-//===----------------------------------------------------------------------===//
-
-def DIFileAttr : DialectAttribute<(attr
-  String:$name,
-  String:$directory
-)>;
-
-//===----------------------------------------------------------------------===//
-// DILocalVariableAttr
-//===----------------------------------------------------------------------===//
-
-def DILocalVariableAttr : DialectAttribute<(attr
-  Attr<"DIScopeAttr">:$scope,
-  OptionalAttribute<"StringAttr">:$name,
-  OptionalAttribute<"DIFileAttr">:$file,
-  VarInt:$line,
-  VarInt:$arg,
-  VarInt:$alignInBits,
-  OptionalAttribute<"DITypeAttr">:$type,
-  EnumClassFlag<"DIFlags", "getFlags()">:$_rawflags,
-  LocalVar<"DIFlags", "(DIFlags)_rawflags">:$flags
-)> {
-  // DILocalVariableAttr direct getter uses a `StringRef` for `name`. Since the
-  // more direct getter is prefered during bytecode reading, force the base one
-  // and prevent crashes for empty `StringAttr`.
-  let cBuilder = "$_resultType::get(context, $_args)";
-}
-
-//===----------------------------------------------------------------------===//
-// DISubroutineTypeAttr
-//===----------------------------------------------------------------------===//
-
-def DISubroutineTypeAttr : DialectAttribute<(attr
-  VarInt:$callingConvention,
-  OptionalArrayRef<"DITypeAttr">:$types
-)>;
-
-//===----------------------------------------------------------------------===//
-// DICompileUnitAttr
-//===----------------------------------------------------------------------===//
-
-def DICompileUnitAttr : DialectAttribute<(attr
-  OptionalAttribute<"DistinctAttr">:$recId,
-  Bool:$isRecSelf,
-  OptionalAttribute<"DistinctAttr">:$id,
-  VarInt:$sourceLanguage,
-  OptionalAttribute<"DIFileAttr">:$file,
-  OptionalAttribute<"StringAttr">:$producer,
-  Bool:$isOptimized,
-  EnumClassFlag<"DIEmissionKind", "getEmissionKind()">:$_rawEmissionKind,
-  LocalVar<"DIEmissionKind", "(DIEmissionKind)_rawEmissionKind">:$emissionKind,
-  Bool:$isDebugInfoForProfiling,
-  EnumClassFlag<"DINameTableKind", "getNameTableKind()">:$_rawNameTableKind,
-  LocalVar<"DINameTableKind",
-           "(DINameTableKind)_rawNameTableKind">:$nameTableKind,
-  OptionalAttribute<"StringAttr">:$splitDebugFilename,
-  OptionalArrayRef<"DINodeAttr">:$importedEntities
-)>;
-
-//===----------------------------------------------------------------------===//
-// DISubprogramAttr
-//===----------------------------------------------------------------------===//
-
-def DISubprogramAttr
-    : DialectAttribute<(attr OptionalAttribute<"DistinctAttr">:$recId,
-          Bool:$isRecSelf, OptionalAttribute<"DistinctAttr">:$id,
-          OptionalAttribute<"DICompileUnitAttr">:$compileUnit,
-          OptionalAttribute<"DIScopeAttr">:$scope,
-          OptionalAttribute<"StringAttr">:$name,
-          OptionalAttribute<"StringAttr">:$linkageName,
-          OptionalAttribute<"DIFileAttr">:$file, VarInt:$line,
-          VarInt:$scopeLine,
-          EnumClassFlag<"DISubprogramFlags", "getSubprogramFlags()">:$_rawflags,
-          LocalVar<"DISubprogramFlags",
-                   "(DISubprogramFlags)_rawflags">:$subprogramFlags,
-          OptionalAttribute<"DISubroutineTypeAttr">:$type,
-          OptionalArrayRef<"Attribute">:$retainedNodes,
-          OptionalArrayRef<"DINodeAttr">:$annotations)>;
-
-//===----------------------------------------------------------------------===//
-// DICompositeTypeAttr
-//===----------------------------------------------------------------------===//
-
-def DICompositeTypeAttr : DialectAttribute<(attr
-  OptionalAttribute<"DistinctAttr">:$recId,
-  Bool:$isRecSelf,
-  VarInt:$tag,
-  OptionalAttribute<"StringAttr">:$name,
-  OptionalAttribute<"DIFileAttr">:$file,
-  VarInt:$line,
-  OptionalAttribute<"DIScopeAttr">:$scope,
-  OptionalAttribute<"DITypeAttr">:$baseType,
-  EnumClassFlag<"DIFlags", "getFlags()">:$_rawflags,
-  LocalVar<"DIFlags", "(DIFlags)_rawflags">:$flags,
-  VarInt:$sizeInBits,
-  VarInt:$alignInBits,
-  OptionalAttribute<"DIExpressionAttr">:$dataLocation,
-  OptionalAttribute<"DIExpressionAttr">:$rank,
-  OptionalAttribute<"DIExpressionAttr">:$allocated,
-  OptionalAttribute<"DIExpressionAttr">:$associated,
-  OptionalAttribute<"StringAttr">:$identifier,
-  OptionalAttribute<"DIDerivedTypeAttr">:$discriminator,
-  OptionalArrayRef<"DINodeAttr">:$elements
-)>;
-
-//===----------------------------------------------------------------------===//
-// DIDerivedTypeAttr
-//===----------------------------------------------------------------------===//
-
-def DIDerivedTypeAttr : DialectAttribute<(attr
-  VarInt:$tag,
-  OptionalAttribute<"StringAttr">:$name,
-  OptionalAttribute<"DIFileAttr">:$file,
-  VarInt:$line,
-  OptionalAttribute<"DIScopeAttr">:$scope,
-  OptionalAttribute<"DITypeAttr">:$baseType,
-  VarInt:$sizeInBits,
-  VarInt:$alignInBits,
-  VarInt:$offsetInBits,
-  OptionalInt<"unsigned">:$dwarfAddressSpace,
-  EnumClassFlag<"DIFlags", "getFlags()">:$_rawflags,
-  LocalVar<"DIFlags", "(DIFlags)_rawflags">:$flags,
-  OptionalAttribute<"Attribute">:$extraData
-)>;
-
-//===----------------------------------------------------------------------===//
-// DIImportedEntityAttr
-//===----------------------------------------------------------------------===//
-
-def DIImportedEntityAttr : DialectAttribute<(attr
-  VarInt:$tag,
-  Attr<"DIScopeAttr">:$scope,
-  Attr<"DINodeAttr">:$entity,
-  OptionalAttribute<"DIFileAttr">:$file,
-  VarInt:$line,
-  OptionalAttribute<"StringAttr">:$name,
-  OptionalArrayRef<"DINodeAttr">:$elements
-)>;
-
-//===----------------------------------------------------------------------===//
-// DIGlobalVariableAttr, DIGlobalVariableExpressionAttr
-//===----------------------------------------------------------------------===//
-
-def DIGlobalVariableAttr : DialectAttribute<(attr
-  OptionalAttribute<"DIScopeAttr">:$scope,
-  OptionalAttribute<"StringAttr">:$name,
-  OptionalAttribute<"StringAttr">:$linkageName,
-  Attr<"DIFileAttr">:$file,
-  VarInt:$line,
-  Attr<"DITypeAttr">:$type,
-  Bool:$isLocalToUnit,
-  Bool:$isDefined,
-  VarInt:$alignInBits
-)>;
-
-def DIGlobalVariableExpressionAttr : DialectAttribute<(attr
-  Attr<"DIGlobalVariableAttr">:$var,
-  OptionalAttribute<"DIExpressionAttr">:$expr
-)>;
-
-//===----------------------------------------------------------------------===//
-// DILabelAttr
-//===----------------------------------------------------------------------===//
-
-def DILabelAttr : DialectAttribute<(attr
-  Attr<"DIScopeAttr">:$scope,
-  OptionalAttribute<"StringAttr">:$name,
-  OptionalAttribute<"DIFileAttr">:$file,
-  VarInt:$line
-)> {
-  // DILabelAttr direct getter uses a `StringRef` for `name`. Since the
-  // more direct getter is prefered during bytecode reading, force the base one
-  // and prevent crashes for empty `StringAttr`.
-  let cBuilder = "$_resultType::get(context, $_args)";
-}
-
-//===----------------------------------------------------------------------===//
-// DILexicalBlockAttr, DILexicalBlockFileAttr
-//===----------------------------------------------------------------------===//
-
-def DILexicalBlockAttr : DialectAttribute<(attr
-  Attr<"DIScopeAttr">:$scope,
-  OptionalAttribute<"DIFileAttr">:$file,
-  VarInt:$line,
-  VarInt:$column
-)>;
-
-def DILexicalBlockFileAttr : DialectAttribute<(attr
-  Attr<"DIScopeAttr">:$scope,
-  OptionalAttribute<"DIFileAttr">:$file,
-  VarInt:$discriminator
-)>;
-
-//===----------------------------------------------------------------------===//
-// DINamespaceAttr
-//===----------------------------------------------------------------------===//
-
-def DINamespaceAttr : DialectAttribute<(attr
-  OptionalAttribute<"StringAttr">:$name,
-  OptionalAttribute<"DIScopeAttr">:$scope,
-  Bool:$exportSymbols
-)>;
-
-//===----------------------------------------------------------------------===//
-// DISubrangeAttr
-//===----------------------------------------------------------------------===//
-
-def DISubrangeAttr : DialectAttribute<(attr
-  OptionalAttribute<"Attribute">:$count,
-  OptionalAttribute<"Attribute">:$lowerBound,
-  OptionalAttribute<"Attribute">:$upperBound,
-  OptionalAttribute<"Attribute">:$stride
-)>;
-
-//===----------------------------------------------------------------------===//
-// LoopAnnotationAttr
-//===----------------------------------------------------------------------===//
-
-def LoopAnnotationAttr : DialectAttribute<(attr
-  OptionalAttribute<"BoolAttr">:$disableNonforced,
-  OptionalAttribute<"LoopVectorizeAttr">:$vectorize,
-  OptionalAttribute<"LoopInterleaveAttr">:$interleave,
-  OptionalAttribute<"LoopUnrollAttr">:$unroll,
-  OptionalAttribute<"LoopUnrollAndJamAttr">:$unrollAndJam,
-  OptionalAttribute<"LoopLICMAttr">:$licm,
-  OptionalAttribute<"LoopDistributeAttr">:$distribute,
-  OptionalAttribute<"LoopPipelineAttr">:$pipeline,
-  OptionalAttribute<"LoopPeeledAttr">:$peeled,
-  OptionalAttribute<"LoopUnswitchAttr">:$unswitch,
-  OptionalAttribute<"BoolAttr">:$mustProgress,
-  OptionalAttribute<"BoolAttr">:$isVectorized,
-  OptionalAttribute<"FusedLoc">:$startLoc,
-  OptionalAttribute<"FusedLoc">:$endLoc,
-  OptionalArrayRef<"AccessGroupAttr">:$parallelAccesses
-)>;
-
-//===----------------------------------------------------------------------===//
-// Attributes & Types with custom bytecode handling.
-//===----------------------------------------------------------------------===//
-
-// All the attributes with custom bytecode handling.
-def LLVMDialectAttributes : DialectAttributes<"LLVM"> {
-  let elems = [
-    DIBasicTypeAttr,
-    DICompileUnitAttr,
-    DICompositeTypeAttr,
-    DIDerivedTypeAttr,
-    DIExpressionElemAttr,
-    DIExpressionAttr,
-    DIFileAttr,
-    DIGlobalVariableAttr,
-    DIGlobalVariableExpressionAttr,
-    DIImportedEntityAttr,
-    DILabelAttr,
-    DILexicalBlockAttr,
-    DILexicalBlockFileAttr,
-    DILocalVariableAttr,
-    DINamespaceAttr,
-    DISubprogramAttr,
-    DISubrangeAttr,
-    DISubroutineTypeAttr,
-    LoopAnnotationAttr
-    // Referenced attributes currently missing support:
-    // AccessGroupAttr, LoopVectorizeAttr, LoopInterleaveAttr, LoopUnrollAttr,
-    // LoopUnrollAndJamAttr, LoopLICMAttr, LoopDistributeAttr, LoopPipelineAttr,
-    // LoopPeeledAttr, LoopUnswitchAttr
-  ];
-}
-
-def LLVMDialectTypes : DialectTypes<"LLVM"> {
-  let elems = [];
-}
-
-#endif // LLVM_DIALECT_BYTECODE
diff --git a/mlir/lib/CAPI/Dialect/LLVM.cpp b/mlir/lib/CAPI/Dialect/LLVM.cpp
index bae811704cad3..0d937b253f2b5 100644
--- a/mlir/lib/CAPI/Dialect/LLVM.cpp
+++ b/mlir/lib/CAPI/Dialect/LLVM.cpp
@@ -356,11 +356,27 @@ MlirAttribute mlirLLVMDICompileUnitAttrGet(
     bool isDebugInfoForProfiling, MlirLLVMDINameTableKind nameTableKind,
     MlirAttribute splitDebugFilename, intptr_t nImportedEntities,
     MlirAttribute const *importedEntities) {
+  // sourceLanguageDialect 0 means no source-language dialect. LLVM textual IR
+  // spells this by omitting the `dialect:` field.
+  return mlirLLVMDICompileUnitAttrGetWithSourceLanguageDialect(
+      ctx, recId, isRecSelf, id, sourceLanguage,
+      /*sourceLanguageDialect=*/0, file, producer, isOptimized, emissionKind,
+      isDebugInfoForProfiling, nameTableKind, splitDebugFilename,
+      nImportedEntities, importedEntities);
+}
+
+MlirAttribute mlirLLVMDICompileUnitAttrGetWithSourceLanguageDialect(
+    MlirContext ctx, MlirAttribute recId, bool isRecSelf, MlirAttribute id,
+    unsigned int sourceLanguage, unsigned int sourceLanguageDialect,
+    MlirAttribute file, MlirAttribute producer, bool isOptimized,
+    MlirLLVMDIEmissionKind emissionKind, bool isDebugInfoForProfiling,
+    MlirLLVMDINameTableKind nameTableKind, MlirAttribute splitDebugFilename,
+    intptr_t nImportedEntities, MlirAttribute const *importedEntities) {
   SmallVector<Attribute> importsStorage;
   importsStorage.reserve(nImportedEntities);
   return wrap(DICompileUnitAttr::get(
       unwrap(ctx), cast<DistinctAttr>(unwrap(recId)), isRecSelf,
-      cast<DistinctAttr>(unwrap(id)), sourceLanguage,
+      cast<DistinctAttr>(unwrap(id)), sourceLanguage, sourceLanguageDialect,
       cast<DIFileAttr>(unwrap(file)), cast<StringAttr>(unwrap(producer)),
       isOptimized, DIEmissionKind(emissionKind), isDebugInfoForProfiling,
       DINameTableKind(nameTableKind),
diff --git a/mlir/lib/Dialect/LLVMIR/IR/LLVMAttrs.cpp b/mlir/lib/Dialect/LLVMIR/IR/LLVMAttrs.cpp
index 266faeca4553b..3b26aa2621370 100644
--- a/mlir/lib/Dialect/LLVMIR/IR/LLVMAttrs.cpp
+++ b/mlir/lib/Dialect/LLVMIR/IR/LLVMAttrs.cpp
@@ -352,17 +352,17 @@ DICompositeTypeAttr::getRecSelf(DistinctAttr recId) {
 DIRecursiveTypeAttrInterface DICompileUnitAttr::withRecId(DistinctAttr recId) {
   return DICompileUnitAttr::get(
       getContext(), recId, getIsRecSelf(), getId(), getSourceLanguage(),
-      getFile(), getProducer(), getIsOptimized(), getEmissionKind(),
-      getIsDebugInfoForProfiling(), getNameTableKind(), getSplitDebugFilename(),
-      getImportedEntities());
+      getSourceLanguageDialect(), getFile(), getProducer(), getIsOptimized(),
+      getEmissionKind(), getIsDebugInfoForProfiling(), getNameTableKind(),
+      getSplitDebugFilename(), getImportedEntities());
 }
 
 DIRecursiveTypeAttrInterface DICompileUnitAttr::getRecSelf(DistinctAttr recId) {
 
   return DICompileUnitAttr::get(
       recId.getContext(), recId, /*isRecSelf=*/true, /*id=*/{},
-      /*sourceLanguage=*/0u, /*file=*/{}, /*producer=*/{},
-      /*isOptimized=*/false, DIEmissionKind::None,
+      /*sourceLanguage=*/0u, /*sourceLanguageDialect=*/0u, /*file=*/{},
+      /*producer=*/{}, /*isOptimized=*/false, DIEmissionKind::None,
       /*isDebugInfoForProfiling=*/false, DINameTableKind::Default,
       /*splitDebugFilename=*/{}, /*importedEntities=*/{});
 }
diff --git a/mlir/lib/Target/LLVMIR/DebugImporter.cpp b/mlir/lib/Target/LLVMIR/DebugImporter.cpp
index 85df880d2712a..82beb2984b043 100644
--- a/mlir/lib/Target/LLVMIR/DebugImporter.cpp
+++ b/mlir/lib/Target/LLVMIR/DebugImporter.cpp
@@ -64,13 +64,14 @@ DICompileUnitAttr DebugImporter::translateImpl(llvm::DICompileUnit *node) {
               translate(static_cast<llvm::DINode *>(importedEntity)))
         imports.push_back(nodeAttr);
   }
+  llvm::DISourceLanguageName sourceLanguage = node->getSourceLanguage();
   return DICompileUnitAttr::get(
       context, /*recId=*/DistinctAttr{}, /*isRecSelf=*/false,
-      getOrCreateDistinctID(node),
-      node->getSourceLanguage().getUnversionedName(),
-      translate(node->getFile()), getStringAttrOrNull(node->getRawProducer()),
-      node->isOptimized(), emissionKind.value(),
-      node->isDebugInfoForProfiling(), nameTableKind.value(),
+      getOrCreateDistinctID(node), sourceLanguage.getUnversionedName(),
+      sourceLanguage.getDialect(), translate(node->getFile()),
+      getStringAttrOrNull(node->getRawProducer()), node->isOptimized(),
+      emissionKind.value(), node->isDebugInfoForProfiling(),
+      nameTableKind.value(),
       getStringAttrOrNull(node->getRawSplitDebugFilename()), imports);
 }
 
diff --git a/mlir/lib/Target/LLVMIR/DebugTranslation.cpp b/mlir/lib/Target/LLVMIR/DebugTranslation.cpp
index 442f5b6b137e6..4dc9e91b4e1c2 100644
--- a/mlir/lib/Target/LLVMIR/DebugTranslation.cpp
+++ b/mlir/lib/Target/LLVMIR/DebugTranslation.cpp
@@ -138,11 +138,18 @@ llvm::DIBasicType *DebugTranslation::translateImpl(DIBasicTypeAttr attr) {
       /*AlignInBits=*/0, attr.getEncoding(), llvm::DINode::FlagZero);
 }
 
+static llvm::DISourceLanguageName getSourceLanguage(DICompileUnitAttr attr) {
+  // DISourceLanguageName represents "no source-language dialect" as 0; the
+  // LLVM IR printer omits the `dialect:` field for that value.
+  return llvm::DISourceLanguageName(
+      static_cast<uint16_t>(attr.getSourceLanguage()),
+      static_cast<uint16_t>(attr.getSourceLanguageDialect()));
+}
+
 llvm::TempDICompileUnit
 DebugTranslation::translateTemporaryImpl(DICompileUnitAttr attr) {
   return llvm::DICompileUnit::getTemporary(
-      llvmCtx,
-      static_cast<llvm::DISourceLanguageName>(attr.getSourceLanguage()),
+      llvmCtx, getSourceLanguage(attr),
       /*File=*/nullptr, "", attr.getIsOptimized(),
       /*Flags=*/"", /*RuntimeVersion=*/0,
       /*splitDebugFileName=*/"",
@@ -166,7 +173,7 @@ llvm::DICompileUnit *DebugTranslation::translateImpl(DICompileUnitAttr attr) {
 
   llvm::DIBuilder builder(llvmModule);
   llvm::DICompileUnit *cu = builder.createCompileUnit(
-      attr.getSourceLanguage(), translate(attr.getFile()),
+      getSourceLanguage(attr), translate(attr.getFile()),
       attr.getProducer() ? attr.getProducer().getValue() : "",
       attr.getIsOptimized(),
       /*Flags=*/"", /*RV=*/0,
diff --git a/mlir/test/CAPI/llvm.c b/mlir/test/CAPI/llvm.c
index 7e0cf9fee1899..d449885be1566 100644
--- a/mlir/test/CAPI/llvm.c
+++ b/mlir/test/CAPI/llvm.c
@@ -276,12 +276,17 @@ static void testDebugInfoAttributes(MlirContext ctx) {
   // CHECK: #llvm.di_file<"foo" in "bar">
   mlirAttributeDump(file);
 
-  MlirAttribute compile_unit = mlirLLVMDICompileUnitAttrGet(
-      ctx, recId0, false, id, LLVMDWARFSourceLanguageC99, file, foo, false,
-      MlirLLVMDIEmissionKindFull, false, MlirLLVMDINameTableKindDefault, bar, 0,
-      NULL);
-
-  // CHECK: #llvm.di_compile_unit<{{.*}}>
+  // sourceLanguageDialect 1 is DW_LLVM_LANG_DIALECT_simt, as defined by
+  // LLVM's dwarf::LanguageDialectAttribute enum.
+  MlirAttribute compile_unit =
+      mlirLLVMDICompileUnitAttrGetWithSourceLanguageDialect(
+          ctx, recId0, false, id, LLVMDWARFSourceLanguageC99,
+          /*sourceLanguageDialect=*/1, file, foo, false,
+          MlirLLVMDIEmissionKindFull, false, MlirLLVMDINameTableKindDefault,
+          bar, 0, NULL);
+
+  // CHECK: #llvm.di_compile_unit<{{.*}}sourceLanguageDialect =
+  // DW_LLVM_LANG_DIALECT_simt{{.*}}>
   mlirAttributeDump(compile_unit);
 
   // CHECK: #llvm.di_compile_unit<recId = {{.*}}, isRecSelf = true>
diff --git a/mlir/test/Dialect/LLVMIR/bytecode.mlir b/mlir/test/Dialect/LLVMIR/bytecode.mlir
index b70ded784bc4b..02409c8adab94 100644
--- a/mlir/test/Dialect/LLVMIR/bytecode.mlir
+++ b/mlir/test/Dialect/LLVMIR/bytecode.mlir
@@ -24,7 +24,7 @@ module {
 #loc3 = loc("test-path":36:3)
 #loc4 = loc("test-path":37:5)
 #loc5 = loc("test-path":39:5)
-#di_compile_unit = #llvm.di_compile_unit<id = distinct[3]<>, sourceLanguage = DW_LANG_Fortran95, file = #di_file, isOptimized = false, emissionKind = Full>
+#di_compile_unit = #llvm.di_compile_unit<id = distinct[3]<>, sourceLanguage = DW_LANG_Fortran95, sourceLanguageDialect = DW_LLVM_LANG_DIALECT_tile, file = #di_file, isOptimized = false, emissionKind = Full>
 #di_compile_unit1 = #llvm.di_compile_unit<id = distinct[4]<>, sourceLanguage = DW_LANG_Fortran95, file = #di_file, isOptimized = false, emissionKind = Full>
 #di_compile_unit2 = #llvm.di_compile_unit<id = distinct[5]<>, sourceLanguage = DW_LANG_Fortran95, file = #di_file, isOptimized = false, emissionKind = Full>
 #di_module = #llvm.di_module<file = #di_file, scope = #di_compile_unit1, name = "mod1">
diff --git a/mlir/test/Dialect/LLVMIR/debuginfo.mlir b/mlir/test/Dialect/LLVMIR/debuginfo.mlir
index 21bcbcffbace7..020f3b3b0ee7a 100644
--- a/mlir/test/Dialect/LLVMIR/debuginfo.mlir
+++ b/mlir/test/Dialect/LLVMIR/debuginfo.mlir
@@ -5,11 +5,12 @@
 
 // CHECK-DAG: #[[NS:.*]] = #llvm.di_namespace<name = "cu_import_ns", exportSymbols = false>
 // CHECK-DAG: #[[IE:.*]] = #llvm.di_imported_entity<tag = DW_TAG_imported_module, scope = #[[FILE]], entity = #[[NS]], file = #[[FILE]]>
-// CHECK-DAG: #[[CU:.*]] = #llvm.di_compile_unit<id = distinct[0]<>, sourceLanguage = DW_LANG_C, file = #[[FILE]], producer = "MLIR", isOptimized = true, emissionKind = Full, isDebugInfoForProfiling = true, importedEntities = #[[IE]]>
+// CHECK-DAG: #[[CU:.*]] = #llvm.di_compile_unit<id = distinct[0]<>, sourceLanguage = DW_LANG_C, sourceLanguageDialect = DW_LLVM_LANG_DIALECT_simt, file = #[[FILE]], producer = "MLIR", isOptimized = true, emissionKind = Full, isDebugInfoForProfiling = true, importedEntities = #[[IE]]>
 #cu_import_ns = #llvm.di_namespace<name = "cu_import_ns", exportSymbols = false>
 #cu_import_ie = #llvm.di_imported_entity<tag = DW_TAG_imported_module, scope = #file, entity = #cu_import_ns, file = #file>
 #cu = #llvm.di_compile_unit<
-  id = distinct[0]<>, sourceLanguage = DW_LANG_C, file = #file,
+  id = distinct[0]<>, sourceLanguage = DW_LANG_C,
+  sourceLanguageDialect = DW_LLVM_LANG_DIALECT_simt, file = #file,
   producer = "MLIR", isOptimized = true, emissionKind = Full,
   isDebugInfoForProfiling = true, importedEntities = #cu_import_ie
 >
diff --git a/mlir/test/Target/LLVMIR/Import/debug-info.ll b/mlir/test/Target/LLVMIR/Import/debug-info.ll
index 28c25809002cd..f00fd792e77fa 100644
--- a/mlir/test/Target/LLVMIR/Import/debug-info.ll
+++ b/mlir/test/Target/LLVMIR/Import/debug-info.ll
@@ -1046,3 +1046,22 @@ define void @fn_with_static_local() !dbg !3 {
 !12 = !DILocalVariable(name: "unused_local", scope: !3, file: !4, line: 122, type: !9)
 !13 = !DISubroutineType(types: !14)
 !14 = !{null}
+
+; // -----
+
+; CHECK-DAG: #[[DIALECT_FILE:.+]] = #llvm.di_file<"dialect.ll" in "/">
+; CHECK-DAG: #[[DIALECT_CU:.+]] = #llvm.di_compile_unit<id = distinct[0]<>, sourceLanguage = DW_LANG_C, sourceLanguageDialect = DW_LLVM_LANG_DIALECT_tile, file = #[[DIALECT_FILE]]>
+
+define void @fn_cu_dialect() !dbg !3 {
+  ret void
+}
+
+!llvm.dbg.cu = !{!1}
+!llvm.module.flags = !{!0}
+
+!0 = !{i32 2, !"Debug Info Version", i32 3}
+!1 = distinct !DICompileUnit(language: DW_LANG_C, file: !2, dialect: DW_LLVM_LANG_DIALECT_tile)
+!2 = !DIFile(filename: "dialect.ll", directory: "/")
+!3 = distinct !DISubprogram(name: "fn_cu_dialect", scope: !2, file: !2, spFlags: DISPFlagDefinition, unit: !1, type: !4)
+!4 = !DISubroutineType(types: !5)
+!5 = !{null}
diff --git a/mlir/test/Target/LLVMIR/llvmir-debug.mlir b/mlir/test/Target/LLVMIR/llvmir-debug.mlir
index b93a38be6634d..6628b2882a26c 100644
--- a/mlir/test/Target/LLVMIR/llvmir-debug.mlir
+++ b/mlir/test/Target/LLVMIR/llvmir-debug.mlir
@@ -870,6 +870,28 @@ llvm.func @fn_cu_import_cycle() {
 
 // -----
 
+#file = #llvm.di_file<"dialect.mlir" in "/test/">
+#cu = #llvm.di_compile_unit<
+  id = distinct[0]<>, sourceLanguage = DW_LANG_C,
+  sourceLanguageDialect = DW_LLVM_LANG_DIALECT_simt, file = #file,
+  isOptimized = false, emissionKind = Full
+>
+#sp_ty = #llvm.di_subroutine_type<callingConvention = DW_CC_normal>
+#sp = #llvm.di_subprogram<
+  compileUnit = #cu, scope = #file, name = "fn_cu_dialect",
+  file = #file, line = 1, scopeLine = 1, subprogramFlags = Definition,
+  type = #sp_ty
+>
+
+// CHECK-LABEL: define void @fn_cu_dialect()
+llvm.func @fn_cu_dialect() {
+  llvm.return
+} loc(fused<#sp>["dialect.mlir":1:1])
+
+// CHECK-DAG: !DICompileUnit({{.*}}dialect: DW_LLVM_LANG_DIALECT_simt)
+
+// -----
+
 #di_file  = #llvm.di_file<"foo.mlir" in "/tmp">
 #di_cu    = #llvm.di_compile_unit<id = distinct[0]<>, sourceLanguage = DW_LANG_C, file = #di_file, isOptimized = false, emissionKind = Full>
 #di_uint8 = #llvm.di_basic_type<tag = DW_TAG_base_type, name = "uint8", sizeInBits = 8, encoding = DW_ATE_unsigned>



More information about the Mlir-commits mailing list