[Mlir-commits] [mlir] [MLIR] Improve translation of DISubrange. (PR #93689)

Abid Qadeer llvmlistbot at llvm.org
Fri May 31 02:36:46 PDT 2024


================
@@ -314,11 +314,29 @@ llvm::DINamespace *DebugTranslation::translateImpl(DINamespaceAttr attr) {
 }
 
 llvm::DISubrange *DebugTranslation::translateImpl(DISubrangeAttr attr) {
-  auto getMetadataOrNull = [&](IntegerAttr attr) -> llvm::Metadata * {
+  auto getMetadataOrNull = [&](Attribute attr) -> llvm::Metadata * {
     if (!attr)
       return nullptr;
-    return llvm::ConstantAsMetadata::get(llvm::ConstantInt::getSigned(
-        llvm::Type::getInt64Ty(llvmCtx), attr.getInt()));
+
+    llvm::Metadata *metadata =
+        llvm::TypeSwitch<Attribute, llvm::Metadata *>(attr)
+            .Case<IntegerAttr>([&](IntegerAttr intAttr) {
----------------
abidh wrote:

Thanks for the tip. I have fixed it.

https://github.com/llvm/llvm-project/pull/93689


More information about the Mlir-commits mailing list