[Mlir-commits] [mlir] Bugfix in emitc.call_opaque operand emission (PR #153980)
Gabriel Dehame
llvmlistbot at llvm.org
Sat Aug 16 14:46:46 PDT 2025
https://github.com/gdehame created https://github.com/llvm/llvm-project/pull/153980
The operand emission needed the operand to be in scope which lead to failure when the emitc.call_opaque is in an emitc.expression's body
>From c7fe7c5e2f464f6fd9cedb35206b5dccf0b839ca Mon Sep 17 00:00:00 2001
From: gdehame <gabrieldehame at gmail.com>
Date: Sat, 16 Aug 2025 23:41:06 +0200
Subject: [PATCH] Bugfix in emitc.call_opaque operand emission
The operand emission needed the operand to be in scope which lead to failure when the emitc.call_opaque is in an emitc.expression's body
---
mlir/lib/Target/Cpp/TranslateToCpp.cpp | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/mlir/lib/Target/Cpp/TranslateToCpp.cpp b/mlir/lib/Target/Cpp/TranslateToCpp.cpp
index 8e83e455d1a7f..510bf7b72b00c 100644
--- a/mlir/lib/Target/Cpp/TranslateToCpp.cpp
+++ b/mlir/lib/Target/Cpp/TranslateToCpp.cpp
@@ -749,10 +749,8 @@ static LogicalResult printOperation(CppEmitter &emitter,
if (t.getType().isIndex()) {
int64_t idx = t.getInt();
Value operand = op.getOperand(idx);
- if (!emitter.hasValueInScope(operand))
- return op.emitOpError("operand ")
- << idx << "'s value not defined in scope";
- os << emitter.getOrCreateName(operand);
+ if (failed(emitter.emitOperand(operand)))
+ return failure();
return success();
}
}
More information about the Mlir-commits
mailing list