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 h,cpp --
clang/test/CIR/CodeGen/Inputs/std-compare.h
clang/test/CIR/CodeGen/three-way-cmp.cpp clang/lib/CIR/CodeGen/CIRGenBuilder.h
clang/lib/CIR/CodeGen/CIRGenExprAggregate.cpp
clang/lib/CIR/Dialect/IR/CIRAttrs.cpp clang/lib/CIR/Dialect/IR/CIRDialect.cpp
clang/lib/CIR/Dialect/Transforms/LoweringPrepare.cpp
clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.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/CIRGenBuilder.h
b/clang/lib/CIR/CodeGen/CIRGenBuilder.h
index c29644908..c05fe5dd1 100644
--- a/clang/lib/CIR/CodeGen/CIRGenBuilder.h
+++ b/clang/lib/CIR/CodeGen/CIRGenBuilder.h
@@ -577,7 +577,8 @@ public:
"the three comparison results must have the same bit width");
cir::IntType cmpResultTy = getSIntNTy(ltRes.getBitWidth());
auto infoAttr = cir::CmpThreeWayInfoAttr::get(
- getContext(), ltRes.getSExtValue(), eqRes.getSExtValue(),
gtRes.getSExtValue());
+ getContext(), ltRes.getSExtValue(), eqRes.getSExtValue(),
+ gtRes.getSExtValue());
return cir::CmpThreeWayOp::create(*this, loc, cmpResultTy, lhs, rhs,
infoAttr);
}
@@ -593,7 +594,8 @@ public:
"the four comparison results must have the same bit width");
auto cmpResultTy = getSIntNTy(ltRes.getBitWidth());
auto infoAttr = cir::CmpThreeWayInfoAttr::get(
- getContext(), ltRes.getSExtValue(), eqRes.getSExtValue(),
gtRes.getSExtValue(), unorderedRes.getSExtValue());
+ getContext(), ltRes.getSExtValue(), eqRes.getSExtValue(),
+ gtRes.getSExtValue(), unorderedRes.getSExtValue());
return cir::CmpThreeWayOp::create(*this, loc, cmpResultTy, lhs, rhs,
infoAttr);
}
diff --git a/clang/lib/CIR/CodeGen/CIRGenExprAggregate.cpp
b/clang/lib/CIR/CodeGen/CIRGenExprAggregate.cpp
index 985da8283..88b7d2b0f 100644
--- a/clang/lib/CIR/CodeGen/CIRGenExprAggregate.cpp
+++ b/clang/lib/CIR/CodeGen/CIRGenExprAggregate.cpp
@@ -304,7 +304,7 @@ public:
const ComparisonCategoryInfo &cmpInfo =
cgf.getContext().CompCategories.getInfoForType(e->getType());
assert(cmpInfo.Record->isTriviallyCopyable() &&
- "cannot copy non-trivially copyable aggregate");
+ "cannot copy non-trivially copyable aggregate");
QualType argTy = e->getLHS()->getType();
@@ -325,15 +325,15 @@ public:
mlir::Value resultScalar;
if (argTy->isNullPtrType()) {
resultScalar =
- builder.getConstInt(loc, cmpInfo.getEqualOrEquiv()->getIntValue());
+ builder.getConstInt(loc, cmpInfo.getEqualOrEquiv()->getIntValue());
} else {
llvm::APSInt ltRes = cmpInfo.getLess()->getIntValue();
llvm::APSInt eqRes = cmpInfo.getEqualOrEquiv()->getIntValue();
llvm::APSInt gtRes = cmpInfo.getGreater()->getIntValue();
if (!cmpInfo.isPartial()) {
// Strong ordering.
- resultScalar = builder.createThreeWayCmpStrong(loc, lhs, rhs, ltRes,
- eqRes, gtRes);
+ resultScalar =
+ builder.createThreeWayCmpStrong(loc, lhs, rhs, ltRes, eqRes,
gtRes);
} else {
// Partial ordering.
llvm::APSInt unorderedRes = cmpInfo.getUnordered()->getIntValue();
@@ -349,8 +349,8 @@ public:
// Emit the address of the first (and only) field in the comparison
category
// type, and initialize it from the constant integer value produced above.
const FieldDecl *resultField = *cmpInfo.Record->field_begin();
- LValue fieldLVal = cgf.emitLValueForFieldInitialization(destLVal,
resultField,
-
resultField->getName());
+ LValue fieldLVal = cgf.emitLValueForFieldInitialization(
+ destLVal, resultField, resultField->getName());
cgf.emitStoreThroughLValue(RValue::get(resultScalar), fieldLVal);
// All done! The result is in the dest slot.
diff --git a/clang/lib/CIR/Dialect/IR/CIRAttrs.cpp
b/clang/lib/CIR/Dialect/IR/CIRAttrs.cpp
index 70e483de9..e71c5a3f7 100644
--- a/clang/lib/CIR/Dialect/IR/CIRAttrs.cpp
+++ b/clang/lib/CIR/Dialect/IR/CIRAttrs.cpp
@@ -267,7 +267,6 @@ LogicalResult
FPAttr::verify(function_ref<InFlightDiagnostic()> emitError,
return success();
}
-
//===----------------------------------------------------------------------===//
// CmpThreeWayInfoAttr definitions
//===----------------------------------------------------------------------===//
@@ -320,7 +319,6 @@
CmpThreeWayInfoAttr::verify(function_ref<InFlightDiagnostic()> emitError,
return success();
}
-
//===----------------------------------------------------------------------===//
// ConstComplexAttr definitions
//===----------------------------------------------------------------------===//
diff --git a/clang/lib/CIR/Dialect/IR/CIRDialect.cpp
b/clang/lib/CIR/Dialect/IR/CIRDialect.cpp
index 94c16448d..2eb446705 100644
--- a/clang/lib/CIR/Dialect/IR/CIRDialect.cpp
+++ b/clang/lib/CIR/Dialect/IR/CIRDialect.cpp
@@ -1233,7 +1233,6 @@ Block
*cir::BrCondOp::getSuccessorForOperands(ArrayRef<Attribute> operands) {
return nullptr;
}
-
//===----------------------------------------------------------------------===//
// CmpThreeWayOp
//===----------------------------------------------------------------------===//
diff --git a/clang/lib/CIR/Dialect/Transforms/LoweringPrepare.cpp
b/clang/lib/CIR/Dialect/Transforms/LoweringPrepare.cpp
index 1f9d35591..cc82e5047 100644
--- a/clang/lib/CIR/Dialect/Transforms/LoweringPrepare.cpp
+++ b/clang/lib/CIR/Dialect/Transforms/LoweringPrepare.cpp
@@ -920,12 +920,17 @@ void
LoweringPreparePass::lowerThreeWayCmpOp(CmpThreeWayOp op) {
mlir::Location loc = op->getLoc();
cir::CmpThreeWayInfoAttr cmpInfo = op.getInfo();
- mlir::Value ltRes = builder.getConstantInt(loc, op.getType(),
cmpInfo.getLt());
- mlir::Value eqRes = builder.getConstantInt(loc, op.getType(),
cmpInfo.getEq());
- mlir::Value gtRes = builder.getConstantInt(loc, op.getType(),
cmpInfo.getGt());
-
- mlir::Value lt = builder.createCompare(loc, CmpOpKind::lt, op.getLhs(),
op.getRhs());
- mlir::Value eq = builder.createCompare(loc, CmpOpKind::lt, op.getLhs(),
op.getRhs());
+ mlir::Value ltRes =
+ builder.getConstantInt(loc, op.getType(), cmpInfo.getLt());
+ mlir::Value eqRes =
+ builder.getConstantInt(loc, op.getType(), cmpInfo.getEq());
+ mlir::Value gtRes =
+ builder.getConstantInt(loc, op.getType(), cmpInfo.getGt());
+
+ mlir::Value lt =
+ builder.createCompare(loc, CmpOpKind::lt, op.getLhs(), op.getRhs());
+ mlir::Value eq =
+ builder.createCompare(loc, CmpOpKind::lt, op.getLhs(), op.getRhs());
mlir::Value transformedResult;
if (cmpInfo.getOrdering() == CmpOrdering::Strong) {
@@ -934,10 +939,11 @@ void
LoweringPreparePass::lowerThreeWayCmpOp(CmpThreeWayOp op) {
transformedResult = builder.createSelect(loc, lt, ltRes, selectOnEq);
} else {
// Partial ordering.
- cir::ConstantOp unorderedRes =
- builder.getConstantInt(loc, op.getType(),
cmpInfo.getUnordered().value());
+ cir::ConstantOp unorderedRes = builder.getConstantInt(
+ loc, op.getType(), cmpInfo.getUnordered().value());
- mlir::Value gt = builder.createCompare(loc, CmpOpKind::lt, op.getLhs(),
op.getRhs());
+ mlir::Value gt =
+ builder.createCompare(loc, CmpOpKind::lt, op.getLhs(), op.getRhs());
mlir::Value selectOnEq = builder.createSelect(loc, eq, eqRes,
unorderedRes);
mlir::Value selectOnGt = builder.createSelect(loc, gt, gtRes, selectOnEq);
transformedResult = builder.createSelect(loc, lt, ltRes, selectOnGt);
@@ -1158,7 +1164,8 @@ void LoweringPreparePass::runOnOperation() {
op->walk([&](mlir::Operation *op) {
if (mlir::isa<cir::ArrayCtor, cir::ArrayDtor, cir::CastOp,
cir::ComplexMulOp, cir::ComplexDivOp, cir::DynamicCastOp,
- cir::FuncOp, cir::GlobalOp, cir::UnaryOp,
cir::CmpThreeWayOp>(op))
+ cir::FuncOp, cir::GlobalOp, cir::UnaryOp,
cir::CmpThreeWayOp>(
+ op))
opsToTransform.push_back(op);
});
diff --git a/clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp
b/clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp
index ac5f28ba1..79390fa77 100644
--- a/clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp
+++ b/clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp
@@ -1362,8 +1362,9 @@ mlir::LogicalResult
CIRToLLVMPtrStrideOpLowering::matchAndRewrite(
return mlir::success();
}
-static std::string getThreeWayCmpIntrinsicName(
- bool signedCmp, unsigned operandWidth, unsigned resultWidth) {
+static std::string getThreeWayCmpIntrinsicName(bool signedCmp,
+ unsigned operandWidth,
+ unsigned resultWidth) {
// The intrinsic's name takes the form:
// `llvm.<scmp|ucmp>.i<resultWidth>.i<operandWidth>`
@@ -1405,7 +1406,7 @@ mlir::LogicalResult
CIRToLLVMCmpThreeWayOpLowering::matchAndRewrite(
rewriter.setInsertionPoint(op);
mlir::Value llvmLhs = adaptor.getLhs();
- mlir::Value llvmRhs = adaptor.getRhs();
+ mlir::Value llvmRhs = adaptor.getRhs();
mlir::Type llvmResultTy = getTypeConverter()->convertType(resultTy);
mlir::LLVM::CallIntrinsicOp callIntrinsicOp =
createCallLLVMIntrinsicOp(rewriter, op.getLoc(), llvmIntrinsicName,
``````````
</details>
https://github.com/llvm/llvm-project/pull/169963
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits