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 origin/main HEAD --extensions cpp -- 
clang/lib/CIR/CodeGen/CIRGenBuiltin.cpp --diff_from_common_commit
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

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

``````````diff
diff --git a/clang/lib/CIR/CodeGen/CIRGenBuiltin.cpp 
b/clang/lib/CIR/CodeGen/CIRGenBuiltin.cpp
index 12bf23b66..e5e641cfe 100644
--- a/clang/lib/CIR/CodeGen/CIRGenBuiltin.cpp
+++ b/clang/lib/CIR/CodeGen/CIRGenBuiltin.cpp
@@ -269,16 +269,18 @@ static mlir::Value emitAtomicCmpXchgValue(CIRGenFunction 
&cgf,
 /// Emit a `cir.atomic.cmpxchg` for __sync_bool_compare_and_swap_N.
 /// Returns a boolean: true if the exchange succeeded (old == expected).
 static RValue emitAtomicCmpXchgBool(CIRGenFunction &cgf, const CallExpr *e) {
-  mlir::Value old = emitAtomicCmpXchgValue(cgf, e, 
cir::MemOrder::SequentiallyConsistent,
-                                           
cir::MemOrder::SequentiallyConsistent);
+  mlir::Value old =
+      emitAtomicCmpXchgValue(cgf, e, cir::MemOrder::SequentiallyConsistent,
+                             cir::MemOrder::SequentiallyConsistent);
   CIRGenBuilderTy &builder = cgf.getBuilder();
   // __sync_bool_compare_and_swap returns true on success.
   // The classic llvm/cmpxchg produces {old, success}. We only have old here,
   // so compare old == expected.
   mlir::Value expected = cgf.emitScalarExpr(e->getArg(1));
-  mlir::Value cmp = builder.createCompare(
-      cgf.getLoc(e->getSourceRange()), cir::CmpOpKind::eq, old, expected);
-  mlir::Value result = builder.createIntCast(cmp, 
cgf.convertType(e->getType()));
+  mlir::Value cmp = builder.createCompare(cgf.getLoc(e->getSourceRange()),
+                                          cir::CmpOpKind::eq, old, expected);
+  mlir::Value result =
+      builder.createIntCast(cmp, cgf.convertType(e->getType()));
   return RValue::get(result);
 }
 
@@ -302,12 +304,11 @@ static void emitAtomicLockRelease(CIRGenFunction &cgf, 
const CallExpr *e) {
   Address destAddr = checkAtomicAlignment(cgf, e);
   mlir::Location loc = cgf.getLoc(e->getSourceRange());
   mlir::Type pointeeTy = destAddr.getType();
-  mlir::Value zero = builder.getConstant(
-      loc, cir::IntAttr::get(pointeeTy, 0));
-  auto orderAttr = cir::MemOrderAttr::get(
-      &cgf.getMLIRContext(), cir::MemOrder::Release);
-  auto scopeAttr = cir::SyncScopeKindAttr::get(
-      &cgf.getMLIRContext(), cir::SyncScopeKind::System);
+  mlir::Value zero = builder.getConstant(loc, cir::IntAttr::get(pointeeTy, 0));
+  auto orderAttr =
+      cir::MemOrderAttr::get(&cgf.getMLIRContext(), cir::MemOrder::Release);
+  auto scopeAttr = cir::SyncScopeKindAttr::get(&cgf.getMLIRContext(),
+                                               cir::SyncScopeKind::System);
   builder.createStore(loc, zero, destAddr, /*isVolatile=*/false,
                       /*isNontemporal=*/false,
                       /*align=*/mlir::IntegerAttr{}, scopeAttr, orderAttr);
@@ -2129,9 +2130,9 @@ RValue CIRGenFunction::emitBuiltinExpr(const GlobalDecl 
&gd, unsigned builtinID,
   case Builtin::BI__sync_xor_and_fetch:
   case Builtin::BI__sync_nand_and_fetch:
   case Builtin::BI__sync_val_compare_and_swap:
-    return RValue::get(emitAtomicCmpXchgValue(
-        *this, e, cir::MemOrder::SequentiallyConsistent,
-        cir::MemOrder::SequentiallyConsistent));
+    return RValue::get(
+        emitAtomicCmpXchgValue(*this, e, cir::MemOrder::SequentiallyConsistent,
+                               cir::MemOrder::SequentiallyConsistent));
   case Builtin::BI__sync_bool_compare_and_swap:
     return emitAtomicCmpXchgBool(*this, e);
   case Builtin::BI__sync_lock_test_and_set:
@@ -2140,8 +2141,8 @@ RValue CIRGenFunction::emitBuiltinExpr(const GlobalDecl 
&gd, unsigned builtinID,
     emitAtomicLockRelease(*this, e);
     return RValue::get(nullptr);
   case Builtin::BI__sync_swap:
-    return RValue::get(emitAtomicXchg(
-        *this, e, cir::MemOrder::SequentiallyConsistent));
+    return RValue::get(
+        emitAtomicXchg(*this, e, cir::MemOrder::SequentiallyConsistent));
   case Builtin::BI__sync_fetch_and_add_1:
   case Builtin::BI__sync_fetch_and_add_2:
   case Builtin::BI__sync_fetch_and_add_4:
@@ -2230,9 +2231,9 @@ RValue CIRGenFunction::emitBuiltinExpr(const GlobalDecl 
&gd, unsigned builtinID,
   case Builtin::BI__sync_val_compare_and_swap_4:
   case Builtin::BI__sync_val_compare_and_swap_8:
   case Builtin::BI__sync_val_compare_and_swap_16:
-    return RValue::get(emitAtomicCmpXchgValue(
-        *this, e, cir::MemOrder::SequentiallyConsistent,
-        cir::MemOrder::SequentiallyConsistent));
+    return RValue::get(
+        emitAtomicCmpXchgValue(*this, e, cir::MemOrder::SequentiallyConsistent,
+                               cir::MemOrder::SequentiallyConsistent));
   case Builtin::BI__sync_bool_compare_and_swap_1:
   case Builtin::BI__sync_bool_compare_and_swap_2:
   case Builtin::BI__sync_bool_compare_and_swap_4:
@@ -2244,8 +2245,8 @@ RValue CIRGenFunction::emitBuiltinExpr(const GlobalDecl 
&gd, unsigned builtinID,
   case Builtin::BI__sync_swap_4:
   case Builtin::BI__sync_swap_8:
   case Builtin::BI__sync_swap_16:
-    return RValue::get(emitAtomicXchg(
-        *this, e, cir::MemOrder::SequentiallyConsistent));
+    return RValue::get(
+        emitAtomicXchg(*this, e, cir::MemOrder::SequentiallyConsistent));
   case Builtin::BI__sync_lock_test_and_set_1:
   case Builtin::BI__sync_lock_test_and_set_2:
   case Builtin::BI__sync_lock_test_and_set_4:

``````````

</details>


https://github.com/llvm/llvm-project/pull/214606
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to