[Mlir-commits] [mlir] Bugfix in emitc.call_opaque operand emission (PR #153980)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Sat Aug 16 14:47:15 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-mlir

Author: Gabriel Dehame (gdehame)

<details>
<summary>Changes</summary>

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

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


1 Files Affected:

- (modified) mlir/lib/Target/Cpp/TranslateToCpp.cpp (+2-4) 


``````````diff
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();
       }
     }

``````````

</details>


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


More information about the Mlir-commits mailing list