[mlir][python] Fix ir.Value type to not break other types#167930
Merged
nirvedhmeshram merged 4 commits intollvm:mainfrom Nov 13, 2025
Merged
[mlir][python] Fix ir.Value type to not break other types#167930nirvedhmeshram merged 4 commits intollvm:mainfrom
nirvedhmeshram merged 4 commits intollvm:mainfrom
Conversation
Member
|
@llvm/pr-subscribers-mlir-core @llvm/pr-subscribers-mlir Author: Nirvedh Meshram (nirvedhmeshram) ChangesChange in #166148 caused breaks for some other types. This PR tries to make those changes not affect the other types Full diff: https://github.com/llvm/llvm-project/pull/167930.diff 1 Files Affected:
diff --git a/mlir/tools/mlir-tblgen/OpPythonBindingGen.cpp b/mlir/tools/mlir-tblgen/OpPythonBindingGen.cpp
index f01563fd49d17..d0a25149cfe2a 100644
--- a/mlir/tools/mlir-tblgen/OpPythonBindingGen.cpp
+++ b/mlir/tools/mlir-tblgen/OpPythonBindingGen.cpp
@@ -437,7 +437,7 @@ static void emitElementAccessors(
type = std::strcmp(kind, "operand") == 0 ? "_ods_ir.Value"
: "_ods_ir.OpResult";
}
- if (std::strcmp(kind, "operand") == 0) {
+ if (std::strcmp(type.c_str(), "_ods_ir.Value") == 0) {
StringRef pythonType = getPythonType(element.constraint.getCppType());
if (!pythonType.empty())
type += "[" + pythonType.str() + "]";
@@ -473,7 +473,7 @@ static void emitElementAccessors(
if (!element.isVariableLength() || element.isOptional()) {
type = std::strcmp(kind, "operand") == 0 ? "_ods_ir.Value"
: "_ods_ir.OpResult";
- if (std::strcmp(kind, "operand") == 0) {
+ if (std::strcmp(type.c_str(), "_ods_ir.Value") == 0) {
StringRef pythonType = getPythonType(element.constraint.getCppType());
if (!pythonType.empty())
type += "[" + pythonType.str() + "]";
|
Signed-off-by: Nirvedh Meshram <nirvedh@gmail.com>
amd-eochoalo
approved these changes
Nov 13, 2025
Contributor
|
@nirvedhmeshram , looking a little bit closer, both |
Contributor
Author
|
@amd-eochoalo please let me know if my new change would be the right way to handle that. |
Contributor
|
@nirvedhmeshram it is sufficiently good :) Thanks! |
amd-eochoalo
approved these changes
Nov 13, 2025
nirvedhmeshram
added a commit
to iree-org/llvm-project
that referenced
this pull request
Nov 15, 2025
Change in llvm#166148 caused breaks for some other types. Specifically this error was seen in a downstream project ``` _ods_ir.OpOperandList[_ods_ir.IntegerType]: TypeError: type 'iree.compiler._mlir_libs._mlir.ir.OpOperandList' is not subscriptable ``` This PR tries to make those changes not affect the other types --------- Signed-off-by: Nirvedh Meshram <nirvedh@gmail.com>
egebeysel
pushed a commit
to egebeysel/llvm-project
that referenced
this pull request
Feb 12, 2026
Change in llvm#166148 caused breaks for some other types. Specifically this error was seen in a downstream project ``` _ods_ir.OpOperandList[_ods_ir.IntegerType]: TypeError: type 'iree.compiler._mlir_libs._mlir.ir.OpOperandList' is not subscriptable ``` This PR tries to make those changes not affect the other types --------- Signed-off-by: Nirvedh Meshram <nirvedh@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Change in #166148 caused breaks for some other types.
Specifically this error was seen in a downstream project
This PR tries to make those changes not affect the other types