[Mlir-commits] [flang] [mlir] [MLIR][LLVMIR] Add support for the full form of global_{ctor, dtor} (PR #133176)

Tobias Gysi llvmlistbot at llvm.org
Thu Mar 27 00:13:32 PDT 2025


================
@@ -2508,6 +2508,17 @@ LogicalResult GlobalOp::verifyRegions() {
 // LLVM::GlobalCtorsOp
 //===----------------------------------------------------------------------===//
 
+LogicalResult checkGlobalXtorData(Operation *op, ArrayAttr data) {
+  if (data.empty())
+    return success();
+
+  if (llvm::all_of(data.getAsRange<Attribute>(), [](Attribute v) {
+        return isa<FlatSymbolRefAttr>(v) || isa<ZeroAttr>(v);
----------------
gysit wrote:

```suggestion
        return isa<FlatSymbolRefAttr, ZeroAttr>(v);
```
nit: I believe this should work as well.

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


More information about the Mlir-commits mailing list