[flang-commits] [flang] [mlir] [mlir] Align num elements type to LLVM ArrayType (PR #93230)

via flang-commits flang-commits at lists.llvm.org
Fri May 24 12:17:14 PDT 2024


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 66db7c609cebb8aa7db17f83fbc9f79be0cd5af1 280e9ef9c3b191a5f2abaf63984601e7944b0f94 -- mlir/lib/Dialect/LLVMIR/IR/LLVMTypes.cpp mlir/lib/Target/LLVMIR/ModuleTranslation.cpp
``````````

</details>

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

``````````diff
diff --git a/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp b/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp
index c13c9dcb66..a1f959a5eb 100644
--- a/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp
+++ b/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp
@@ -635,13 +635,16 @@ llvm::Constant *mlir::LLVM::detail::getLLVMConstant(
       if (child->isZeroValue()) {
         return llvm::ConstantAggregateZero::get(arrayType);
       } else {
-        if (llvm::ConstantDataSequential::isElementTypeCompatible(elementType)) {
+        if (llvm::ConstantDataSequential::isElementTypeCompatible(
+                elementType)) {
           // TODO: Handle all compatible types. This code only handle i32.
-          if (llvm::IntegerType *iTy = dyn_cast<llvm::IntegerType>(elementType)) {
+          if (llvm::IntegerType *iTy =
+                  dyn_cast<llvm::IntegerType>(elementType)) {
             if (llvm::ConstantInt *ci = dyn_cast<llvm::ConstantInt>(child)) {
               if (ci->getBitWidth() == 32) {
                 SmallVector<int32_t> constants(numElements, ci->getZExtValue());
-                return llvm::ConstantDataArray::get(elementType->getContext(), constants);
+                return llvm::ConstantDataArray::get(elementType->getContext(),
+                                                    constants);
               }
             }
           }

``````````

</details>


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


More information about the flang-commits mailing list