[flang-commits] [flang] [flang] translate derived type array init to attribute if possible (PR #140268)

Slava Zakharin via flang-commits flang-commits at lists.llvm.org
Mon May 19 09:55:50 PDT 2025


================
@@ -0,0 +1,34 @@
+//===-- LLVMInsertChainFolder.h --  insertvalue chain folder ----*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// Helper to fold LLVM dialect llvm.insertvalue chain representing constants
+// into an Attribute representation.
+// This sits in Flang because it is incomplete and tailored for flang needs.
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/Support/LogicalResult.h"
+
+namespace mlir {
+class Attribute;
+class OpBuilder;
+class Value;
+} // namespace mlir
+
+namespace fir {
+
+/// Attempt to fold an llvm.insertvalue chain into an attribute representation
+/// suitable as llvm.constant operand. The returned value will be a null pointer
----------------
vzakhari wrote:

```suggestion
/// suitable as llvm.constant operand. The returned value will be llvm::Failure
```

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


More information about the flang-commits mailing list