[Mlir-commits] [llvm] [mlir] msvc abi/mlir funclet ops (PR #233257)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Sun Oct 18 09:16:20 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 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/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/233257


More information about the Mlir-commits mailing list