[Mlir-commits] [mlir] [mlir] Use `getSingleElement`/`hasSingleElement` in various places (PR #131460)
Jakub Kuderski
llvmlistbot at llvm.org
Sun Mar 16 13:32:07 PDT 2025
================
@@ -388,8 +388,7 @@ Value CodeGen::genSingleExpr(const ast::Expr *expr) {
.Case<const ast::CallExpr, const ast::DeclRefExpr, const ast::TupleExpr>(
[&](auto derivedNode) {
SmallVector<Value> results = this->genExprImpl(derivedNode);
- assert(results.size() == 1 && "expected single expression result");
- return results[0];
+ return llvm::getSingleElement(results);
----------------
kuhar wrote:
nit: now that this has a single use, you could use `genExprImpl` inline
https://github.com/llvm/llvm-project/pull/131460
More information about the Mlir-commits
mailing list