[Mlir-commits] [mlir] [MLIR] Improve translation of DISubrange. (PR #93689)
Christian Ulmann
llvmlistbot at llvm.org
Wed May 29 09:24:36 PDT 2024
================
@@ -314,11 +314,24 @@ 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()));
+
+ if (auto intAttr = llvm::dyn_cast<IntegerAttr>(attr)) {
----------------
Dinistro wrote:
Nit: Use a TypeSwitch here.
Side note: When you would keep this, you should turn all the `else if`s into normal `if`s, given that all of them contain a return.
https://github.com/llvm/llvm-project/pull/93689
More information about the Mlir-commits
mailing list