[clang] [CIR] Add support for global linkage and visibility (PR #141973)

2025-05-30 Thread LLVM Continuous Integration via cfe-commits
llvm-ci wrote: LLVM Buildbot has detected a new failure on builder `clang-ppc64-aix` running on `aix-ppc64` while building `clang` at step 6 "test-build-unified-tree-check-all". Full details are available at: https://lab.llvm.org/buildbot/#/builders/64/builds/3945 Here is the relevant piece

[clang] [CIR] Add support for global linkage and visibility (PR #141973)

2025-05-30 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor closed https://github.com/llvm/llvm-project/pull/141973 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Add support for global linkage and visibility (PR #141973)

2025-05-30 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor updated https://github.com/llvm/llvm-project/pull/141973 >From 70aa8d668cf610eb7d2486b60112591a19d3db89 Mon Sep 17 00:00:00 2001 From: Andy Kaylor Date: Fri, 23 May 2025 11:03:05 -0700 Subject: [PATCH 1/2] [CIR] Add support for global linkage and visibility This c

[clang] [CIR] Add support for global linkage and visibility (PR #141973)

2025-05-30 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor updated https://github.com/llvm/llvm-project/pull/141973 >From 70aa8d668cf610eb7d2486b60112591a19d3db89 Mon Sep 17 00:00:00 2001 From: Andy Kaylor Date: Fri, 23 May 2025 11:03:05 -0700 Subject: [PATCH 1/3] [CIR] Add support for global linkage and visibility This c

[clang] [CIR] Add support for global linkage and visibility (PR #141973)

2025-05-30 Thread via cfe-commits
github-actions[bot] wrote: :warning: C/C++ code formatter, clang-format found issues in your code. :warning: You can test this locally with the following command: ``bash git-clang-format --diff HEAD~1 HEAD --extensions c,h,cpp -- clang/include/clang/CIR/Dialect/IR/CIRAttrs.h cl

[clang] [CIR] Add support for global linkage and visibility (PR #141973)

2025-05-30 Thread Henrich Lauko via cfe-commits
https://github.com/xlauko edited https://github.com/llvm/llvm-project/pull/141973 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Add support for global linkage and visibility (PR #141973)

2025-05-30 Thread Henrich Lauko via cfe-commits
https://github.com/xlauko edited https://github.com/llvm/llvm-project/pull/141973 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Add support for global linkage and visibility (PR #141973)

2025-05-30 Thread Henrich Lauko via cfe-commits
@@ -276,4 +276,47 @@ def ConstPtrAttr : CIR_Attr<"ConstPtr", "ptr", [TypedAttrInterface]> { }]; } +//===--===// +// VisibilityAttr +//===-

[clang] [CIR] Add support for global linkage and visibility (PR #141973)

2025-05-30 Thread Henrich Lauko via cfe-commits
@@ -276,4 +276,47 @@ def ConstPtrAttr : CIR_Attr<"ConstPtr", "ptr", [TypedAttrInterface]> { }]; } +//===--===// +// VisibilityAttr +//===-

[clang] [CIR] Add support for global linkage and visibility (PR #141973)

2025-05-30 Thread Henrich Lauko via cfe-commits
@@ -276,4 +276,47 @@ def ConstPtrAttr : CIR_Attr<"ConstPtr", "ptr", [TypedAttrInterface]> { }]; } +//===--===// +// VisibilityAttr +//===-

[clang] [CIR] Add support for global linkage and visibility (PR #141973)

2025-05-30 Thread Henrich Lauko via cfe-commits
@@ -1643,17 +1644,31 @@ def GlobalOp : CIR_Op<"global"> { described by the type of the variable. The `linkage` tracks C/C++ linkage types, currently very similar to LLVM's. +Symbol visibility in `sym_visibility` is defined in terms of MLIR's visibility +and ve

[clang] [CIR] Add support for global linkage and visibility (PR #141973)

2025-05-29 Thread Bruno Cardoso Lopes via cfe-commits
@@ -1075,6 +1089,135 @@ void CIRGenModule::emitTentativeDefinition(const VarDecl *d) { emitGlobalVarDefinition(d); } +static bool shouldAssumeDSOLocal(const CIRGenModule &cgm, + cir::CIRGlobalValueInterface gv) { + if (gv.hasLocalLinkage())

[clang] [CIR] Add support for global linkage and visibility (PR #141973)

2025-05-29 Thread Bruno Cardoso Lopes via cfe-commits
@@ -966,8 +966,7 @@ void CIRToLLVMGlobalOpLowering::setupRegionInitializedLLVMGlobalOp( const bool isConst = false; assert(!cir::MissingFeatures::addressSpace()); const unsigned addrSpace = 0; - assert(!cir::MissingFeatures::opGlobalDSOLocal()); - const bool isDsoLocal

[clang] [CIR] Add support for global linkage and visibility (PR #141973)

2025-05-29 Thread Bruno Cardoso Lopes via cfe-commits
@@ -1075,6 +1089,135 @@ void CIRGenModule::emitTentativeDefinition(const VarDecl *d) { emitGlobalVarDefinition(d); } +static bool shouldAssumeDSOLocal(const CIRGenModule &cgm, + cir::CIRGlobalValueInterface gv) { + if (gv.hasLocalLinkage())

[clang] [CIR] Add support for global linkage and visibility (PR #141973)

2025-05-29 Thread Bruno Cardoso Lopes via cfe-commits
@@ -1021,8 +1020,7 @@ mlir::LogicalResult CIRToLLVMGlobalOpLowering::matchAndRewrite( const bool isConst = false; assert(!cir::MissingFeatures::addressSpace()); const unsigned addrSpace = 0; - assert(!cir::MissingFeatures::opGlobalDSOLocal()); - const bool isDsoLocal =

[clang] [CIR] Add support for global linkage and visibility (PR #141973)

2025-05-29 Thread Bruno Cardoso Lopes via cfe-commits
https://github.com/bcardosolopes approved this pull request. LGTM, some minor `auto` nits https://github.com/llvm/llvm-project/pull/141973 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commi

[clang] [CIR] Add support for global linkage and visibility (PR #141973)

2025-05-29 Thread Bruno Cardoso Lopes via cfe-commits
https://github.com/bcardosolopes edited https://github.com/llvm/llvm-project/pull/141973 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Add support for global linkage and visibility (PR #141973)

2025-05-29 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor created https://github.com/llvm/llvm-project/pull/141973 This change adds support for the CIRGlobalValueInterface and attributes for visibility and comdat to GlobalOp. The comdat attribute isn't correctly calculated yet, but it was required for the CIRGlobalValue

[clang] [CIR] Add support for global linkage and visibility (PR #141973)

2025-05-29 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clangir Author: Andy Kaylor (andykaylor) Changes This change adds support for the CIRGlobalValueInterface and attributes for visibility and comdat to GlobalOp. The comdat attribute isn't correctly calculated yet, but it was required for the CIRGlobalV