Skip to content

Conversation

bethebunny
Copy link
Contributor

@bethebunny bethebunny commented Feb 26, 2025

The parser's DeferredLocInfo uses an uncommon TypeID setup, where it defines a private TypeID for pointers to the struct.

When using the fallback TypeID mechanism introduced in #126999, the fallback TypeID mechanism doesn't support anonymous namespaces, and the INTERNAL_INLINE mechanism doesn't support pointer types.

Explicitly use SELF_OWNING_TYPE_ID for this case. This should always be safe for anonymous namespaces.

The parser's `DeferredLocInfo` uses an uncommon typeID setup,
where it defines a private typeID for pointers to the struct.

When using the fallback TypeID mechanism introduced in
llvm#126999, the fallback
type ID mechanism doesn't support anonymous namespaces, and
the `INTERNAL_INLINE` mechanism doesn't support pointer types.

Explicitly use `SELF_OWNING_TYPE_ID` for this case.
@bethebunny bethebunny changed the title [TypeID] Update private typeid definition [TypeID] Update private typeid definition in DeferredLocInfo Feb 26, 2025
@llvmbot llvmbot added mlir:core MLIR Core Infrastructure mlir labels Feb 26, 2025
@llvmbot
Copy link
Member

llvmbot commented Feb 26, 2025

@llvm/pr-subscribers-mlir

Author: Stef Lindall (bethebunny)

Changes

The parser's DeferredLocInfo uses an uncommon typeID setup, where it defines a private typeID for pointers to the struct.

When using the fallback TypeID mechanism introduced in #126999, the fallback type ID mechanism doesn't support anonymous namespaces, and the INTERNAL_INLINE mechanism doesn't support pointer types.

Explicitly use SELF_OWNING_TYPE_ID for this case.


Full diff: https://github.com/llvm/llvm-project/pull/128968.diff

1 Files Affected:

  • (modified) mlir/lib/AsmParser/Parser.cpp (+2-2)
diff --git a/mlir/lib/AsmParser/Parser.cpp b/mlir/lib/AsmParser/Parser.cpp
index c316f34d977e9..168231af9b410 100644
--- a/mlir/lib/AsmParser/Parser.cpp
+++ b/mlir/lib/AsmParser/Parser.cpp
@@ -839,8 +839,8 @@ class OperationParser : public Parser {
 };
 } // namespace
 
-MLIR_DECLARE_EXPLICIT_TYPE_ID(OperationParser::DeferredLocInfo *)
-MLIR_DEFINE_EXPLICIT_TYPE_ID(OperationParser::DeferredLocInfo *)
+MLIR_DECLARE_EXPLICIT_SELF_OWNING_TYPE_ID(OperationParser::DeferredLocInfo *)
+MLIR_DEFINE_EXPLICIT_SELF_OWNING_TYPE_ID(OperationParser::DeferredLocInfo *)
 
 OperationParser::OperationParser(ParserState &state, ModuleOp topLevelOp)
     : Parser(state), opBuilder(topLevelOp.getRegion()), topLevelOp(topLevelOp) {

@llvmbot
Copy link
Member

llvmbot commented Feb 26, 2025

@llvm/pr-subscribers-mlir-core

Author: Stef Lindall (bethebunny)

Changes

The parser's DeferredLocInfo uses an uncommon typeID setup, where it defines a private typeID for pointers to the struct.

When using the fallback TypeID mechanism introduced in #126999, the fallback type ID mechanism doesn't support anonymous namespaces, and the INTERNAL_INLINE mechanism doesn't support pointer types.

Explicitly use SELF_OWNING_TYPE_ID for this case.


Full diff: https://github.com/llvm/llvm-project/pull/128968.diff

1 Files Affected:

  • (modified) mlir/lib/AsmParser/Parser.cpp (+2-2)
diff --git a/mlir/lib/AsmParser/Parser.cpp b/mlir/lib/AsmParser/Parser.cpp
index c316f34d977e9..168231af9b410 100644
--- a/mlir/lib/AsmParser/Parser.cpp
+++ b/mlir/lib/AsmParser/Parser.cpp
@@ -839,8 +839,8 @@ class OperationParser : public Parser {
 };
 } // namespace
 
-MLIR_DECLARE_EXPLICIT_TYPE_ID(OperationParser::DeferredLocInfo *)
-MLIR_DEFINE_EXPLICIT_TYPE_ID(OperationParser::DeferredLocInfo *)
+MLIR_DECLARE_EXPLICIT_SELF_OWNING_TYPE_ID(OperationParser::DeferredLocInfo *)
+MLIR_DEFINE_EXPLICIT_SELF_OWNING_TYPE_ID(OperationParser::DeferredLocInfo *)
 
 OperationParser::OperationParser(ParserState &state, ModuleOp topLevelOp)
     : Parser(state), opBuilder(topLevelOp.getRegion()), topLevelOp(topLevelOp) {

@bethebunny
Copy link
Contributor Author

@dukebw @joker-eph @lattner

Copy link
Collaborator

@lattner lattner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems obvious, thanks!

@lattner lattner merged commit 1618d09 into llvm:main Feb 27, 2025
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mlir:core MLIR Core Infrastructure mlir
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants