================
@@ -172,6 +172,37 @@ static mlir::Value makeBinaryAtomicValue(
   return rmwi->getResult(0);
 }
 
+/// Utility to insert an atomic cmpxchg instruction.
+static mlir::Value makeAtomicCmpXchgValue(CIRGenFunction &cgf,
+                                          const CallExpr *expr,
+                                          bool returnBool) {
+  QualType typ = returnBool ? expr->getArg(1)->getType() : expr->getType();
+  Address destAddr = checkAtomicAlignment(cgf, expr);
+  clang::CIRGen::CIRGenBuilderTy &builder = cgf.getBuilder();
+
+  cir::IntType intType =
+      expr->getArg(0)->getType()->getPointeeType()->isUnsignedIntegerType()
----------------
andykaylor wrote:

I'm curious about this entire line.

First, it's not clear to me why you're using arg 0 to get the signedness. Won't 
it always point to the same type as arg 1 and arg 2? If so, you could use arg 1 
and avoid the need to get the pointee type.

Second, why is it necessary to get an integer type using the width of the input 
types? Won't this always return the same type as `typ`?

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

Reply via email to