[Mlir-commits] [mlir] [WIP][mlir][EmitC] Model lvalues as a type in EmitC (PR #91475)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Mon Jun 3 07:47:18 PDT 2024


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff de18f5ecf80ef7183625c80b04445c614a17c483 c61d8287826787a654f182e3a95ec03a6e8de370 -- mlir/lib/Conversion/MemRefToEmitC/MemRefToEmitC.cpp mlir/lib/Conversion/SCFToEmitC/SCFToEmitC.cpp mlir/lib/Dialect/EmitC/IR/EmitC.cpp mlir/lib/Target/Cpp/TranslateToCpp.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/mlir/lib/Conversion/SCFToEmitC/SCFToEmitC.cpp b/mlir/lib/Conversion/SCFToEmitC/SCFToEmitC.cpp
index 4ba1efbdef..0589a496a8 100644
--- a/mlir/lib/Conversion/SCFToEmitC/SCFToEmitC.cpp
+++ b/mlir/lib/Conversion/SCFToEmitC/SCFToEmitC.cpp
@@ -86,8 +86,8 @@ static void assignValues(ValueRange values, SmallVector<Value> &variables,
 
     // TODO: Make sure this is safe, as this moves operations with memory
     // effects.
-    if (auto op = dyn_cast_if_present<emitc::LValueLoadOp>(
-            value.getDefiningOp())) {
+    if (auto op =
+            dyn_cast_if_present<emitc::LValueLoadOp>(value.getDefiningOp())) {
       rewriter.moveOpBefore(op, assign);
     }
   }
diff --git a/mlir/lib/Dialect/EmitC/IR/EmitC.cpp b/mlir/lib/Dialect/EmitC/IR/EmitC.cpp
index 14e7a62411..9277b69356 100644
--- a/mlir/lib/Dialect/EmitC/IR/EmitC.cpp
+++ b/mlir/lib/Dialect/EmitC/IR/EmitC.cpp
@@ -1017,12 +1017,10 @@ LogicalResult mlir::emitc::LValueType::verify(
     llvm::function_ref<mlir::InFlightDiagnostic()> emitError,
     mlir::Type value) {
   if (llvm::isa<emitc::ArrayType>(value)) {
-    return emitError()
-           << "!emitc.lvalue cannot wrap !emitc.array type";
+    return emitError() << "!emitc.lvalue cannot wrap !emitc.array type";
   }
   if (llvm::isa<emitc::LValueType>(value)) {
-    return emitError()
-           << "!emitc.lvalue types cannot be nested";
+    return emitError() << "!emitc.lvalue types cannot be nested";
   }
   return success();
 }
diff --git a/mlir/lib/Target/Cpp/TranslateToCpp.cpp b/mlir/lib/Target/Cpp/TranslateToCpp.cpp
index e10410c3e8..baa7a2f297 100644
--- a/mlir/lib/Target/Cpp/TranslateToCpp.cpp
+++ b/mlir/lib/Target/Cpp/TranslateToCpp.cpp
@@ -1541,8 +1541,7 @@ LogicalResult CppEmitter::emitOperation(Operation &op, bool trailingSemicolon) {
   if (failed(status))
     return failure();
 
-  if (isa<emitc::LiteralOp, emitc::SubscriptOp,
-          emitc::GetGlobalOp>(op))
+  if (isa<emitc::LiteralOp, emitc::SubscriptOp, emitc::GetGlobalOp>(op))
     return success();
 
   if (getEmittedExpression() ||

``````````

</details>


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


More information about the Mlir-commits mailing list