[Mlir-commits] [clang] [llvm] [mlir] msvc abi/cir foundation mangling (PR #233258)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Sun Oct 18 09:17:49 PDT 2026


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 -- llvm/unittests/ABI/WinX86_64TargetInfoTest.cpp clang/lib/CIR/CodeGen/CIRGenCall.cpp clang/lib/CIR/CodeGen/CIRGenClass.cpp clang/lib/CIR/CodeGen/CIRGenExprCXX.cpp clang/lib/CIR/CodeGen/CIRGenFunction.cpp clang/lib/CIR/CodeGen/CIRGenMicrosoftCXXABI.cpp clang/lib/CIR/CodeGen/CIRGenModule.cpp clang/lib/CIR/CodeGen/CIRGenModule.h clang/lib/CIR/CodeGen/CIRGenVTables.h clang/lib/CIR/CodeGen/CIRGenerator.cpp clang/lib/CIR/Dialect/Transforms/TargetLowering/LowerMicrosoftCXXABI.cpp clang/test/CIR/CodeGen/cxx-msvc-abi.cpp llvm/include/llvm/ABI/FunctionInfo.h llvm/include/llvm/ABI/TargetInfo.h llvm/include/llvm/ABI/Types.h llvm/lib/ABI/Targets/X86.cpp llvm/unittests/ABI/FunctionInfoTest.cpp llvm/unittests/ABI/TypesTest.cpp mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp mlir/lib/Target/LLVMIR/Dialect/LLVMIR/LLVMToLLVMIRTranslation.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/CIRGenMicrosoftCXXABI.cpp b/clang/lib/CIR/CodeGen/CIRGenMicrosoftCXXABI.cpp
index 924e63ee8..8e5dc211b 100644
--- a/clang/lib/CIR/CodeGen/CIRGenMicrosoftCXXABI.cpp
+++ b/clang/lib/CIR/CodeGen/CIRGenMicrosoftCXXABI.cpp
@@ -249,7 +249,7 @@ public:
                                                    bool virtualCall) override;
 
   bool isVirtualOffsetNeededForVTableField(CIRGenFunction &cgf,
-                                          CIRGenFunction::VPtr vptr) override {
+                                           CIRGenFunction::VPtr vptr) override {
     return vptr.nearestVBase != nullptr;
   }
 
@@ -272,8 +272,9 @@ public:
 
   void emitVirtualInheritanceTables(const CXXRecordDecl *rd) override;
 
-  void initializeHiddenVirtualInheritanceMembers(
-      CIRGenFunction &cgf, const CXXRecordDecl *rd) override;
+  void
+  initializeHiddenVirtualInheritanceMembers(CIRGenFunction &cgf,
+                                            const CXXRecordDecl *rd) override;
 
   mlir::Value
   getVirtualBaseClassOffset(mlir::Location loc, CIRGenFunction &cgf,
@@ -316,18 +317,19 @@ public:
 
 } // namespace
 
-CharUnits CIRGenMicrosoftCXXABI::getVirtualFunctionPrologueThisAdjustment(
-    GlobalDecl gd) {
+CharUnits
+CIRGenMicrosoftCXXABI::getVirtualFunctionPrologueThisAdjustment(GlobalDecl gd) {
   const auto *md = cast<CXXMethodDecl>(gd.getDecl());
 
   if (const auto *dd = dyn_cast<CXXDestructorDecl>(md)) {
     if (gd.getDtorType() == Dtor_Complete)
       return CharUnits();
 
-    gd = GlobalDecl(dd, cgm.getASTContext().getTargetInfo().emitVectorDeletingDtors(
-                            cgm.getASTContext().getLangOpts())
-                            ? Dtor_VectorDeleting
-                            : Dtor_Deleting);
+    gd = GlobalDecl(dd,
+                    cgm.getASTContext().getTargetInfo().emitVectorDeletingDtors(
+                        cgm.getASTContext().getLangOpts())
+                        ? Dtor_VectorDeleting
+                        : Dtor_Deleting);
   }
 
   MethodVFTableLocation ml =
@@ -355,8 +357,8 @@ mlir::Value CIRGenMicrosoftCXXABI::getVBaseOffsetFromVBPtr(
       builder.createBitcast(thisAddr.getPointer(), u8PtrTy);
 
   mlir::Value vbPtrOffsetVal = builder.getSInt32(vbPtrOffset, loc);
-  mlir::Value vbPtr =
-      cir::PtrStrideOp::create(builder, loc, u8PtrTy, thisBytePtr, vbPtrOffsetVal);
+  mlir::Value vbPtr = cir::PtrStrideOp::create(builder, loc, u8PtrTy,
+                                               thisBytePtr, vbPtrOffsetVal);
   if (vbPtrOut)
     *vbPtrOut = vbPtr;
 
@@ -579,14 +581,14 @@ void CIRGenMicrosoftCXXABI::emitDestructorCall(
     type = Dtor_Base;
 
   GlobalDecl gd(dd, type);
-  CIRGenCallee callee = CIRGenCallee::forDirect(
-      cgm.getAddrOfCXXStructor(gd).getOperation(), gd);
+  CIRGenCallee callee =
+      CIRGenCallee::forDirect(cgm.getAddrOfCXXStructor(gd).getOperation(), gd);
 
   if (dd->isVirtual()) {
     assert(type != CXXDtorType::Dtor_Deleting &&
            "The deleting destructor should only be called via a virtual call");
-    thisAddr = adjustThisArgumentForVirtualFunctionCall(cgf, GlobalDecl(dd, type),
-                                                        thisAddr, false);
+    thisAddr = adjustThisArgumentForVirtualFunctionCall(
+        cgf, GlobalDecl(dd, type), thisAddr, false);
   }
 
   cgf.emitCXXDestructorCall(gd, callee, thisAddr.emitRawPointer(), thisTy,
@@ -617,10 +619,10 @@ mlir::Value CIRGenMicrosoftCXXABI::emitVirtualDestructorCall(
   bool isGlobalDelete = de && de->isGlobalDelete() &&
                         context.getTargetInfo().callGlobalDeleteInDeletingDtor(
                             context.getLangOpts());
-  int32_t flags = (isDeleting ? 1 : 0) | (isGlobalDelete ? 4 : 0) |
-                  (isArrayDelete ? 2 : 0);
-  mlir::Value implicitParam = cgf.getBuilder().getSInt32(
-      flags, cgf.getLoc(dtor->getLocation()));
+  int32_t flags =
+      (isDeleting ? 1 : 0) | (isGlobalDelete ? 4 : 0) | (isArrayDelete ? 2 : 0);
+  mlir::Value implicitParam =
+      cgf.getBuilder().getSInt32(flags, cgf.getLoc(dtor->getLocation()));
 
   QualType thisTy;
   if (ce)
@@ -642,9 +644,9 @@ void CIRGenMicrosoftCXXABI::emitVirtualObjectDelete(
     QualType elementType, const CXXDestructorDecl *dtor) {
   if (!cgm.getASTContext().getTargetInfo().callGlobalDeleteInDeletingDtor(
           cgm.getASTContext().getLangOpts())) {
-    cgf.cgm.errorNYI(
-        de->getSourceRange(),
-        "emitVirtualObjectDelete: legacy global delete without deleting dtor flag");
+    cgf.cgm.errorNYI(de->getSourceRange(),
+                     "emitVirtualObjectDelete: legacy global delete without "
+                     "deleting dtor flag");
     return;
   }
   emitVirtualDestructorCall(cgf, dtor, Dtor_Deleting, ptr, de);
@@ -683,8 +685,7 @@ Address CIRGenMicrosoftCXXABI::adjustThisArgumentForVirtualFunctionCall(
     cir::PointerType u8PtrTy = builder.getUInt8PtrTy();
     mlir::Value u8This = builder.createBitcast(thisAddr.getPointer(), u8PtrTy);
     assert(adjustment.isPositive());
-    mlir::Value adjConst =
-        builder.getSInt32(adjustment.getQuantity(), loc);
+    mlir::Value adjConst = builder.getSInt32(adjustment.getQuantity(), loc);
     mlir::Value adjusted =
         cir::PtrStrideOp::create(builder, loc, u8PtrTy, u8This, adjConst);
     return Address(builder.createBitcast(adjusted, thisAddr.getElementType()),
@@ -731,8 +732,7 @@ Address CIRGenMicrosoftCXXABI::adjustThisArgumentForVirtualFunctionCall(
   if (!staticOffset.isZero()) {
     assert(staticOffset.isPositive());
     mlir::Value rawPtr = builder.createBitcast(result.getPointer(), u8PtrTy);
-    mlir::Value offsetVal =
-        builder.getSInt32(staticOffset.getQuantity(), loc);
+    mlir::Value offsetVal = builder.getSInt32(staticOffset.getQuantity(), loc);
     mlir::Value adjustedPtr =
         cir::PtrStrideOp::create(builder, loc, u8PtrTy, rawPtr, offsetVal);
     result = Address(adjustedPtr, builder.getUInt8Ty(),
@@ -748,9 +748,8 @@ Address CIRGenMicrosoftCXXABI::adjustThisArgumentForVirtualFunctionCall(
   return result;
 }
 
-cir::GlobalOp
-CIRGenMicrosoftCXXABI::getAddrOfVTable(const CXXRecordDecl *rd,
-                                       CharUnits vptrOffset) {
+cir::GlobalOp CIRGenMicrosoftCXXABI::getAddrOfVTable(const CXXRecordDecl *rd,
+                                                     CharUnits vptrOffset) {
   VFTableIdTy id(rd, vptrOffset);
   auto it = vftablesMap.find(id);
   if (it != vftablesMap.end())
@@ -782,13 +781,12 @@ CIRGenMicrosoftCXXABI::getAddrOfVTable(const CXXRecordDecl *rd,
   }
 
   cir::GlobalLinkageKind linkage =
-      rd->hasAttr<DLLImportAttr>()
-          ? cir::GlobalLinkageKind::LinkOnceODRLinkage
-          : cgm.getVTableLinkage(rd);
+      rd->hasAttr<DLLImportAttr>() ? cir::GlobalLinkageKind::LinkOnceODRLinkage
+                                   : cgm.getVTableLinkage(rd);
 
-  cir::GlobalOp vtable = cgm.createGlobalOp(
-      cgm.getLoc(rd->getLocation()), vftableName,
-      cgm.getVTableComponentType(), /*isConstant=*/true);
+  cir::GlobalOp vtable =
+      cgm.createGlobalOp(cgm.getLoc(rd->getLocation()), vftableName,
+                         cgm.getVTableComponentType(), /*isConstant=*/true);
   vtable.setLinkage(linkage);
 
   if (rd->hasAttr<DLLExportAttr>())
@@ -830,8 +828,8 @@ CIRGenCallee CIRGenMicrosoftCXXABI::getVirtualFunctionPointer(
   cir::PointerType tyPtr = builder.getPointerTo(ty);
   auto *methodDecl = cast<CXXMethodDecl>(gd.getDecl());
 
-  Address vptr =
-      adjustThisArgumentForVirtualFunctionCall(cgf, gd, thisAddr, /*virtualCall=*/true);
+  Address vptr = adjustThisArgumentForVirtualFunctionCall(cgf, gd, thisAddr,
+                                                          /*virtualCall=*/true);
   mlir::Value vtable = cgf.getVTablePtr(mlirLoc, vptr, methodDecl->getParent());
 
   MicrosoftVTableContext &vftContext = cgm.getMicrosoftVTableContext();
@@ -864,10 +862,12 @@ void CIRGenMicrosoftCXXABI::emitVTableDefinitions(CIRGenVTables &cgvt,
 
     mlir::Attribute rtti = nullptr;
     if (cgm.getASTContext().getLangOpts().RTTIData &&
-        llvm::any_of(vtLayout.vtable_components(),
-                     [](const VTableComponent &vtc) { return vtc.isRTTIKind(); })) {
-      rtti = getAddrOfRTTIDescriptor(cgm.getLoc(rd->getLocation()),
-                                     cgm.getASTContext().getCanonicalTagType(rd));
+        llvm::any_of(
+            vtLayout.vtable_components(),
+            [](const VTableComponent &vtc) { return vtc.isRTTIKind(); })) {
+      rtti =
+          getAddrOfRTTIDescriptor(cgm.getLoc(rd->getLocation()),
+                                  cgm.getASTContext().getCanonicalTagType(rd));
     }
 
     cgvt.createVTableInitializer(vtable, vtLayout, rtti,
@@ -883,7 +883,8 @@ void CIRGenMicrosoftCXXABI::emitVirtualInheritanceTables(
     const CXXRecordDecl *rd) {
   if (!rd->getNumVBases())
     return;
-  cgm.errorNYI(rd->getSourceRange(), "emitVirtualInheritanceTables: MSVC VBTables");
+  cgm.errorNYI(rd->getSourceRange(),
+               "emitVirtualInheritanceTables: MSVC VBTables");
 }
 
 void CIRGenMicrosoftCXXABI::initializeHiddenVirtualInheritanceMembers(
@@ -992,9 +993,9 @@ mlir::Value CIRGenMicrosoftCXXABI::performReturnAdjustment(
   if (ra.Virtual.Microsoft.VBIndex) {
     assert(ra.Virtual.Microsoft.VBIndex > 0);
     mlir::Value vbPtr;
-    mlir::Value vbaseOffset = getVBaseOffsetFromVBPtr(
-        cgf, loc, ret, ra.Virtual.Microsoft.VBPtrOffset,
-        ra.Virtual.Microsoft.VBIndex, &vbPtr);
+    mlir::Value vbaseOffset =
+        getVBaseOffsetFromVBPtr(cgf, loc, ret, ra.Virtual.Microsoft.VBPtrOffset,
+                                ra.Virtual.Microsoft.VBIndex, &vbPtr);
     v = cir::PtrStrideOp::create(builder, loc, u8PtrTy, vbPtr, vbaseOffset);
   }
 
@@ -1017,8 +1018,7 @@ mlir::Value CIRGenMicrosoftCXXABI::emitTypeid(CIRGenFunction &cgf,
   cgf.cgm.errorNYI(cgf.getLoc(srcTy->getAsCXXRecordDecl()->getLocation()),
                    "emitTypeid: MSVC ABI");
   return cgf.getBuilder().getNullPtr(
-      typeInfoPtrTy,
-      cgf.getLoc(srcTy->getAsCXXRecordDecl()->getLocation()));
+      typeInfoPtrTy, cgf.getLoc(srcTy->getAsCXXRecordDecl()->getLocation()));
 }
 
 void CIRGenMicrosoftCXXABI::emitBadTypeidCall(CIRGenFunction &cgf,
@@ -1055,16 +1055,14 @@ CIRGenMicrosoftCXXABI::getAddrOfRTTIDescriptor(mlir::Location loc,
   if (auto gv = cgm.getGlobalValue(mangledName))
     return builder.getGlobalViewAttr(voidPtrTy, cast<cir::GlobalOp>(gv));
 
-  cir::GlobalOp gv = cgm.createGlobalOp(
-      loc, mangledName, voidPtrTy, /*isConstant=*/true);
+  cir::GlobalOp gv =
+      cgm.createGlobalOp(loc, mangledName, voidPtrTy, /*isConstant=*/true);
   gv.setLinkage(cir::GlobalLinkageKind::ExternalLinkage);
   return builder.getGlobalViewAttr(voidPtrTy, gv);
 }
 
-CatchTypeInfo
-CIRGenMicrosoftCXXABI::getAddrOfCXXCatchHandlerType(mlir::Location loc,
-                                                    QualType ty,
-                                                    QualType catchHandlerType) {
+CatchTypeInfo CIRGenMicrosoftCXXABI::getAddrOfCXXCatchHandlerType(
+    mlir::Location loc, QualType ty, QualType catchHandlerType) {
   bool isConst, isVolatile, isUnaligned;
   ty = decomposeTypeForEH(cgm.getASTContext(), ty, isConst, isVolatile,
                           isUnaligned);
diff --git a/clang/lib/CIR/CodeGen/CIRGenModule.cpp b/clang/lib/CIR/CodeGen/CIRGenModule.cpp
index 0ef107ecb..95eb6f56e 100644
--- a/clang/lib/CIR/CodeGen/CIRGenModule.cpp
+++ b/clang/lib/CIR/CodeGen/CIRGenModule.cpp
@@ -2193,8 +2193,8 @@ generateStringLiteral(mlir::Location loc, mlir::TypedAttr c,
 
   // Set up extra information and add to the module
   gv.setAlignmentAttr(cgm.getSize(alignment));
-  gv.setLinkageAttr(
-      cir::GlobalLinkageKindAttr::get(cgm.getBuilder().getContext(), linkageKind));
+  gv.setLinkageAttr(cir::GlobalLinkageKindAttr::get(
+      cgm.getBuilder().getContext(), linkageKind));
   assert(!cir::MissingFeatures::opGlobalThreadLocal());
   assert(!cir::MissingFeatures::opGlobalUnnamedAddr());
   CIRGenModule::setInitializer(gv, c);
diff --git a/clang/lib/CIR/Dialect/Transforms/TargetLowering/LowerMicrosoftCXXABI.cpp b/clang/lib/CIR/Dialect/Transforms/TargetLowering/LowerMicrosoftCXXABI.cpp
index e8d881493..ffb913e04 100644
--- a/clang/lib/CIR/Dialect/Transforms/TargetLowering/LowerMicrosoftCXXABI.cpp
+++ b/clang/lib/CIR/Dialect/Transforms/TargetLowering/LowerMicrosoftCXXABI.cpp
@@ -1,4 +1,5 @@
-//===---- LowerMicrosoftCXXABI.cpp - Emit CIR code Microsoft-specific code -===//
+//===---- LowerMicrosoftCXXABI.cpp - Emit CIR code Microsoft-specific code
+//-===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
 // See https://llvm.org/LICENSE.txt for license information.
@@ -59,10 +60,10 @@ public:
     llvm_unreachable("Microsoft ABI member pointer lowering NYI");
   }
 
-  void lowerGetMethod(cir::GetMethodOp op, mlir::Value &callee,
-                      mlir::Value &thisArg, mlir::Value loweredMethod,
-                      mlir::Value loweredObjectPtr,
-                      mlir::ConversionPatternRewriter &rewriter) const override {
+  void
+  lowerGetMethod(cir::GetMethodOp op, mlir::Value &callee, mlir::Value &thisArg,
+                 mlir::Value loweredMethod, mlir::Value loweredObjectPtr,
+                 mlir::ConversionPatternRewriter &rewriter) const override {
     llvm_unreachable("Microsoft ABI method pointer lowering NYI");
   }
 
diff --git a/llvm/lib/ABI/Targets/X86.cpp b/llvm/lib/ABI/Targets/X86.cpp
index 4c8571ac3..a7b7b276a 100644
--- a/llvm/lib/ABI/Targets/X86.cpp
+++ b/llvm/lib/ABI/Targets/X86.cpp
@@ -1405,11 +1405,13 @@ class WinX86_64TargetInfo : public TargetInfo {
 
     if (const auto *RT = dyn_cast<RecordType>(Ty)) {
       if (!RT->canPassInRegisters() || RT->hasFlexibleArrayMember())
-        return getNaturalAlignIndirect(Ty, getAllocaAddrSpace(), /*ByVal=*/false);
+        return getNaturalAlignIndirect(Ty, getAllocaAddrSpace(),
+                                       /*ByVal=*/false);
 
       uint64_t Width = RT->getSizeInBits().getFixedValue();
       if (Width > 64 || !llvm::isPowerOf2_64(Width))
-        return getNaturalAlignIndirect(Ty, getAllocaAddrSpace(), /*ByVal=*/false);
+        return getNaturalAlignIndirect(Ty, getAllocaAddrSpace(),
+                                       /*ByVal=*/false);
 
       const Type *CoerceTy =
           TB.getIntegerType(TypeSize::getFixed(Width), /*IsSigned=*/false);
@@ -1417,11 +1419,13 @@ class WinX86_64TargetInfo : public TargetInfo {
     }
 
     if (const auto *IT = dyn_cast<IntegerType>(Ty)) {
-      // MSVC WinX86_64 ABI only extends 1-bit booleans; other small integers are passed directly.
+      // MSVC WinX86_64 ABI only extends 1-bit booleans; other small integers
+      // are passed directly.
       if (IT->getSizeInBits().getFixedValue() == 1)
         return ArgInfo::getExtend(Ty, IT->isSigned());
       if (IT->getSizeInBits().getFixedValue() > 64)
-        return getNaturalAlignIndirect(Ty, getAllocaAddrSpace(), /*ByVal=*/false);
+        return getNaturalAlignIndirect(Ty, getAllocaAddrSpace(),
+                                       /*ByVal=*/false);
       return ArgInfo::getDirect();
     }
 
@@ -1431,7 +1435,8 @@ class WinX86_64TargetInfo : public TargetInfo {
     if (isAggregateTypeForABI(Ty)) {
       uint64_t Width = Ty->getSizeInBits().getFixedValue();
       if (Width > 64 || !llvm::isPowerOf2_64(Width))
-        return getNaturalAlignIndirect(Ty, getAllocaAddrSpace(), /*ByVal=*/false);
+        return getNaturalAlignIndirect(Ty, getAllocaAddrSpace(),
+                                       /*ByVal=*/false);
       const Type *CoerceTy =
           TB.getIntegerType(TypeSize::getFixed(Width), /*IsSigned=*/false);
       return ArgInfo::getDirect(CoerceTy);
@@ -1445,20 +1450,17 @@ public:
                       const ABICompatInfo &Compat)
       : TargetInfo(TB), AVXLevel(AVXLevel), CompatInfo(Compat) {}
 
-  const ABICompatInfo &getABICompatInfo() const override {
-    return CompatInfo;
-  }
+  const ABICompatInfo &getABICompatInfo() const override { return CompatInfo; }
 
   void computeInfo(FunctionInfo &FI) const override {
-    FI.getReturnInfo() = classify(FI.getReturnType(), /*IsReturn=*/true,
-                                  FI.isInstanceMethod());
+    FI.getReturnInfo() =
+        classify(FI.getReturnType(), /*IsReturn=*/true, FI.isInstanceMethod());
     for (auto &Arg : FI.arguments())
       Arg.Info = classify(Arg.getType(), /*IsReturn=*/false,
                           /*IsInstanceMethod=*/false);
   }
 };
 
-
 } // namespace
 
 std::unique_ptr<TargetInfo>
diff --git a/llvm/unittests/ABI/TypesTest.cpp b/llvm/unittests/ABI/TypesTest.cpp
index f37592f01..10cd04d54 100644
--- a/llvm/unittests/ABI/TypesTest.cpp
+++ b/llvm/unittests/ABI/TypesTest.cpp
@@ -217,15 +217,21 @@ TEST_F(ABITypesTest, ScalarABISize) {
 TEST_F(ABITypesTest, IntegerTypeFromTypeSize) {
   // Power-of-2 byte sizes.
   EXPECT_EQ(TB.getIntegerType(TypeSize::getFixed(8))->getAlignment(), Align(1));
-  EXPECT_EQ(TB.getIntegerType(TypeSize::getFixed(16))->getAlignment(), Align(2));
-  EXPECT_EQ(TB.getIntegerType(TypeSize::getFixed(32))->getAlignment(), Align(4));
-  EXPECT_EQ(TB.getIntegerType(TypeSize::getFixed(64))->getAlignment(), Align(8));
+  EXPECT_EQ(TB.getIntegerType(TypeSize::getFixed(16))->getAlignment(),
+            Align(2));
+  EXPECT_EQ(TB.getIntegerType(TypeSize::getFixed(32))->getAlignment(),
+            Align(4));
+  EXPECT_EQ(TB.getIntegerType(TypeSize::getFixed(64))->getAlignment(),
+            Align(8));
 
   // Non-byte and non-power-of-2 byte sizes should not assert on alignment.
   EXPECT_EQ(TB.getIntegerType(TypeSize::getFixed(1))->getAlignment(), Align(1));
-  EXPECT_EQ(TB.getIntegerType(TypeSize::getFixed(24))->getAlignment(), Align(2));
-  EXPECT_EQ(TB.getIntegerType(TypeSize::getFixed(40))->getAlignment(), Align(4));
-  EXPECT_EQ(TB.getIntegerType(TypeSize::getFixed(48))->getAlignment(), Align(4));
+  EXPECT_EQ(TB.getIntegerType(TypeSize::getFixed(24))->getAlignment(),
+            Align(2));
+  EXPECT_EQ(TB.getIntegerType(TypeSize::getFixed(40))->getAlignment(),
+            Align(4));
+  EXPECT_EQ(TB.getIntegerType(TypeSize::getFixed(48))->getAlignment(),
+            Align(4));
 }
 
 // A bool element takes one bit and a one-bit _BitInt element a whole byte.  The
diff --git a/llvm/unittests/ABI/WinX86_64TargetInfoTest.cpp b/llvm/unittests/ABI/WinX86_64TargetInfoTest.cpp
index 84e416887..13522c8b0 100644
--- a/llvm/unittests/ABI/WinX86_64TargetInfoTest.cpp
+++ b/llvm/unittests/ABI/WinX86_64TargetInfoTest.cpp
@@ -47,8 +47,7 @@ protected:
   const ABIType *F64;
 
   WinX86_64TargetInfoTest()
-      : TB(Alloc),
-        Void(TB.getVoidType()),
+      : TB(Alloc), Void(TB.getVoidType()),
         I1(TB.getIntegerType(1, llvm::Align(1), /*Signed=*/false)),
         I8(TB.getIntegerType(8, llvm::Align(1), /*Signed=*/true)),
         I16(TB.getIntegerType(16, llvm::Align(2), /*Signed=*/true)),
@@ -62,8 +61,9 @@ protected:
                                      X86AVXABILevel::None, ABICompatInfo());
   }
 
-  const ABIType *structOfBytes(uint64_t NumBytes,
-                               RecordFlags Flags = RecordFlags::CanPassInRegisters) {
+  const ABIType *
+  structOfBytes(uint64_t NumBytes,
+                RecordFlags Flags = RecordFlags::CanPassInRegisters) {
     llvm::SmallVector<FieldInfo, 8> Fields;
     for (uint64_t I = 0; I < NumBytes; ++I)
       Fields.emplace_back(I8, I * 8);
@@ -185,10 +185,10 @@ TEST_F(WinX86_64TargetInfoTest, InstanceMethodStructReturn) {
   std::unique_ptr<FunctionInfo> FI;
   std::unique_ptr<TargetInfo> TI;
 
-  // Even a 4-byte struct returned from an instance method is indirect with SRetAfterThis = true.
+  // Even a 4-byte struct returned from an instance method is indirect with
+  // SRetAfterThis = true.
   const ABIType *S4 = structOfBytes(4);
-  const ArgInfo &Info =
-      classifyReturn(S4, FI, TI, /*IsInstanceMethod=*/true);
+  const ArgInfo &Info = classifyReturn(S4, FI, TI, /*IsInstanceMethod=*/true);
   EXPECT_TRUE(Info.isIndirect());
   EXPECT_FALSE(Info.getIndirectByVal());
   EXPECT_TRUE(Info.isSRetAfterThis());
diff --git a/mlir/lib/Target/LLVMIR/Dialect/LLVMIR/LLVMToLLVMIRTranslation.cpp b/mlir/lib/Target/LLVMIR/Dialect/LLVMIR/LLVMToLLVMIRTranslation.cpp
index 4883f3636..cfda8c586 100644
--- a/mlir/lib/Target/LLVMIR/Dialect/LLVMIR/LLVMToLLVMIRTranslation.cpp
+++ b/mlir/lib/Target/LLVMIR/Dialect/LLVMIR/LLVMToLLVMIRTranslation.cpp
@@ -790,8 +790,8 @@ convertOperationImpl(Operation &opInst, llvm::IRBuilderBase &builder,
     llvm::BasicBlock *unwindBB = nullptr;
     if (csOp.hasUnwindDest())
       unwindBB = moduleTranslation.lookupBlock(csOp.getUnwindDest());
-    llvm::CatchSwitchInst *cs = builder.CreateCatchSwitch(
-        parentPad, unwindBB, csOp.getNumHandlers());
+    llvm::CatchSwitchInst *cs =
+        builder.CreateCatchSwitch(parentPad, unwindBB, csOp.getNumHandlers());
     for (Block *handler : csOp.getHandlers())
       cs->addHandler(moduleTranslation.lookupBlock(handler));
     moduleTranslation.mapValue(csOp.getResult(), cs);

``````````

</details>


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


More information about the Mlir-commits mailing list