[llvm-branch-commits] [flang] [flang][OpenMP] Add support for copyprivate (PR #80485)

2024-02-02 Thread Valentin Clement バレンタイン クレメン via llvm-branch-commits


@@ -1092,6 +1040,79 @@ class FirConverter : public 
Fortran::lower::AbstractConverter {
 return true;
   }
 
+  void copyVar(const Fortran::semantics::Symbol &sym,
+   const Fortran::lower::SymbolBox &lhs_sb,
+   const Fortran::lower::SymbolBox &rhs_sb) {
+mlir::Location loc = genLocation(sym.name());
+if (lowerToHighLevelFIR())
+  copyVarHLFIR(loc, lhs_sb.getAddr(), rhs_sb.getAddr());
+else
+  copyVarFIR(loc, sym, lhs_sb, rhs_sb);
+  }
+
+  void copyVarHLFIR(mlir::Location loc, mlir::Value dst, mlir::Value src) {
+assert(lowerToHighLevelFIR());
+hlfir::Entity lhs{dst};
+hlfir::Entity rhs{src};
+// Temporary_lhs is set to true in hlfir.assign below to avoid user
+// assignment to be used and finalization to be called on the LHS.
+// This may or may not be correct but mimics the current behaviour
+// without HLFIR.
+auto copyData = [&](hlfir::Entity l, hlfir::Entity r) {
+  // Dereference RHS and load it if trivial scalar.
+  r = hlfir::loadTrivialScalar(loc, *builder, r);
+  builder->create(
+  loc, r, l,
+  /*isWholeAllocatableAssignment=*/false,
+  /*keepLhsLengthInAllocatableAssignment=*/false,
+  /*temporary_lhs=*/true);
+};
+if (lhs.isAllocatable()) {
+  // Deep copy allocatable if it is allocated.
+  // Note that when allocated, the RHS is already allocated with the LHS
+  // shape for copy on entry in createHostAssociateVarClone.
+  // For lastprivate, this assumes that the RHS was not reallocated in
+  // the OpenMP region.
+  lhs = hlfir::derefPointersAndAllocatables(loc, *builder, lhs);
+  mlir::Value addr = hlfir::genVariableRawAddress(loc, *builder, lhs);
+  mlir::Value isAllocated = builder->genIsNotNullAddr(loc, addr);
+  builder->genIfThen(loc, isAllocated)
+  .genThen([&]() {
+// Copy the DATA, not the descriptors.
+copyData(lhs, rhs);
+  })
+  .end();
+} else if (lhs.isPointer()) {
+  // Set LHS target to the target of RHS (do not copy the RHS
+  // target data into the LHS target storage).
+  auto loadVal = builder->create(loc, rhs);
+  builder->create(loc, loadVal, lhs);
+} else {
+  // Non ALLOCATABLE/POINTER variable. Simple DATA copy.
+  copyData(lhs, rhs);
+}
+  }
+
+  void copyVarFIR(mlir::Location loc, const Fortran::semantics::Symbol &sym,
+  const Fortran::lower::SymbolBox &lhs_sb,
+  const Fortran::lower::SymbolBox &rhs_sb) {
+assert(!lowerToHighLevelFIR());
+fir::ExtendedValue lhs = symBoxToExtendedValue(lhs_sb);
+fir::ExtendedValue rhs = symBoxToExtendedValue(rhs_sb);
+mlir::Type symType = genType(sym);
+if (auto seqTy = symType.dyn_cast()) {
+  Fortran::lower::StatementContext stmtCtx;
+  Fortran::lower::createSomeArrayAssignment(*this, lhs, rhs, localSymbols,
+stmtCtx);
+  stmtCtx.finalizeAndReset();
+} else if (lhs.getBoxOf()) {
+  fir::factory::CharacterExprHelper{*builder, loc}.createAssign(lhs, rhs);
+} else {
+  auto loadVal = builder->create(loc, fir::getBase(rhs));
+  builder->create(loc, loadVal, fir::getBase(lhs));
+}
+  }
+

clementval wrote:

Could this be in OpenMP.cpp? It would remove the need to add a function to the 
converter. 

https://github.com/llvm/llvm-project/pull/80485
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] PR for llvm/llvm-project#77871 (PR #80513)

2024-02-02 Thread via llvm-branch-commits

llvmbot wrote:




@llvm/pr-subscribers-pgo

Author: None (llvmbot)


Changes

resolves llvm/llvm-project#77871

---
Full diff: https://github.com/llvm/llvm-project/pull/80513.diff


7 Files Affected:

- (modified) llvm/lib/ProfileData/Coverage/CoverageMapping.cpp (+197-43) 
- (modified) llvm/lib/ProfileData/Coverage/CoverageMappingWriter.cpp (+9-1) 
- (added) llvm/test/tools/llvm-cov/Inputs/mcdc-macro.c (+20) 
- (added) llvm/test/tools/llvm-cov/Inputs/mcdc-macro.o () 
- (added) llvm/test/tools/llvm-cov/Inputs/mcdc-macro.proftext (+62) 
- (added) llvm/test/tools/llvm-cov/mcdc-macro.test (+99) 
- (modified) llvm/unittests/ProfileData/CoverageMappingTest.cpp (+36) 


``diff
diff --git a/llvm/lib/ProfileData/Coverage/CoverageMapping.cpp 
b/llvm/lib/ProfileData/Coverage/CoverageMapping.cpp
index da8e1d87319dd..a357b4cb49211 100644
--- a/llvm/lib/ProfileData/Coverage/CoverageMapping.cpp
+++ b/llvm/lib/ProfileData/Coverage/CoverageMapping.cpp
@@ -14,6 +14,7 @@
 #include "llvm/ProfileData/Coverage/CoverageMapping.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/DenseMap.h"
+#include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/SmallBitVector.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringExtras.h"
@@ -583,6 +584,160 @@ static unsigned getMaxBitmapSize(const 
CounterMappingContext &Ctx,
   return MaxBitmapID + (SizeInBits / CHAR_BIT);
 }
 
+namespace {
+
+/// Collect Decisions, Branchs, and Expansions and associate them.
+class MCDCDecisionRecorder {
+private:
+  /// This holds the DecisionRegion and MCDCBranches under it.
+  /// Also traverses Expansion(s).
+  /// The Decision has the number of MCDCBranches and will complete
+  /// when it is filled with unique ConditionID of MCDCBranches.
+  struct DecisionRecord {
+const CounterMappingRegion *DecisionRegion;
+
+/// They are reflected from DecisionRegion for convenience.
+LineColPair DecisionStartLoc;
+LineColPair DecisionEndLoc;
+
+/// This is passed to `MCDCRecordProcessor`, so this should be compatible
+/// to`ArrayRef`.
+SmallVector MCDCBranches;
+
+/// IDs that are stored in MCDCBranches
+/// Complete when all IDs (1 to NumConditions) are met.
+DenseSet ConditionIDs;
+
+/// Set of IDs of Expansion(s) that are relevant to DecisionRegion
+/// and its children (via expansions).
+/// FileID  pointed by ExpandedFileID is dedicated to the expansion, so
+/// the location in the expansion doesn't matter.
+DenseSet ExpandedFileIDs;
+
+DecisionRecord(const CounterMappingRegion &Decision)
+: DecisionRegion(&Decision), DecisionStartLoc(Decision.startLoc()),
+  DecisionEndLoc(Decision.endLoc()) {
+  assert(Decision.Kind == CounterMappingRegion::MCDCDecisionRegion);
+}
+
+/// Determine whether DecisionRecord dominates `R`.
+bool dominates(const CounterMappingRegion &R) const {
+  // Determine whether `R` is included in `DecisionRegion`.
+  if (R.FileID == DecisionRegion->FileID &&
+  R.startLoc() >= DecisionStartLoc && R.endLoc() <= DecisionEndLoc)
+return true;
+
+  // Determine whether `R` is pointed by any of Expansions.
+  return ExpandedFileIDs.contains(R.FileID);
+}
+
+enum Result {
+  NotProcessed = 0, /// Irrelevant to this Decision
+  Processed,/// Added to this Decision
+  Completed,/// Added and filled this Decision
+};
+
+/// Add Branch into the Decision
+/// \param Branch expects MCDCBranchRegion
+/// \returns NotProcessed/Processed/Completed
+Result addBranch(const CounterMappingRegion &Branch) {
+  assert(Branch.Kind == CounterMappingRegion::MCDCBranchRegion);
+
+  auto ConditionID = Branch.MCDCParams.ID;
+  assert(ConditionID > 0 && "ConditionID should begin with 1");
+
+  if (ConditionIDs.contains(ConditionID) ||
+  ConditionID > DecisionRegion->MCDCParams.NumConditions)
+return NotProcessed;
+
+  if (!this->dominates(Branch))
+return NotProcessed;
+
+  assert(MCDCBranches.size() < DecisionRegion->MCDCParams.NumConditions);
+
+  // Put `ID=1` in front of `MCDCBranches` for convenience
+  // even if `MCDCBranches` is not topological.
+  if (ConditionID == 1)
+MCDCBranches.insert(MCDCBranches.begin(), &Branch);
+  else
+MCDCBranches.push_back(&Branch);
+
+  // Mark `ID` as `assigned`.
+  ConditionIDs.insert(ConditionID);
+
+  // `Completed` when `MCDCBranches` is full
+  return (MCDCBranches.size() == DecisionRegion->MCDCParams.NumConditions
+  ? Completed
+  : Processed);
+}
+
+/// Record Expansion if it is relevant to this Decision.
+/// Each `Expansion` may nest.
+/// \returns true if recorded.
+bool recordExpansion(const CounterMappingRegion &Expansion) {
+  if (!this->dominates(Expansion))
+return false;
+
+  ExpandedFileIDs.insert(Expansion.ExpandedFileID);
+  return true;
+ 

[llvm-branch-commits] [llvm] PR for llvm/llvm-project#77871 (PR #80513)

2024-02-02 Thread via llvm-branch-commits

llvmbot wrote:

@ornata @MaskRay What do you think about merging this PR to the release branch?

https://github.com/llvm/llvm-project/pull/80513
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] PR for llvm/llvm-project#77871 (PR #80513)

2024-02-02 Thread via llvm-branch-commits

https://github.com/llvmbot created 
https://github.com/llvm/llvm-project/pull/80513

resolves llvm/llvm-project#77871

>From 8e996ec222ce319c54a7c64315ac2761f6851b32 Mon Sep 17 00:00:00 2001
From: NAKAMURA Takumi 
Date: Fri, 2 Feb 2024 18:37:10 +0900
Subject: [PATCH 1/2] CoverageMappingWriter: Emit `Decision` before `Expansion`
 (#78966)

To relax scanning record, tweak order by `Decision < Expansion`, or
`Expansion` could not be distinguished whether it belonged to `Decision`
or not.

Relevant to #77871

(cherry picked from commit 438fe1db09b0c20708ea1020519d8073c37feae8)
---
 .../Coverage/CoverageMappingWriter.cpp| 10 +-
 .../ProfileData/CoverageMappingTest.cpp   | 36 +++
 2 files changed, 45 insertions(+), 1 deletion(-)

diff --git a/llvm/lib/ProfileData/Coverage/CoverageMappingWriter.cpp 
b/llvm/lib/ProfileData/Coverage/CoverageMappingWriter.cpp
index 1c7d8a8909c48..27727f216b051 100644
--- a/llvm/lib/ProfileData/Coverage/CoverageMappingWriter.cpp
+++ b/llvm/lib/ProfileData/Coverage/CoverageMappingWriter.cpp
@@ -167,7 +167,15 @@ void CoverageMappingWriter::write(raw_ostream &OS) {
   return LHS.FileID < RHS.FileID;
 if (LHS.startLoc() != RHS.startLoc())
   return LHS.startLoc() < RHS.startLoc();
-return LHS.Kind < RHS.Kind;
+
+// Put `Decision` before `Expansion`.
+auto getKindKey = [](CounterMappingRegion::RegionKind Kind) {
+  return (Kind == CounterMappingRegion::MCDCDecisionRegion
+  ? 2 * CounterMappingRegion::ExpansionRegion - 1
+  : 2 * Kind);
+};
+
+return getKindKey(LHS.Kind) < getKindKey(RHS.Kind);
   });
 
   // Write out the fileid -> filename mapping.
diff --git a/llvm/unittests/ProfileData/CoverageMappingTest.cpp 
b/llvm/unittests/ProfileData/CoverageMappingTest.cpp
index 23f66a0232ddb..2849781a9dc43 100644
--- a/llvm/unittests/ProfileData/CoverageMappingTest.cpp
+++ b/llvm/unittests/ProfileData/CoverageMappingTest.cpp
@@ -890,6 +890,42 @@ TEST_P(CoverageMappingTest, non_code_region_bitmask) {
   ASSERT_EQ(1U, Names.size());
 }
 
+// Test the order of MCDCDecision before Expansion
+TEST_P(CoverageMappingTest, decision_before_expansion) {
+  startFunction("foo", 0x1234);
+  addCMR(Counter::getCounter(0), "foo", 3, 23, 5, 2);
+
+  // This(4:11) was put after Expansion(4:11) before the fix
+  addMCDCDecisionCMR(0, 2, "foo", 4, 11, 4, 20);
+
+  addExpansionCMR("foo", "A", 4, 11, 4, 12);
+  addExpansionCMR("foo", "B", 4, 19, 4, 20);
+  addCMR(Counter::getCounter(0), "A", 1, 14, 1, 17);
+  addCMR(Counter::getCounter(0), "A", 1, 14, 1, 17);
+  addMCDCBranchCMR(Counter::getCounter(0), Counter::getCounter(1), 1, 2, 0, 
"A",
+   1, 14, 1, 17);
+  addCMR(Counter::getCounter(1), "B", 1, 14, 1, 17);
+  addMCDCBranchCMR(Counter::getCounter(1), Counter::getCounter(2), 2, 0, 0, 
"B",
+   1, 14, 1, 17);
+
+  // InputFunctionCoverageData::Regions is rewritten after the write.
+  auto InputRegions = InputFunctions.back().Regions;
+
+  writeAndReadCoverageRegions();
+
+  const auto &OutputRegions = OutputFunctions.back().Regions;
+
+  size_t N = ArrayRef(InputRegions).size();
+  ASSERT_EQ(N, OutputRegions.size());
+  for (size_t I = 0; I < N; ++I) {
+ASSERT_EQ(InputRegions[I].Kind, OutputRegions[I].Kind);
+ASSERT_EQ(InputRegions[I].FileID, OutputRegions[I].FileID);
+ASSERT_EQ(InputRegions[I].ExpandedFileID, OutputRegions[I].ExpandedFileID);
+ASSERT_EQ(InputRegions[I].startLoc(), OutputRegions[I].startLoc());
+ASSERT_EQ(InputRegions[I].endLoc(), OutputRegions[I].endLoc());
+  }
+}
+
 TEST_P(CoverageMappingTest, strip_filename_prefix) {
   ProfileWriter.addRecord({"file1:func", 0x1234, {0}}, Err);
 

>From 90ce5b57f228eee59372a77cf02f38be5e10e17c Mon Sep 17 00:00:00 2001
From: NAKAMURA Takumi 
Date: Fri, 2 Feb 2024 20:34:12 +0900
Subject: [PATCH 2/2] [Coverage] Let `Decision` take account of expansions
 (#78969)

The current implementation (D138849) assumes `Branch`(es) would follow
after the corresponding `Decision`. It is not true if `Branch`(es) are
forwarded to expanded file ID. As a result, consecutive `Decision`(s)
would be confused with insufficient number of `Branch`(es).

`Expansion` will point `Branch`(es) in other file IDs if `Expansion` is
included in the range of `Decision`.

Fixes #77871

-

Co-authored-by: Alan Phipps 
(cherry picked from commit d912f1f0cb49465b08f82fae89ece222404e5640)
---
 .../ProfileData/Coverage/CoverageMapping.cpp  | 240 ++
 llvm/test/tools/llvm-cov/Inputs/mcdc-macro.c  |  20 ++
 llvm/test/tools/llvm-cov/Inputs/mcdc-macro.o  | Bin 0 -> 6424 bytes
 .../tools/llvm-cov/Inputs/mcdc-macro.proftext |  62 +
 llvm/test/tools/llvm-cov/mcdc-macro.test  |  99 
 5 files changed, 378 insertions(+), 43 deletions(-)
 create mode 100644 llvm/test/tools/llvm-cov/Inputs/mcdc-macro.c
 create mode 100644 llvm/test/tools/llvm-cov/Inputs/mcdc-macro.o
 create mode 100644 llvm/test/tools/llvm-cov/Inputs/mcdc

[llvm-branch-commits] [llvm] PR for llvm/llvm-project#77871 (PR #80513)

2024-02-02 Thread via llvm-branch-commits

https://github.com/llvmbot milestoned 
https://github.com/llvm/llvm-project/pull/80513
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [mlir] [mlir] Start moving some builtin type formats to the dialect (PR #80421)

2024-02-02 Thread Markus Böck via llvm-branch-commits


@@ -25,7 +25,8 @@ include "mlir/IR/BuiltinTypeInterfaces.td"
 // Base class for Builtin dialect types.
 class Builtin_Type traits = [],
string baseCppClass = "::mlir::Type">
-: TypeDef {
+: TypeDef`) since the 
logic currently assumes that verbose types always lead with the dialect name 
(`!builtin`).
I tried a bit what logic changes would be required and did not find an obvious 
answer. It therefore also breaks existing input parsing.
So to summarize:
* To stay compatible with existing syntax and tests and avoid creating massive 
churn
* To avoid incompatiblity with the current implementation of stripped parsing 
and printing

If you like I can take a closer look at fixing `parseCustomTypeWithFallback` 
here, but thought I'd rather make that a future PR to keep this one backwards 
compatible.

https://github.com/llvm/llvm-project/pull/80421
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [lld] [llvm] ReleaseNotes: add lld/ELF notes (PR #80393)

2024-02-02 Thread Fangrui Song via llvm-branch-commits

MaskRay wrote:

@tstellar This should be in a good shape to be merged:) Thanks

https://github.com/llvm/llvm-project/pull/80393
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [lld] [llvm] ReleaseNotes: add lld/ELF notes (PR #80393)

2024-02-02 Thread Fangrui Song via llvm-branch-commits

https://github.com/MaskRay milestoned 
https://github.com/llvm/llvm-project/pull/80393
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [lld] [llvm] ReleaseNotes: add lld/ELF notes (PR #80393)

2024-02-02 Thread Fangrui Song via llvm-branch-commits

https://github.com/MaskRay updated 
https://github.com/llvm/llvm-project/pull/80393

>From fc64e65d2af33f237a16c55d2730bd615157213c Mon Sep 17 00:00:00 2001
From: Fangrui Song 
Date: Thu, 1 Feb 2024 22:04:49 -0800
Subject: [PATCH 1/2] ReleaseNotes: add lld/ELF notes

---
 lld/docs/ReleaseNotes.rst | 34 ++
 1 file changed, 34 insertions(+)

diff --git a/lld/docs/ReleaseNotes.rst b/lld/docs/ReleaseNotes.rst
index 01669543cd50c..824cc6f56f8d5 100644
--- a/lld/docs/ReleaseNotes.rst
+++ b/lld/docs/ReleaseNotes.rst
@@ -29,8 +29,42 @@ ELF Improvements
 * ``--fat-lto-objects`` option is added to support LLVM FatLTO.
   Without ``--fat-lto-objects``, LLD will link LLVM FatLTO objects using the
   relocatable object file. (`D146778 `_)
+* ``-Bsymbolic-non-weak`` is added to directly bind non-weak definitions.
+  (`D158322 `_)
+* ``--lto-validate-all-vtables-have-type-infos``, which complements
+  ``--lto-whole-program-visibility``, is added to disable unsafe whole-program
+  devirtualization. ``--lto-known-safe-vtables=`` can be used
+  to mark known-safe vtable symbols.
+  (`D155659 `_)
+* ``--no-allow-shlib-undefined`` now reports errors for DSO referencing
+  non-exported definitions.
+  (`#70769 `_)
 * common-page-size can now be larger than the system page-size.
   (`#57618 `_)
+* When call graph profile information is availablue due to instrumentation or
+  sample PGO, input sections are now sorted using the new ``cdsort`` algorithm,
+  better than the previous ``hfsort`` algorithm.
+  (`D152840 `_)
+* Symbol assignments like ``a = DEFINED(a) ? a : 0;`` are now handled.
+  (`#65866 `_)
+* ``OVERLAY`` now supports optional start address and LMA
+  (`#77272 `_)
+* Relocations referencing a symbol defined in ``/DISCARD/`` section now lead to
+  an error.
+  (`#69295 `_)
+* For AArch64 MTE, global variable descriptors have been implemented.
+  (`D152921 `_)
+* ``R_LARCH_PCREL20_S2``/``R_LARCH_ADD6``/``R_LARCH_CALL36`` and extreme code
+  model relocations are now supported.
+* ``--emit-relocs`` is now supported for RISC-V linker relaxation.
+  (`D159082 `_)
+* Call relaxation respects RVC when mixing +c and -c relocatable files.
+  (`#73977 `_)
+* ``R_RISCV_SET_ULEB128``/``R_RISCV_SUB_ULEB128`` relocations are now 
supported.
+  (`#72610 `_)
+  (`#77261 `_)
+* RISC-V TLSDESC is now supported.
+  (`#79239 `_)
 
 Breaking changes
 

>From d35cb97c6c2552ea0e20842c0e65fa2dec44bd9a Mon Sep 17 00:00:00 2001
From: Fangrui Song 
Date: Fri, 2 Feb 2024 12:58:10 -0800
Subject: [PATCH 2/2] add more entries

---
 lld/docs/ReleaseNotes.rst | 10 +-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/lld/docs/ReleaseNotes.rst b/lld/docs/ReleaseNotes.rst
index 824cc6f56f8d5..21a075ad8c4ef 100644
--- a/lld/docs/ReleaseNotes.rst
+++ b/lld/docs/ReleaseNotes.rst
@@ -36,12 +36,16 @@ ELF Improvements
   devirtualization. ``--lto-known-safe-vtables=`` can be used
   to mark known-safe vtable symbols.
   (`D155659 `_)
+* ``--save-temps --lto-emit-asm`` now derives ELF/asm file names from bitcode 
file names.
+  ``ld.lld --save-temps a.o d/b.o -o out`` will create ELF relocatable files
+  ``out.lto.a.o``/``d/out.lto.b.o`` instead of ``out1.lto.o``/``out2.lto.o``.
+  (`#78835 `_)
 * ``--no-allow-shlib-undefined`` now reports errors for DSO referencing
   non-exported definitions.
   (`#70769 `_)
 * common-page-size can now be larger than the system page-size.
   (`#57618 `_)
-* When call graph profile information is availablue due to instrumentation or
+* When call graph profile information is available due to instrumentation or
   sample PGO, input sections are now sorted using the new ``cdsort`` algorithm,
   better than the previous ``hfsort`` algorithm.
   (`D152840 `_)
@@ -54,12 +58,16 @@ ELF Improvements
   (`#69295 `_)
 * For AArch64 MTE, global variable descriptors have been implemented.
   (`D152921 `_)
+* ``R_AARCH64_GOTPCREL32`` is now supported.
+  (`#72584 `_)
 * ``R_LARCH_PCREL20_S2``

[llvm-branch-commits] [lld] ReleaseNotes: add lld/ELF notes (PR #80393)

2024-02-02 Thread Fangrui Song via llvm-branch-commits


@@ -29,8 +29,42 @@ ELF Improvements
 * ``--fat-lto-objects`` option is added to support LLVM FatLTO.
   Without ``--fat-lto-objects``, LLD will link LLVM FatLTO objects using the
   relocatable object file. (`D146778 `_)
+* ``-Bsymbolic-non-weak`` is added to directly bind non-weak definitions.
+  (`D158322 `_)
+* ``--lto-validate-all-vtables-have-type-infos``, which complements
+  ``--lto-whole-program-visibility``, is added to disable unsafe whole-program
+  devirtualization. ``--lto-known-safe-vtables=`` can be used
+  to mark known-safe vtable symbols.
+  (`D155659 `_)
+* ``--no-allow-shlib-undefined`` now reports errors for DSO referencing
+  non-exported definitions.
+  (`#70769 `_)
 * common-page-size can now be larger than the system page-size.
   (`#57618 `_)
+* When call graph profile information is availablue due to instrumentation or
+  sample PGO, input sections are now sorted using the new ``cdsort`` algorithm,
+  better than the previous ``hfsort`` algorithm.
+  (`D152840 `_)
+* Symbol assignments like ``a = DEFINED(a) ? a : 0;`` are now handled.
+  (`#65866 `_)
+* ``OVERLAY`` now supports optional start address and LMA
+  (`#77272 `_)
+* Relocations referencing a symbol defined in ``/DISCARD/`` section now lead to
+  an error.
+  (`#69295 `_)
+* For AArch64 MTE, global variable descriptors have been implemented.
+  (`D152921 `_)
+* ``R_LARCH_PCREL20_S2``/``R_LARCH_ADD6``/``R_LARCH_CALL36`` and extreme code
+  model relocations are now supported.
+* ``--emit-relocs`` is now supported for RISC-V linker relaxation.
+  (`D159082 `_)
+* Call relaxation respects RVC when mixing +c and -c relocatable files.
+  (`#73977 `_)
+* ``R_RISCV_SET_ULEB128``/``R_RISCV_SUB_ULEB128`` relocations are now 
supported.
+  (`#72610 `_)
+  (`#77261 `_)
+* RISC-V TLSDESC is now supported.
+  (`#79239 `_)
 

MaskRay wrote:

Thanks for the addition. Added both.

https://github.com/llvm/llvm-project/pull/80393
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [lld] ReleaseNotes: add lld/ELF notes (PR #80393)

2024-02-02 Thread Fangrui Song via llvm-branch-commits

https://github.com/MaskRay updated 
https://github.com/llvm/llvm-project/pull/80393

>From fc64e65d2af33f237a16c55d2730bd615157213c Mon Sep 17 00:00:00 2001
From: Fangrui Song 
Date: Thu, 1 Feb 2024 22:04:49 -0800
Subject: [PATCH 1/2] ReleaseNotes: add lld/ELF notes

---
 lld/docs/ReleaseNotes.rst | 34 ++
 1 file changed, 34 insertions(+)

diff --git a/lld/docs/ReleaseNotes.rst b/lld/docs/ReleaseNotes.rst
index 01669543cd50c..824cc6f56f8d5 100644
--- a/lld/docs/ReleaseNotes.rst
+++ b/lld/docs/ReleaseNotes.rst
@@ -29,8 +29,42 @@ ELF Improvements
 * ``--fat-lto-objects`` option is added to support LLVM FatLTO.
   Without ``--fat-lto-objects``, LLD will link LLVM FatLTO objects using the
   relocatable object file. (`D146778 `_)
+* ``-Bsymbolic-non-weak`` is added to directly bind non-weak definitions.
+  (`D158322 `_)
+* ``--lto-validate-all-vtables-have-type-infos``, which complements
+  ``--lto-whole-program-visibility``, is added to disable unsafe whole-program
+  devirtualization. ``--lto-known-safe-vtables=`` can be used
+  to mark known-safe vtable symbols.
+  (`D155659 `_)
+* ``--no-allow-shlib-undefined`` now reports errors for DSO referencing
+  non-exported definitions.
+  (`#70769 `_)
 * common-page-size can now be larger than the system page-size.
   (`#57618 `_)
+* When call graph profile information is availablue due to instrumentation or
+  sample PGO, input sections are now sorted using the new ``cdsort`` algorithm,
+  better than the previous ``hfsort`` algorithm.
+  (`D152840 `_)
+* Symbol assignments like ``a = DEFINED(a) ? a : 0;`` are now handled.
+  (`#65866 `_)
+* ``OVERLAY`` now supports optional start address and LMA
+  (`#77272 `_)
+* Relocations referencing a symbol defined in ``/DISCARD/`` section now lead to
+  an error.
+  (`#69295 `_)
+* For AArch64 MTE, global variable descriptors have been implemented.
+  (`D152921 `_)
+* ``R_LARCH_PCREL20_S2``/``R_LARCH_ADD6``/``R_LARCH_CALL36`` and extreme code
+  model relocations are now supported.
+* ``--emit-relocs`` is now supported for RISC-V linker relaxation.
+  (`D159082 `_)
+* Call relaxation respects RVC when mixing +c and -c relocatable files.
+  (`#73977 `_)
+* ``R_RISCV_SET_ULEB128``/``R_RISCV_SUB_ULEB128`` relocations are now 
supported.
+  (`#72610 `_)
+  (`#77261 `_)
+* RISC-V TLSDESC is now supported.
+  (`#79239 `_)
 
 Breaking changes
 

>From d35cb97c6c2552ea0e20842c0e65fa2dec44bd9a Mon Sep 17 00:00:00 2001
From: Fangrui Song 
Date: Fri, 2 Feb 2024 12:58:10 -0800
Subject: [PATCH 2/2] add more entries

---
 lld/docs/ReleaseNotes.rst | 10 +-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/lld/docs/ReleaseNotes.rst b/lld/docs/ReleaseNotes.rst
index 824cc6f56f8d5..21a075ad8c4ef 100644
--- a/lld/docs/ReleaseNotes.rst
+++ b/lld/docs/ReleaseNotes.rst
@@ -36,12 +36,16 @@ ELF Improvements
   devirtualization. ``--lto-known-safe-vtables=`` can be used
   to mark known-safe vtable symbols.
   (`D155659 `_)
+* ``--save-temps --lto-emit-asm`` now derives ELF/asm file names from bitcode 
file names.
+  ``ld.lld --save-temps a.o d/b.o -o out`` will create ELF relocatable files
+  ``out.lto.a.o``/``d/out.lto.b.o`` instead of ``out1.lto.o``/``out2.lto.o``.
+  (`#78835 `_)
 * ``--no-allow-shlib-undefined`` now reports errors for DSO referencing
   non-exported definitions.
   (`#70769 `_)
 * common-page-size can now be larger than the system page-size.
   (`#57618 `_)
-* When call graph profile information is availablue due to instrumentation or
+* When call graph profile information is available due to instrumentation or
   sample PGO, input sections are now sorted using the new ``cdsort`` algorithm,
   better than the previous ``hfsort`` algorithm.
   (`D152840 `_)
@@ -54,12 +58,16 @@ ELF Improvements
   (`#69295 `_)
 * For AArch64 MTE, global variable descriptors have been implemented.
   (`D152921 `_)
+* ``R_AARCH64_GOTPCREL32`` is now supported.
+  (`#72584 `_)
 * ``R_LARCH_PCREL20_S2``

[llvm-branch-commits] [lld] ReleaseNotes: add lld/ELF notes (PR #80393)

2024-02-02 Thread Fangrui Song via llvm-branch-commits


@@ -29,8 +29,42 @@ ELF Improvements
 * ``--fat-lto-objects`` option is added to support LLVM FatLTO.
   Without ``--fat-lto-objects``, LLD will link LLVM FatLTO objects using the
   relocatable object file. (`D146778 `_)
+* ``-Bsymbolic-non-weak`` is added to directly bind non-weak definitions.
+  (`D158322 `_)
+* ``--lto-validate-all-vtables-have-type-infos``, which complements
+  ``--lto-whole-program-visibility``, is added to disable unsafe whole-program
+  devirtualization. ``--lto-known-safe-vtables=`` can be used
+  to mark known-safe vtable symbols.
+  (`D155659 `_)

MaskRay wrote:

Thanks for the suggestion! I noticed this and GOT32_PCREL and was wondering 
whether they are minor. But your mentioning this made it clear it is worth 
mentioning:)

This entry may motivate wasm and Mach-O folks to implement a similar change.
(I am actually self motivated to do this if I have some spare time)

https://github.com/llvm/llvm-project/pull/80393
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] [mlir] [llvm][mlir][OMPIRBuilder] Translate omp.single's copyprivate (PR #80488)

2024-02-02 Thread via llvm-branch-commits

llvmbot wrote:




@llvm/pr-subscribers-mlir-llvm

Author: Leandro Lupori (luporl)


Changes

Use the new copyprivate list from omp.single to emit calls to
__kmpc_copyprivate, during the creation of the single operation
in OMPIRBuilder.

This is patch 4 of 4, to add support for COPYPRIVATE in Flang.
Original PR: https://github.com/llvm/llvm-project/pull/73128

---
Full diff: https://github.com/llvm/llvm-project/pull/80488.diff


5 Files Affected:

- (modified) llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h (+5-1) 
- (modified) llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp (+20-3) 
- (modified) llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp (+111) 
- (modified) 
mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp (+19-1) 
- (modified) mlir/test/Target/LLVMIR/openmp-llvm.mlir (+32) 


``diff
diff --git a/llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h 
b/llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h
index 669104307fa0e..ab92c172c75ae 100644
--- a/llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h
+++ b/llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h
@@ -1819,12 +1819,16 @@ class OpenMPIRBuilder {
   /// \param FiniCB Callback to finalize variable copies.
   /// \param IsNowait If false, a barrier is emitted.
   /// \param DidIt Local variable used as a flag to indicate 'single' thread
+  /// \param CPVars copyprivate variables.
+  /// \param CPFuncs copy functions to use for each copyprivate variable.
   ///
   /// \returns The insertion position *after* the single call.
   InsertPointTy createSingle(const LocationDescription &Loc,
  BodyGenCallbackTy BodyGenCB,
  FinalizeCallbackTy FiniCB, bool IsNowait,
- llvm::Value *DidIt);
+ llvm::Value *DidIt,
+ ArrayRef CPVars = {},
+ ArrayRef CPFuncs = {});
 
   /// Generator for '#omp master'
   ///
diff --git a/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp 
b/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
index f6cf358119fb7..7abac0f660ef8 100644
--- a/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
+++ b/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
@@ -3992,7 +3992,8 @@ OpenMPIRBuilder::createCopyPrivate(const 
LocationDescription &Loc,
 
 OpenMPIRBuilder::InsertPointTy OpenMPIRBuilder::createSingle(
 const LocationDescription &Loc, BodyGenCallbackTy BodyGenCB,
-FinalizeCallbackTy FiniCB, bool IsNowait, llvm::Value *DidIt) {
+FinalizeCallbackTy FiniCB, bool IsNowait, llvm::Value *DidIt,
+ArrayRef CPVars, ArrayRef CPFuncs) {
 
   if (!updateToLocation(Loc))
 return Loc.IP;
@@ -4015,17 +4016,33 @@ OpenMPIRBuilder::InsertPointTy 
OpenMPIRBuilder::createSingle(
   Function *ExitRTLFn = 
getOrCreateRuntimeFunctionPtr(OMPRTL___kmpc_end_single);
   Instruction *ExitCall = Builder.CreateCall(ExitRTLFn, Args);
 
+  auto FiniCBWrapper = [&](InsertPointTy IP) {
+FiniCB(IP);
+
+if (DidIt)
+  Builder.CreateStore(Builder.getInt32(1), DidIt);
+  };
+
   // generates the following:
   // if (__kmpc_single()) {
   //    single region ...
   //   __kmpc_end_single
   // }
+  // __kmpc_copyprivate
   // __kmpc_barrier
 
-  EmitOMPInlinedRegion(OMPD, EntryCall, ExitCall, BodyGenCB, FiniCB,
+  EmitOMPInlinedRegion(OMPD, EntryCall, ExitCall, BodyGenCB, FiniCBWrapper,
/*Conditional*/ true,
/*hasFinalize*/ true);
-  if (!IsNowait)
+
+  if (DidIt) {
+for (size_t I = 0, E = CPVars.size(); I < E; ++I)
+  // NOTE BufSize is currently unused, so just pass 0.
+  createCopyPrivate(LocationDescription(Builder.saveIP(), Loc.DL),
+/*BufSize=*/ConstantInt::get(Int64, 0), CPVars[I],
+CPFuncs[I], DidIt);
+// NOTE __kmpc_copyprivate already inserts a barrier
+  } else if (!IsNowait)
 createBarrier(LocationDescription(Builder.saveIP(), Loc.DL),
   omp::Directive::OMPD_unknown, /* ForceSimpleCall */ false,
   /* CheckCancelFlag */ false);
diff --git a/llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp 
b/llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp
index e79d0bb2f65ae..0eb1039aa442c 100644
--- a/llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp
+++ b/llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp
@@ -3464,6 +3464,117 @@ TEST_F(OpenMPIRBuilderTest, SingleDirectiveNowait) {
   EXPECT_EQ(ExitBarrier, nullptr);
 }
 
+TEST_F(OpenMPIRBuilderTest, SingleDirectiveCopyPrivate) {
+  using InsertPointTy = OpenMPIRBuilder::InsertPointTy;
+  OpenMPIRBuilder OMPBuilder(*M);
+  OMPBuilder.initialize();
+  F->setName("func");
+  IRBuilder<> Builder(BB);
+
+  OpenMPIRBuilder::LocationDescription Loc({Builder.saveIP(), DL});
+
+  AllocaInst *PrivAI = nullptr;
+
+  BasicBlock *EntryBB = nullptr;
+  BasicBlock *ThenBB = nullptr;
+
+  Value *CPVar = Builder.CreateAlloca(F->arg_begin()->getType());
+  Builder.CreateStore(F->arg_begin(), CPVar);
+
+  Functi

[llvm-branch-commits] [mlir] [llvm] [llvm][mlir][OMPIRBuilder] Translate omp.single's copyprivate (PR #80488)

2024-02-02 Thread via llvm-branch-commits

llvmbot wrote:




@llvm/pr-subscribers-mlir-openmp

Author: Leandro Lupori (luporl)


Changes

Use the new copyprivate list from omp.single to emit calls to
__kmpc_copyprivate, during the creation of the single operation
in OMPIRBuilder.

This is patch 4 of 4, to add support for COPYPRIVATE in Flang.
Original PR: https://github.com/llvm/llvm-project/pull/73128

---
Full diff: https://github.com/llvm/llvm-project/pull/80488.diff


5 Files Affected:

- (modified) llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h (+5-1) 
- (modified) llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp (+20-3) 
- (modified) llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp (+111) 
- (modified) 
mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp (+19-1) 
- (modified) mlir/test/Target/LLVMIR/openmp-llvm.mlir (+32) 


``diff
diff --git a/llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h 
b/llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h
index 669104307fa0e..ab92c172c75ae 100644
--- a/llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h
+++ b/llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h
@@ -1819,12 +1819,16 @@ class OpenMPIRBuilder {
   /// \param FiniCB Callback to finalize variable copies.
   /// \param IsNowait If false, a barrier is emitted.
   /// \param DidIt Local variable used as a flag to indicate 'single' thread
+  /// \param CPVars copyprivate variables.
+  /// \param CPFuncs copy functions to use for each copyprivate variable.
   ///
   /// \returns The insertion position *after* the single call.
   InsertPointTy createSingle(const LocationDescription &Loc,
  BodyGenCallbackTy BodyGenCB,
  FinalizeCallbackTy FiniCB, bool IsNowait,
- llvm::Value *DidIt);
+ llvm::Value *DidIt,
+ ArrayRef CPVars = {},
+ ArrayRef CPFuncs = {});
 
   /// Generator for '#omp master'
   ///
diff --git a/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp 
b/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
index f6cf358119fb7..7abac0f660ef8 100644
--- a/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
+++ b/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
@@ -3992,7 +3992,8 @@ OpenMPIRBuilder::createCopyPrivate(const 
LocationDescription &Loc,
 
 OpenMPIRBuilder::InsertPointTy OpenMPIRBuilder::createSingle(
 const LocationDescription &Loc, BodyGenCallbackTy BodyGenCB,
-FinalizeCallbackTy FiniCB, bool IsNowait, llvm::Value *DidIt) {
+FinalizeCallbackTy FiniCB, bool IsNowait, llvm::Value *DidIt,
+ArrayRef CPVars, ArrayRef CPFuncs) {
 
   if (!updateToLocation(Loc))
 return Loc.IP;
@@ -4015,17 +4016,33 @@ OpenMPIRBuilder::InsertPointTy 
OpenMPIRBuilder::createSingle(
   Function *ExitRTLFn = 
getOrCreateRuntimeFunctionPtr(OMPRTL___kmpc_end_single);
   Instruction *ExitCall = Builder.CreateCall(ExitRTLFn, Args);
 
+  auto FiniCBWrapper = [&](InsertPointTy IP) {
+FiniCB(IP);
+
+if (DidIt)
+  Builder.CreateStore(Builder.getInt32(1), DidIt);
+  };
+
   // generates the following:
   // if (__kmpc_single()) {
   //    single region ...
   //   __kmpc_end_single
   // }
+  // __kmpc_copyprivate
   // __kmpc_barrier
 
-  EmitOMPInlinedRegion(OMPD, EntryCall, ExitCall, BodyGenCB, FiniCB,
+  EmitOMPInlinedRegion(OMPD, EntryCall, ExitCall, BodyGenCB, FiniCBWrapper,
/*Conditional*/ true,
/*hasFinalize*/ true);
-  if (!IsNowait)
+
+  if (DidIt) {
+for (size_t I = 0, E = CPVars.size(); I < E; ++I)
+  // NOTE BufSize is currently unused, so just pass 0.
+  createCopyPrivate(LocationDescription(Builder.saveIP(), Loc.DL),
+/*BufSize=*/ConstantInt::get(Int64, 0), CPVars[I],
+CPFuncs[I], DidIt);
+// NOTE __kmpc_copyprivate already inserts a barrier
+  } else if (!IsNowait)
 createBarrier(LocationDescription(Builder.saveIP(), Loc.DL),
   omp::Directive::OMPD_unknown, /* ForceSimpleCall */ false,
   /* CheckCancelFlag */ false);
diff --git a/llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp 
b/llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp
index e79d0bb2f65ae..0eb1039aa442c 100644
--- a/llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp
+++ b/llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp
@@ -3464,6 +3464,117 @@ TEST_F(OpenMPIRBuilderTest, SingleDirectiveNowait) {
   EXPECT_EQ(ExitBarrier, nullptr);
 }
 
+TEST_F(OpenMPIRBuilderTest, SingleDirectiveCopyPrivate) {
+  using InsertPointTy = OpenMPIRBuilder::InsertPointTy;
+  OpenMPIRBuilder OMPBuilder(*M);
+  OMPBuilder.initialize();
+  F->setName("func");
+  IRBuilder<> Builder(BB);
+
+  OpenMPIRBuilder::LocationDescription Loc({Builder.saveIP(), DL});
+
+  AllocaInst *PrivAI = nullptr;
+
+  BasicBlock *EntryBB = nullptr;
+  BasicBlock *ThenBB = nullptr;
+
+  Value *CPVar = Builder.CreateAlloca(F->arg_begin()->getType());
+  Builder.CreateStore(F->arg_begin(), CPVar);
+
+  Func

[llvm-branch-commits] [mlir] [llvm] [llvm][mlir][OMPIRBuilder] Translate omp.single's copyprivate (PR #80488)

2024-02-02 Thread Leandro Lupori via llvm-branch-commits

https://github.com/luporl created 
https://github.com/llvm/llvm-project/pull/80488

Use the new copyprivate list from omp.single to emit calls to
__kmpc_copyprivate, during the creation of the single operation
in OMPIRBuilder.

This is patch 4 of 4, to add support for COPYPRIVATE in Flang.
Original PR: https://github.com/llvm/llvm-project/pull/73128

>From 52462e6790194c19465f017b81e51e4a99136d3a Mon Sep 17 00:00:00 2001
From: Leandro Lupori 
Date: Fri, 2 Feb 2024 17:16:34 -0300
Subject: [PATCH] [llvm][mlir][OMPIRBuilder] Translate omp.single's copyprivate

Use the new copyprivate list from omp.single to emit calls to
__kmpc_copyprivate, during the creation of the single operation
in OMPIRBuilder.

This is patch 4 of 4, to add support for COPYPRIVATE in Flang.
Original PR: https://github.com/llvm/llvm-project/pull/73128
---
 .../llvm/Frontend/OpenMP/OMPIRBuilder.h   |   6 +-
 llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp |  23 +++-
 .../Frontend/OpenMPIRBuilderTest.cpp  | 111 ++
 .../OpenMP/OpenMPToLLVMIRTranslation.cpp  |  20 +++-
 mlir/test/Target/LLVMIR/openmp-llvm.mlir  |  32 +
 5 files changed, 187 insertions(+), 5 deletions(-)

diff --git a/llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h 
b/llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h
index 669104307fa0e..ab92c172c75ae 100644
--- a/llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h
+++ b/llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h
@@ -1819,12 +1819,16 @@ class OpenMPIRBuilder {
   /// \param FiniCB Callback to finalize variable copies.
   /// \param IsNowait If false, a barrier is emitted.
   /// \param DidIt Local variable used as a flag to indicate 'single' thread
+  /// \param CPVars copyprivate variables.
+  /// \param CPFuncs copy functions to use for each copyprivate variable.
   ///
   /// \returns The insertion position *after* the single call.
   InsertPointTy createSingle(const LocationDescription &Loc,
  BodyGenCallbackTy BodyGenCB,
  FinalizeCallbackTy FiniCB, bool IsNowait,
- llvm::Value *DidIt);
+ llvm::Value *DidIt,
+ ArrayRef CPVars = {},
+ ArrayRef CPFuncs = {});
 
   /// Generator for '#omp master'
   ///
diff --git a/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp 
b/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
index f6cf358119fb7..7abac0f660ef8 100644
--- a/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
+++ b/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
@@ -3992,7 +3992,8 @@ OpenMPIRBuilder::createCopyPrivate(const 
LocationDescription &Loc,
 
 OpenMPIRBuilder::InsertPointTy OpenMPIRBuilder::createSingle(
 const LocationDescription &Loc, BodyGenCallbackTy BodyGenCB,
-FinalizeCallbackTy FiniCB, bool IsNowait, llvm::Value *DidIt) {
+FinalizeCallbackTy FiniCB, bool IsNowait, llvm::Value *DidIt,
+ArrayRef CPVars, ArrayRef CPFuncs) {
 
   if (!updateToLocation(Loc))
 return Loc.IP;
@@ -4015,17 +4016,33 @@ OpenMPIRBuilder::InsertPointTy 
OpenMPIRBuilder::createSingle(
   Function *ExitRTLFn = 
getOrCreateRuntimeFunctionPtr(OMPRTL___kmpc_end_single);
   Instruction *ExitCall = Builder.CreateCall(ExitRTLFn, Args);
 
+  auto FiniCBWrapper = [&](InsertPointTy IP) {
+FiniCB(IP);
+
+if (DidIt)
+  Builder.CreateStore(Builder.getInt32(1), DidIt);
+  };
+
   // generates the following:
   // if (__kmpc_single()) {
   //    single region ...
   //   __kmpc_end_single
   // }
+  // __kmpc_copyprivate
   // __kmpc_barrier
 
-  EmitOMPInlinedRegion(OMPD, EntryCall, ExitCall, BodyGenCB, FiniCB,
+  EmitOMPInlinedRegion(OMPD, EntryCall, ExitCall, BodyGenCB, FiniCBWrapper,
/*Conditional*/ true,
/*hasFinalize*/ true);
-  if (!IsNowait)
+
+  if (DidIt) {
+for (size_t I = 0, E = CPVars.size(); I < E; ++I)
+  // NOTE BufSize is currently unused, so just pass 0.
+  createCopyPrivate(LocationDescription(Builder.saveIP(), Loc.DL),
+/*BufSize=*/ConstantInt::get(Int64, 0), CPVars[I],
+CPFuncs[I], DidIt);
+// NOTE __kmpc_copyprivate already inserts a barrier
+  } else if (!IsNowait)
 createBarrier(LocationDescription(Builder.saveIP(), Loc.DL),
   omp::Directive::OMPD_unknown, /* ForceSimpleCall */ false,
   /* CheckCancelFlag */ false);
diff --git a/llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp 
b/llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp
index e79d0bb2f65ae..0eb1039aa442c 100644
--- a/llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp
+++ b/llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp
@@ -3464,6 +3464,117 @@ TEST_F(OpenMPIRBuilderTest, SingleDirectiveNowait) {
   EXPECT_EQ(ExitBarrier, nullptr);
 }
 
+TEST_F(OpenMPIRBuilderTest, SingleDirectiveCopyPrivate) {
+  using InsertPointTy = OpenMPIRBuilder::InsertPointTy;
+  OpenMPIRBuilder OMPBuilder(*M);
+  OMPBuilder

[llvm-branch-commits] [libcxx] PR for llvm/llvm-project#79155 (PR #80484)

2024-02-02 Thread Mark de Wever via llvm-branch-commits

https://github.com/mordante approved this pull request.


https://github.com/llvm/llvm-project/pull/80484
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [flang] [flang][OpenMP] Add support for copyprivate (PR #80485)

2024-02-02 Thread via llvm-branch-commits

llvmbot wrote:




@llvm/pr-subscribers-flang-fir-hlfir

Author: Leandro Lupori (luporl)


Changes

Add initial handling of OpenMP copyprivate clause in Flang.

When lowering copyprivate, Flang generates the copy function
needed by each variable and builds the appropriate
omp.single's CopyPrivateVarList.

This is patch 3 of 4, to add support for COPYPRIVATE in Flang.
Original PR: https://github.com/llvm/llvm-project/pull/73128

---

Patch is 32.73 KiB, truncated to 20.00 KiB below, full version: 
https://github.com/llvm/llvm-project/pull/80485.diff


5 Files Affected:

- (modified) flang/include/flang/Lower/AbstractConverter.h (+3) 
- (modified) flang/lib/Lower/Bridge.cpp (+79-58) 
- (modified) flang/lib/Lower/OpenMP.cpp (+168-5) 
- (removed) flang/test/Lower/OpenMP/Todo/copyprivate.f90 (-13) 
- (added) flang/test/Lower/OpenMP/copyprivate.f90 (+164) 


``diff
diff --git a/flang/include/flang/Lower/AbstractConverter.h 
b/flang/include/flang/Lower/AbstractConverter.h
index c19dcbdcdb390..48804c327e1c7 100644
--- a/flang/include/flang/Lower/AbstractConverter.h
+++ b/flang/include/flang/Lower/AbstractConverter.h
@@ -120,6 +120,9 @@ class AbstractConverter {
   const Fortran::semantics::Symbol &sym,
   mlir::OpBuilder::InsertPoint *copyAssignIP = nullptr) = 0;
 
+  virtual void copyVar(mlir::Location loc, mlir::Value dst,
+   mlir::Value src) = 0;
+
   /// For a given symbol, check if it is present in the inner-most
   /// level of the symbol map.
   virtual bool isPresentShallowLookup(Fortran::semantics::Symbol &sym) = 0;
diff --git a/flang/lib/Lower/Bridge.cpp b/flang/lib/Lower/Bridge.cpp
index 8006b9b426f4d..04d09c4848491 100644
--- a/flang/lib/Lower/Bridge.cpp
+++ b/flang/lib/Lower/Bridge.cpp
@@ -743,6 +743,11 @@ class FirConverter : public 
Fortran::lower::AbstractConverter {
 });
   }
 
+  void copyVar(mlir::Location loc, mlir::Value dst,
+   mlir::Value src) override final {
+copyVarHLFIR(loc, dst, src);
+  }
+
   void copyHostAssociateVar(
   const Fortran::semantics::Symbol &sym,
   mlir::OpBuilder::InsertPoint *copyAssignIP = nullptr) override final {
@@ -777,64 +782,7 @@ class FirConverter : public 
Fortran::lower::AbstractConverter {
   rhs_sb = &hsb;
 }
 
-mlir::Location loc = genLocation(sym.name());
-
-if (lowerToHighLevelFIR()) {
-  hlfir::Entity lhs{lhs_sb->getAddr()};
-  hlfir::Entity rhs{rhs_sb->getAddr()};
-  // Temporary_lhs is set to true in hlfir.assign below to avoid user
-  // assignment to be used and finalization to be called on the LHS.
-  // This may or may not be correct but mimics the current behaviour
-  // without HLFIR.
-  auto copyData = [&](hlfir::Entity l, hlfir::Entity r) {
-// Dereference RHS and load it if trivial scalar.
-r = hlfir::loadTrivialScalar(loc, *builder, r);
-builder->create(
-loc, r, l,
-/*isWholeAllocatableAssignment=*/false,
-/*keepLhsLengthInAllocatableAssignment=*/false,
-/*temporary_lhs=*/true);
-  };
-  if (lhs.isAllocatable()) {
-// Deep copy allocatable if it is allocated.
-// Note that when allocated, the RHS is already allocated with the LHS
-// shape for copy on entry in createHostAssociateVarClone.
-// For lastprivate, this assumes that the RHS was not reallocated in
-// the OpenMP region.
-lhs = hlfir::derefPointersAndAllocatables(loc, *builder, lhs);
-mlir::Value addr = hlfir::genVariableRawAddress(loc, *builder, lhs);
-mlir::Value isAllocated = builder->genIsNotNullAddr(loc, addr);
-builder->genIfThen(loc, isAllocated)
-.genThen([&]() {
-  // Copy the DATA, not the descriptors.
-  copyData(lhs, rhs);
-})
-.end();
-  } else if (lhs.isPointer()) {
-// Set LHS target to the target of RHS (do not copy the RHS
-// target data into the LHS target storage).
-auto loadVal = builder->create(loc, rhs);
-builder->create(loc, loadVal, lhs);
-  } else {
-// Non ALLOCATABLE/POINTER variable. Simple DATA copy.
-copyData(lhs, rhs);
-  }
-} else {
-  fir::ExtendedValue lhs = symBoxToExtendedValue(*lhs_sb);
-  fir::ExtendedValue rhs = symBoxToExtendedValue(*rhs_sb);
-  mlir::Type symType = genType(sym);
-  if (auto seqTy = symType.dyn_cast()) {
-Fortran::lower::StatementContext stmtCtx;
-Fortran::lower::createSomeArrayAssignment(*this, lhs, rhs, 
localSymbols,
-  stmtCtx);
-stmtCtx.finalizeAndReset();
-  } else if (lhs.getBoxOf()) {
-fir::factory::CharacterExprHelper{*builder, loc}.createAssign(lhs, 
rhs);
-  } else {
-auto loadVal = builder->create(loc, fir::getBase(rhs));
-builder->create(loc, loadVal, fir::getBase(lhs));
-  }
-}
+copyVar(sym, *lhs_

[llvm-branch-commits] [flang] [flang][OpenMP] Add support for copyprivate (PR #80485)

2024-02-02 Thread Leandro Lupori via llvm-branch-commits

https://github.com/luporl created 
https://github.com/llvm/llvm-project/pull/80485

Add initial handling of OpenMP copyprivate clause in Flang.

When lowering copyprivate, Flang generates the copy function
needed by each variable and builds the appropriate
omp.single's CopyPrivateVarList.

This is patch 3 of 4, to add support for COPYPRIVATE in Flang.
Original PR: https://github.com/llvm/llvm-project/pull/73128

>From 06f0aa95ccee98046f71a075610be0ed92849534 Mon Sep 17 00:00:00 2001
From: Leandro Lupori 
Date: Fri, 2 Feb 2024 16:31:20 -0300
Subject: [PATCH] [flang][OpenMP] Add support for copyprivate

Add initial handling of OpenMP copyprivate clause in Flang.

When lowering copyprivate, Flang generates the copy function
needed by each variable and builds the appropriate
omp.single's CopyPrivateVarList.

This is patch 3 of 4, to add support for COPYPRIVATE in Flang.
Original PR: https://github.com/llvm/llvm-project/pull/73128
---
 flang/include/flang/Lower/AbstractConverter.h |   3 +
 flang/lib/Lower/Bridge.cpp| 137 --
 flang/lib/Lower/OpenMP.cpp| 173 +-
 flang/test/Lower/OpenMP/Todo/copyprivate.f90  |  13 --
 flang/test/Lower/OpenMP/copyprivate.f90   | 164 +
 5 files changed, 414 insertions(+), 76 deletions(-)
 delete mode 100644 flang/test/Lower/OpenMP/Todo/copyprivate.f90
 create mode 100644 flang/test/Lower/OpenMP/copyprivate.f90

diff --git a/flang/include/flang/Lower/AbstractConverter.h 
b/flang/include/flang/Lower/AbstractConverter.h
index c19dcbdcdb390..48804c327e1c7 100644
--- a/flang/include/flang/Lower/AbstractConverter.h
+++ b/flang/include/flang/Lower/AbstractConverter.h
@@ -120,6 +120,9 @@ class AbstractConverter {
   const Fortran::semantics::Symbol &sym,
   mlir::OpBuilder::InsertPoint *copyAssignIP = nullptr) = 0;
 
+  virtual void copyVar(mlir::Location loc, mlir::Value dst,
+   mlir::Value src) = 0;
+
   /// For a given symbol, check if it is present in the inner-most
   /// level of the symbol map.
   virtual bool isPresentShallowLookup(Fortran::semantics::Symbol &sym) = 0;
diff --git a/flang/lib/Lower/Bridge.cpp b/flang/lib/Lower/Bridge.cpp
index 8006b9b426f4d..04d09c4848491 100644
--- a/flang/lib/Lower/Bridge.cpp
+++ b/flang/lib/Lower/Bridge.cpp
@@ -743,6 +743,11 @@ class FirConverter : public 
Fortran::lower::AbstractConverter {
 });
   }
 
+  void copyVar(mlir::Location loc, mlir::Value dst,
+   mlir::Value src) override final {
+copyVarHLFIR(loc, dst, src);
+  }
+
   void copyHostAssociateVar(
   const Fortran::semantics::Symbol &sym,
   mlir::OpBuilder::InsertPoint *copyAssignIP = nullptr) override final {
@@ -777,64 +782,7 @@ class FirConverter : public 
Fortran::lower::AbstractConverter {
   rhs_sb = &hsb;
 }
 
-mlir::Location loc = genLocation(sym.name());
-
-if (lowerToHighLevelFIR()) {
-  hlfir::Entity lhs{lhs_sb->getAddr()};
-  hlfir::Entity rhs{rhs_sb->getAddr()};
-  // Temporary_lhs is set to true in hlfir.assign below to avoid user
-  // assignment to be used and finalization to be called on the LHS.
-  // This may or may not be correct but mimics the current behaviour
-  // without HLFIR.
-  auto copyData = [&](hlfir::Entity l, hlfir::Entity r) {
-// Dereference RHS and load it if trivial scalar.
-r = hlfir::loadTrivialScalar(loc, *builder, r);
-builder->create(
-loc, r, l,
-/*isWholeAllocatableAssignment=*/false,
-/*keepLhsLengthInAllocatableAssignment=*/false,
-/*temporary_lhs=*/true);
-  };
-  if (lhs.isAllocatable()) {
-// Deep copy allocatable if it is allocated.
-// Note that when allocated, the RHS is already allocated with the LHS
-// shape for copy on entry in createHostAssociateVarClone.
-// For lastprivate, this assumes that the RHS was not reallocated in
-// the OpenMP region.
-lhs = hlfir::derefPointersAndAllocatables(loc, *builder, lhs);
-mlir::Value addr = hlfir::genVariableRawAddress(loc, *builder, lhs);
-mlir::Value isAllocated = builder->genIsNotNullAddr(loc, addr);
-builder->genIfThen(loc, isAllocated)
-.genThen([&]() {
-  // Copy the DATA, not the descriptors.
-  copyData(lhs, rhs);
-})
-.end();
-  } else if (lhs.isPointer()) {
-// Set LHS target to the target of RHS (do not copy the RHS
-// target data into the LHS target storage).
-auto loadVal = builder->create(loc, rhs);
-builder->create(loc, loadVal, lhs);
-  } else {
-// Non ALLOCATABLE/POINTER variable. Simple DATA copy.
-copyData(lhs, rhs);
-  }
-} else {
-  fir::ExtendedValue lhs = symBoxToExtendedValue(*lhs_sb);
-  fir::ExtendedValue rhs = symBoxToExtendedValue(*rhs_sb);
-  mlir::Type symType = genType(sym);
-  if (

[llvm-branch-commits] [libcxx] PR for llvm/llvm-project#79155 (PR #80484)

2024-02-02 Thread via llvm-branch-commits

llvmbot wrote:




@llvm/pr-subscribers-libcxx

Author: None (llvmbot)


Changes

resolves llvm/llvm-project#79155

---
Full diff: https://github.com/llvm/llvm-project/pull/80484.diff


4 Files Affected:

- (modified) libcxx/modules/std/atomic.inc (+2) 
- (modified) libcxx/modules/std/iosfwd.inc (+2) 
- (modified) libcxx/modules/std/string.inc (+4) 
- (modified) libcxx/modules/std/string_view.inc (+2) 


``diff
diff --git a/libcxx/modules/std/atomic.inc b/libcxx/modules/std/atomic.inc
index 5139b7531093d..88b31ccdb2084 100644
--- a/libcxx/modules/std/atomic.inc
+++ b/libcxx/modules/std/atomic.inc
@@ -60,7 +60,9 @@ export namespace std {
   using std::atomic_char;
   using std::atomic_char16_t;
   using std::atomic_char32_t;
+#ifndef _LIBCPP_HAS_NO_CHAR8_T
   using std::atomic_char8_t;
+#endif
   using std::atomic_int;
   using std::atomic_llong;
   using std::atomic_long;
diff --git a/libcxx/modules/std/iosfwd.inc b/libcxx/modules/std/iosfwd.inc
index ec8b434ca0c51..410fb6aefed80 100644
--- a/libcxx/modules/std/iosfwd.inc
+++ b/libcxx/modules/std/iosfwd.inc
@@ -14,7 +14,9 @@ export namespace std {
 #endif
   using std::u16streampos;
   using std::u32streampos;
+#ifndef _LIBCPP_HAS_NO_CHAR8_T
   using std::u8streampos;
+#endif
 
   using std::basic_osyncstream;
   using std::basic_syncbuf;
diff --git a/libcxx/modules/std/string.inc b/libcxx/modules/std/string.inc
index c83ee7643f87e..9808a96215a18 100644
--- a/libcxx/modules/std/string.inc
+++ b/libcxx/modules/std/string.inc
@@ -34,7 +34,9 @@ export namespace std {
   using std::string;
   using std::u16string;
   using std::u32string;
+#ifndef _LIBCPP_HAS_NO_CHAR8_T
   using std::u8string;
+#endif
 #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
   using std::wstring;
 #endif
@@ -58,7 +60,9 @@ export namespace std {
 using std::pmr::string;
 using std::pmr::u16string;
 using std::pmr::u32string;
+#ifndef _LIBCPP_HAS_NO_CHAR8_T
 using std::pmr::u8string;
+#endif
 #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
 using std::pmr::wstring;
 #endif
diff --git a/libcxx/modules/std/string_view.inc 
b/libcxx/modules/std/string_view.inc
index 1fa63a7739535..f4f9d80ddb83d 100644
--- a/libcxx/modules/std/string_view.inc
+++ b/libcxx/modules/std/string_view.inc
@@ -27,7 +27,9 @@ export namespace std {
   using std::string_view;
   using std::u16string_view;
   using std::u32string_view;
+#ifndef _LIBCPP_HAS_NO_CHAR8_T
   using std::u8string_view;
+#endif
 #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
   using std::wstring_view;
 #endif

``




https://github.com/llvm/llvm-project/pull/80484
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [libcxx] PR for llvm/llvm-project#79155 (PR #80484)

2024-02-02 Thread via llvm-branch-commits

https://github.com/llvmbot milestoned 
https://github.com/llvm/llvm-project/pull/80484
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [libcxx] PR for llvm/llvm-project#79155 (PR #80484)

2024-02-02 Thread via llvm-branch-commits

llvmbot wrote:

@mordante What do you think about merging this PR to the release branch?

https://github.com/llvm/llvm-project/pull/80484
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [libcxx] PR for llvm/llvm-project#79155 (PR #80484)

2024-02-02 Thread via llvm-branch-commits

https://github.com/llvmbot created 
https://github.com/llvm/llvm-project/pull/80484

resolves llvm/llvm-project#79155

>From 5f40ce9e310808c6326371475c0e2f840c946de1 Mon Sep 17 00:00:00 2001
From: Po-yao Chang 
Date: Tue, 30 Jan 2024 13:40:21 +0800
Subject: [PATCH] [libc++][modules] Support using the module std with
 -fno-char8_t. (#79155)

Exclude some using-declarations in the module purview when compiling
with `-fno-char8_t`.

(cherry picked from commit dc4483659fc51890fdc732acc66a4dcda6e68047)
---
 libcxx/modules/std/atomic.inc  | 2 ++
 libcxx/modules/std/iosfwd.inc  | 2 ++
 libcxx/modules/std/string.inc  | 4 
 libcxx/modules/std/string_view.inc | 2 ++
 4 files changed, 10 insertions(+)

diff --git a/libcxx/modules/std/atomic.inc b/libcxx/modules/std/atomic.inc
index 5139b7531093d..88b31ccdb2084 100644
--- a/libcxx/modules/std/atomic.inc
+++ b/libcxx/modules/std/atomic.inc
@@ -60,7 +60,9 @@ export namespace std {
   using std::atomic_char;
   using std::atomic_char16_t;
   using std::atomic_char32_t;
+#ifndef _LIBCPP_HAS_NO_CHAR8_T
   using std::atomic_char8_t;
+#endif
   using std::atomic_int;
   using std::atomic_llong;
   using std::atomic_long;
diff --git a/libcxx/modules/std/iosfwd.inc b/libcxx/modules/std/iosfwd.inc
index ec8b434ca0c51..410fb6aefed80 100644
--- a/libcxx/modules/std/iosfwd.inc
+++ b/libcxx/modules/std/iosfwd.inc
@@ -14,7 +14,9 @@ export namespace std {
 #endif
   using std::u16streampos;
   using std::u32streampos;
+#ifndef _LIBCPP_HAS_NO_CHAR8_T
   using std::u8streampos;
+#endif
 
   using std::basic_osyncstream;
   using std::basic_syncbuf;
diff --git a/libcxx/modules/std/string.inc b/libcxx/modules/std/string.inc
index c83ee7643f87e..9808a96215a18 100644
--- a/libcxx/modules/std/string.inc
+++ b/libcxx/modules/std/string.inc
@@ -34,7 +34,9 @@ export namespace std {
   using std::string;
   using std::u16string;
   using std::u32string;
+#ifndef _LIBCPP_HAS_NO_CHAR8_T
   using std::u8string;
+#endif
 #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
   using std::wstring;
 #endif
@@ -58,7 +60,9 @@ export namespace std {
 using std::pmr::string;
 using std::pmr::u16string;
 using std::pmr::u32string;
+#ifndef _LIBCPP_HAS_NO_CHAR8_T
 using std::pmr::u8string;
+#endif
 #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
 using std::pmr::wstring;
 #endif
diff --git a/libcxx/modules/std/string_view.inc 
b/libcxx/modules/std/string_view.inc
index 1fa63a7739535..f4f9d80ddb83d 100644
--- a/libcxx/modules/std/string_view.inc
+++ b/libcxx/modules/std/string_view.inc
@@ -27,7 +27,9 @@ export namespace std {
   using std::string_view;
   using std::u16string_view;
   using std::u32string_view;
+#ifndef _LIBCPP_HAS_NO_CHAR8_T
   using std::u8string_view;
+#endif
 #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
   using std::wstring_view;
 #endif

___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang] PR for llvm/llvm-project#80441 (PR #80444)

2024-02-02 Thread Kerry McLaughlin via llvm-branch-commits

https://github.com/kmclaughlin-arm approved this pull request.


https://github.com/llvm/llvm-project/pull/80444
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang] PR for llvm/llvm-project#80441 (PR #80444)

2024-02-02 Thread Kerry McLaughlin via llvm-branch-commits

kmclaughlin-arm wrote:

> @kmclaughlin-arm What do you think about merging this PR to the release 
> branch?

LGTM. This is a low risk change which I think should be included in the release 
branch.

https://github.com/llvm/llvm-project/pull/80444
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [lld] ReleaseNotes: add lld/ELF notes (PR #80393)

2024-02-02 Thread Shoaib Meenai via llvm-branch-commits

https://github.com/smeenai edited 
https://github.com/llvm/llvm-project/pull/80393
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [lld] ReleaseNotes: add lld/ELF notes (PR #80393)

2024-02-02 Thread Shoaib Meenai via llvm-branch-commits


@@ -29,8 +29,42 @@ ELF Improvements
 * ``--fat-lto-objects`` option is added to support LLVM FatLTO.
   Without ``--fat-lto-objects``, LLD will link LLVM FatLTO objects using the
   relocatable object file. (`D146778 `_)
+* ``-Bsymbolic-non-weak`` is added to directly bind non-weak definitions.
+  (`D158322 `_)
+* ``--lto-validate-all-vtables-have-type-infos``, which complements
+  ``--lto-whole-program-visibility``, is added to disable unsafe whole-program
+  devirtualization. ``--lto-known-safe-vtables=`` can be used
+  to mark known-safe vtable symbols.
+  (`D155659 `_)
+* ``--no-allow-shlib-undefined`` now reports errors for DSO referencing
+  non-exported definitions.
+  (`#70769 `_)
 * common-page-size can now be larger than the system page-size.
   (`#57618 `_)
+* When call graph profile information is availablue due to instrumentation or
+  sample PGO, input sections are now sorted using the new ``cdsort`` algorithm,
+  better than the previous ``hfsort`` algorithm.
+  (`D152840 `_)
+* Symbol assignments like ``a = DEFINED(a) ? a : 0;`` are now handled.
+  (`#65866 `_)
+* ``OVERLAY`` now supports optional start address and LMA
+  (`#77272 `_)
+* Relocations referencing a symbol defined in ``/DISCARD/`` section now lead to
+  an error.
+  (`#69295 `_)
+* For AArch64 MTE, global variable descriptors have been implemented.
+  (`D152921 `_)
+* ``R_LARCH_PCREL20_S2``/``R_LARCH_ADD6``/``R_LARCH_CALL36`` and extreme code
+  model relocations are now supported.
+* ``--emit-relocs`` is now supported for RISC-V linker relaxation.
+  (`D159082 `_)
+* Call relaxation respects RVC when mixing +c and -c relocatable files.
+  (`#73977 `_)
+* ``R_RISCV_SET_ULEB128``/``R_RISCV_SUB_ULEB128`` relocations are now 
supported.
+  (`#72610 `_)
+  (`#77261 `_)
+* RISC-V TLSDESC is now supported.
+  (`#79239 `_)
 

smeenai wrote:

Good call, as well as R_RISCV_GOT32_PCREL (#72587)

https://github.com/llvm/llvm-project/pull/80393
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [lld] ReleaseNotes: add lld/ELF notes (PR #80393)

2024-02-02 Thread Shoaib Meenai via llvm-branch-commits


@@ -29,8 +29,42 @@ ELF Improvements
 * ``--fat-lto-objects`` option is added to support LLVM FatLTO.
   Without ``--fat-lto-objects``, LLD will link LLVM FatLTO objects using the
   relocatable object file. (`D146778 `_)
+* ``-Bsymbolic-non-weak`` is added to directly bind non-weak definitions.
+  (`D158322 `_)
+* ``--lto-validate-all-vtables-have-type-infos``, which complements
+  ``--lto-whole-program-visibility``, is added to disable unsafe whole-program
+  devirtualization. ``--lto-known-safe-vtables=`` can be used
+  to mark known-safe vtable symbols.
+  (`D155659 `_)
+* ``--no-allow-shlib-undefined`` now reports errors for DSO referencing
+  non-exported definitions.
+  (`#70769 `_)
 * common-page-size can now be larger than the system page-size.
   (`#57618 `_)
+* When call graph profile information is availablue due to instrumentation or

smeenai wrote:

Typo: availablue -> available

https://github.com/llvm/llvm-project/pull/80393
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [lld] ReleaseNotes: add lld/ELF notes (PR #80393)

2024-02-02 Thread Shoaib Meenai via llvm-branch-commits

https://github.com/smeenai approved this pull request.

LGTM, thanks!

https://github.com/llvm/llvm-project/pull/80393
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] PR for llvm/llvm-project#80296 (PR #80408)

2024-02-02 Thread Tom Stellard via llvm-branch-commits

https://github.com/tstellar closed 
https://github.com/llvm/llvm-project/pull/80408
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [mlir] [mlir] Start moving some builtin type formats to the dialect (PR #80421)

2024-02-02 Thread Mehdi Amini via llvm-branch-commits


@@ -25,7 +25,8 @@ include "mlir/IR/BuiltinTypeInterfaces.td"
 // Base class for Builtin dialect types.
 class Builtin_Type traits = [],
string baseCppClass = "::mlir::Type">
-: TypeDef {
+: TypeDefhttps://github.com/llvm/llvm-project/pull/80421
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang] PR for llvm/llvm-project#80441 (PR #80444)

2024-02-02 Thread via llvm-branch-commits

https://github.com/llvmbot updated 
https://github.com/llvm/llvm-project/pull/80444

>From c83a13ca63c95caedb4c2b84762ec9efc57bbca2 Mon Sep 17 00:00:00 2001
From: Sander de Smalen 
Date: Fri, 2 Feb 2024 09:29:47 +
Subject: [PATCH] [Clang][AArch64] Add missing SME macros (#80293)

__ARM_STATE_ZA and __ARM_STATE_ZT0 are set when the compiler can parse
the "za" and "zt0" strings in the SME attributes.

__ARM_FEATURE_SME and __ARM_FEATURE_SME2 are set when the compiler can
generate code for attributes with "za" and "zt0" state, respectively.

__ARM_FEATURE_LOCALLY_STREAMING is set when the compiler supports the
__arm_locally_streaming attribute.

(cherry picked from commit 9e649518e6038a5b9ea38cfa424468657d3be59e)
---
 clang/lib/Basic/Targets/AArch64.cpp   | 23 +++
 clang/lib/Basic/Targets/AArch64.h |  1 +
 .../Preprocessor/aarch64-target-features.c| 13 +++
 clang/test/Preprocessor/init-aarch64.c|  2 ++
 4 files changed, 39 insertions(+)

diff --git a/clang/lib/Basic/Targets/AArch64.cpp 
b/clang/lib/Basic/Targets/AArch64.cpp
index d47181bfca4fc..336b7a5e3d727 100644
--- a/clang/lib/Basic/Targets/AArch64.cpp
+++ b/clang/lib/Basic/Targets/AArch64.cpp
@@ -387,6 +387,11 @@ void AArch64TargetInfo::getTargetDefines(const LangOptions 
&Opts,
 
   Builder.defineMacro("__ARM_ALIGN_MAX_STACK_PWR", "4");
 
+  // These macros are set when Clang can parse declarations with these
+  // attributes.
+  Builder.defineMacro("__ARM_STATE_ZA", "1");
+  Builder.defineMacro("__ARM_STATE_ZT0", "1");
+
   // 0xe implies support for half, single and double precision operations.
   if (FPU & FPUMode)
 Builder.defineMacro("__ARM_FP", "0xE");
@@ -431,6 +436,17 @@ void AArch64TargetInfo::getTargetDefines(const LangOptions 
&Opts,
   if (HasSVE2 && HasSVE2SM4)
 Builder.defineMacro("__ARM_FEATURE_SVE2_SM4", "1");
 
+  if (HasSME) {
+Builder.defineMacro("__ARM_FEATURE_SME");
+Builder.defineMacro("__ARM_FEATURE_LOCALLY_STREAMING", "1");
+  }
+
+  if (HasSME2) {
+Builder.defineMacro("__ARM_FEATURE_SME");
+Builder.defineMacro("__ARM_FEATURE_SME2");
+Builder.defineMacro("__ARM_FEATURE_LOCALLY_STREAMING", "1");
+  }
+
   if (HasCRC)
 Builder.defineMacro("__ARM_FEATURE_CRC32", "1");
 
@@ -686,6 +702,7 @@ bool AArch64TargetInfo::hasFeature(StringRef Feature) const 
{
   .Case("sve2-sha3", FPU & SveMode && HasSVE2SHA3)
   .Case("sve2-sm4", FPU & SveMode && HasSVE2SM4)
   .Case("sme", HasSME)
+  .Case("sme2", HasSME2)
   .Case("sme-f64f64", HasSMEF64F64)
   .Case("sme-i16i64", HasSMEI16I64)
   .Case("sme-fa64", HasSMEFA64)
@@ -806,6 +823,12 @@ bool 
AArch64TargetInfo::handleTargetFeatures(std::vector &Features,
   HasBFloat16 = true;
   HasFullFP16 = true;
 }
+if (Feature == "+sme2") {
+  HasSME = true;
+  HasSME2 = true;
+  HasBFloat16 = true;
+  HasFullFP16 = true;
+}
 if (Feature == "+sme-f64f64") {
   HasSME = true;
   HasSMEF64F64 = true;
diff --git a/clang/lib/Basic/Targets/AArch64.h 
b/clang/lib/Basic/Targets/AArch64.h
index f0e0782e7abe9..9699222b0bf77 100644
--- a/clang/lib/Basic/Targets/AArch64.h
+++ b/clang/lib/Basic/Targets/AArch64.h
@@ -68,6 +68,7 @@ class LLVM_LIBRARY_VISIBILITY AArch64TargetInfo : public 
TargetInfo {
   bool HasCCDP = false;
   bool HasFRInt3264 = false;
   bool HasSME = false;
+  bool HasSME2 = false;
   bool HasSMEF64F64 = false;
   bool HasSMEI16I64 = false;
   bool HasSB = false;
diff --git a/clang/test/Preprocessor/aarch64-target-features.c 
b/clang/test/Preprocessor/aarch64-target-features.c
index 15879da04fcf0..9914775097e57 100644
--- a/clang/test/Preprocessor/aarch64-target-features.c
+++ b/clang/test/Preprocessor/aarch64-target-features.c
@@ -60,6 +60,10 @@
 // CHECK-NOT: __ARM_FEATURE_SVE_BITS 512
 // CHECK-NOT: __ARM_FEATURE_SVE_BITS 1024
 // CHECK-NOT: __ARM_FEATURE_SVE_BITS 2048
+// CHECK: __ARM_STATE_ZA 1
+// CHECK: __ARM_STATE_ZT0 1
+// CHECK-NOT: __ARM_FEATURE_SME
+// CHECK-NOT: __ARM_FEATURE_SME2
 
 // RUN: %clang -target aarch64-none-elf -march=armv8-r -x c -E -dM %s -o - | 
FileCheck %s -check-prefix CHECK-R-PROFILE
 // RUN: %clang -target arm64-none-linux-gnu -march=armv8-r -x c -E -dM %s -o - 
| FileCheck %s -check-prefix CHECK-R-PROFILE
@@ -634,3 +638,12 @@
 
 // RUN: %clang --target=aarch64 -march=armv8.2-a+rcpc3 -x c -E -dM %s -o - | 
FileCheck --check-prefix=CHECK-RCPC3 %s
 // CHECK-RCPC3: __ARM_FEATURE_RCPC 3
+
+// RUN: %clang --target=aarch64 -march=armv9-a+sme -x c -E -dM %s -o - | 
FileCheck --check-prefix=CHECK-SME %s
+// CHECK-SME: __ARM_FEATURE_LOCALLY_STREAMING 1
+// CHECK-SME: __ARM_FEATURE_SME 1
+//
+// RUN: %clang --target=aarch64 -march=armv9-a+sme2 -x c -E -dM %s -o - | 
FileCheck --check-prefix=CHECK-SME2 %s
+// CHECK-SME2: __ARM_FEATURE_LOCALLY_STREAMING 1
+// CHECK-SME2: __ARM_FEATURE_SME 1
+// CHECK-SME2: __ARM_FEATURE_SME2 1
diff --git a/clang/test/Preprocessor/init-aarch64.c 
b/clang/test/Preprocessor/init-a

[llvm-branch-commits] [clang] PR for llvm/llvm-project#80441 (PR #80444)

2024-02-02 Thread via llvm-branch-commits

https://github.com/llvmbot updated 
https://github.com/llvm/llvm-project/pull/80444

>From 9308c418a5603a4b095537462a3272208de69b31 Mon Sep 17 00:00:00 2001
From: Sander de Smalen 
Date: Fri, 2 Feb 2024 09:29:47 +
Subject: [PATCH] [Clang][AArch64] Add missing SME macros (#80293)

__ARM_STATE_ZA and __ARM_STATE_ZT0 are set when the compiler can parse
the "za" and "zt0" strings in the SME attributes.

__ARM_FEATURE_SME and __ARM_FEATURE_SME2 are set when the compiler can
generate code for attributes with "za" and "zt0" state, respectively.

__ARM_FEATURE_LOCALLY_STREAMING is set when the compiler supports the
__arm_locally_streaming attribute.

(cherry picked from commit 9e649518e6038a5b9ea38cfa424468657d3be59e)
---
 clang/lib/Basic/Targets/AArch64.cpp   | 23 +++
 clang/lib/Basic/Targets/AArch64.h |  1 +
 .../Preprocessor/aarch64-target-features.c| 13 +++
 clang/test/Preprocessor/init-aarch64.c|  2 ++
 4 files changed, 39 insertions(+)

diff --git a/clang/lib/Basic/Targets/AArch64.cpp 
b/clang/lib/Basic/Targets/AArch64.cpp
index d47181bfca4fc..336b7a5e3d727 100644
--- a/clang/lib/Basic/Targets/AArch64.cpp
+++ b/clang/lib/Basic/Targets/AArch64.cpp
@@ -387,6 +387,11 @@ void AArch64TargetInfo::getTargetDefines(const LangOptions 
&Opts,
 
   Builder.defineMacro("__ARM_ALIGN_MAX_STACK_PWR", "4");
 
+  // These macros are set when Clang can parse declarations with these
+  // attributes.
+  Builder.defineMacro("__ARM_STATE_ZA", "1");
+  Builder.defineMacro("__ARM_STATE_ZT0", "1");
+
   // 0xe implies support for half, single and double precision operations.
   if (FPU & FPUMode)
 Builder.defineMacro("__ARM_FP", "0xE");
@@ -431,6 +436,17 @@ void AArch64TargetInfo::getTargetDefines(const LangOptions 
&Opts,
   if (HasSVE2 && HasSVE2SM4)
 Builder.defineMacro("__ARM_FEATURE_SVE2_SM4", "1");
 
+  if (HasSME) {
+Builder.defineMacro("__ARM_FEATURE_SME");
+Builder.defineMacro("__ARM_FEATURE_LOCALLY_STREAMING", "1");
+  }
+
+  if (HasSME2) {
+Builder.defineMacro("__ARM_FEATURE_SME");
+Builder.defineMacro("__ARM_FEATURE_SME2");
+Builder.defineMacro("__ARM_FEATURE_LOCALLY_STREAMING", "1");
+  }
+
   if (HasCRC)
 Builder.defineMacro("__ARM_FEATURE_CRC32", "1");
 
@@ -686,6 +702,7 @@ bool AArch64TargetInfo::hasFeature(StringRef Feature) const 
{
   .Case("sve2-sha3", FPU & SveMode && HasSVE2SHA3)
   .Case("sve2-sm4", FPU & SveMode && HasSVE2SM4)
   .Case("sme", HasSME)
+  .Case("sme2", HasSME2)
   .Case("sme-f64f64", HasSMEF64F64)
   .Case("sme-i16i64", HasSMEI16I64)
   .Case("sme-fa64", HasSMEFA64)
@@ -806,6 +823,12 @@ bool 
AArch64TargetInfo::handleTargetFeatures(std::vector &Features,
   HasBFloat16 = true;
   HasFullFP16 = true;
 }
+if (Feature == "+sme2") {
+  HasSME = true;
+  HasSME2 = true;
+  HasBFloat16 = true;
+  HasFullFP16 = true;
+}
 if (Feature == "+sme-f64f64") {
   HasSME = true;
   HasSMEF64F64 = true;
diff --git a/clang/lib/Basic/Targets/AArch64.h 
b/clang/lib/Basic/Targets/AArch64.h
index f0e0782e7abe9..9699222b0bf77 100644
--- a/clang/lib/Basic/Targets/AArch64.h
+++ b/clang/lib/Basic/Targets/AArch64.h
@@ -68,6 +68,7 @@ class LLVM_LIBRARY_VISIBILITY AArch64TargetInfo : public 
TargetInfo {
   bool HasCCDP = false;
   bool HasFRInt3264 = false;
   bool HasSME = false;
+  bool HasSME2 = false;
   bool HasSMEF64F64 = false;
   bool HasSMEI16I64 = false;
   bool HasSB = false;
diff --git a/clang/test/Preprocessor/aarch64-target-features.c 
b/clang/test/Preprocessor/aarch64-target-features.c
index 15879da04fcf0..9914775097e57 100644
--- a/clang/test/Preprocessor/aarch64-target-features.c
+++ b/clang/test/Preprocessor/aarch64-target-features.c
@@ -60,6 +60,10 @@
 // CHECK-NOT: __ARM_FEATURE_SVE_BITS 512
 // CHECK-NOT: __ARM_FEATURE_SVE_BITS 1024
 // CHECK-NOT: __ARM_FEATURE_SVE_BITS 2048
+// CHECK: __ARM_STATE_ZA 1
+// CHECK: __ARM_STATE_ZT0 1
+// CHECK-NOT: __ARM_FEATURE_SME
+// CHECK-NOT: __ARM_FEATURE_SME2
 
 // RUN: %clang -target aarch64-none-elf -march=armv8-r -x c -E -dM %s -o - | 
FileCheck %s -check-prefix CHECK-R-PROFILE
 // RUN: %clang -target arm64-none-linux-gnu -march=armv8-r -x c -E -dM %s -o - 
| FileCheck %s -check-prefix CHECK-R-PROFILE
@@ -634,3 +638,12 @@
 
 // RUN: %clang --target=aarch64 -march=armv8.2-a+rcpc3 -x c -E -dM %s -o - | 
FileCheck --check-prefix=CHECK-RCPC3 %s
 // CHECK-RCPC3: __ARM_FEATURE_RCPC 3
+
+// RUN: %clang --target=aarch64 -march=armv9-a+sme -x c -E -dM %s -o - | 
FileCheck --check-prefix=CHECK-SME %s
+// CHECK-SME: __ARM_FEATURE_LOCALLY_STREAMING 1
+// CHECK-SME: __ARM_FEATURE_SME 1
+//
+// RUN: %clang --target=aarch64 -march=armv9-a+sme2 -x c -E -dM %s -o - | 
FileCheck --check-prefix=CHECK-SME2 %s
+// CHECK-SME2: __ARM_FEATURE_LOCALLY_STREAMING 1
+// CHECK-SME2: __ARM_FEATURE_SME 1
+// CHECK-SME2: __ARM_FEATURE_SME2 1
diff --git a/clang/test/Preprocessor/init-aarch64.c 
b/clang/test/Preprocessor/init-a

[llvm-branch-commits] [clang] PR for llvm/llvm-project#80441 (PR #80444)

2024-02-02 Thread via llvm-branch-commits

llvmbot wrote:



@llvm/pr-subscribers-backend-aarch64

@llvm/pr-subscribers-clang

Author: None (llvmbot)


Changes

resolves llvm/llvm-project#80441

---
Full diff: https://github.com/llvm/llvm-project/pull/80444.diff


4 Files Affected:

- (modified) clang/lib/Basic/Targets/AArch64.cpp (+23) 
- (modified) clang/lib/Basic/Targets/AArch64.h (+1) 
- (modified) clang/test/Preprocessor/aarch64-target-features.c (+13) 
- (modified) clang/test/Preprocessor/init-aarch64.c (+2) 


``diff
diff --git a/clang/lib/Basic/Targets/AArch64.cpp 
b/clang/lib/Basic/Targets/AArch64.cpp
index d47181bfca4fc..336b7a5e3d727 100644
--- a/clang/lib/Basic/Targets/AArch64.cpp
+++ b/clang/lib/Basic/Targets/AArch64.cpp
@@ -387,6 +387,11 @@ void AArch64TargetInfo::getTargetDefines(const LangOptions 
&Opts,
 
   Builder.defineMacro("__ARM_ALIGN_MAX_STACK_PWR", "4");
 
+  // These macros are set when Clang can parse declarations with these
+  // attributes.
+  Builder.defineMacro("__ARM_STATE_ZA", "1");
+  Builder.defineMacro("__ARM_STATE_ZT0", "1");
+
   // 0xe implies support for half, single and double precision operations.
   if (FPU & FPUMode)
 Builder.defineMacro("__ARM_FP", "0xE");
@@ -431,6 +436,17 @@ void AArch64TargetInfo::getTargetDefines(const LangOptions 
&Opts,
   if (HasSVE2 && HasSVE2SM4)
 Builder.defineMacro("__ARM_FEATURE_SVE2_SM4", "1");
 
+  if (HasSME) {
+Builder.defineMacro("__ARM_FEATURE_SME");
+Builder.defineMacro("__ARM_FEATURE_LOCALLY_STREAMING", "1");
+  }
+
+  if (HasSME2) {
+Builder.defineMacro("__ARM_FEATURE_SME");
+Builder.defineMacro("__ARM_FEATURE_SME2");
+Builder.defineMacro("__ARM_FEATURE_LOCALLY_STREAMING", "1");
+  }
+
   if (HasCRC)
 Builder.defineMacro("__ARM_FEATURE_CRC32", "1");
 
@@ -686,6 +702,7 @@ bool AArch64TargetInfo::hasFeature(StringRef Feature) const 
{
   .Case("sve2-sha3", FPU & SveMode && HasSVE2SHA3)
   .Case("sve2-sm4", FPU & SveMode && HasSVE2SM4)
   .Case("sme", HasSME)
+  .Case("sme2", HasSME2)
   .Case("sme-f64f64", HasSMEF64F64)
   .Case("sme-i16i64", HasSMEI16I64)
   .Case("sme-fa64", HasSMEFA64)
@@ -806,6 +823,12 @@ bool 
AArch64TargetInfo::handleTargetFeatures(std::vector &Features,
   HasBFloat16 = true;
   HasFullFP16 = true;
 }
+if (Feature == "+sme2") {
+  HasSME = true;
+  HasSME2 = true;
+  HasBFloat16 = true;
+  HasFullFP16 = true;
+}
 if (Feature == "+sme-f64f64") {
   HasSME = true;
   HasSMEF64F64 = true;
diff --git a/clang/lib/Basic/Targets/AArch64.h 
b/clang/lib/Basic/Targets/AArch64.h
index f0e0782e7abe9..9699222b0bf77 100644
--- a/clang/lib/Basic/Targets/AArch64.h
+++ b/clang/lib/Basic/Targets/AArch64.h
@@ -68,6 +68,7 @@ class LLVM_LIBRARY_VISIBILITY AArch64TargetInfo : public 
TargetInfo {
   bool HasCCDP = false;
   bool HasFRInt3264 = false;
   bool HasSME = false;
+  bool HasSME2 = false;
   bool HasSMEF64F64 = false;
   bool HasSMEI16I64 = false;
   bool HasSB = false;
diff --git a/clang/test/Preprocessor/aarch64-target-features.c 
b/clang/test/Preprocessor/aarch64-target-features.c
index 15879da04fcf0..9914775097e57 100644
--- a/clang/test/Preprocessor/aarch64-target-features.c
+++ b/clang/test/Preprocessor/aarch64-target-features.c
@@ -60,6 +60,10 @@
 // CHECK-NOT: __ARM_FEATURE_SVE_BITS 512
 // CHECK-NOT: __ARM_FEATURE_SVE_BITS 1024
 // CHECK-NOT: __ARM_FEATURE_SVE_BITS 2048
+// CHECK: __ARM_STATE_ZA 1
+// CHECK: __ARM_STATE_ZT0 1
+// CHECK-NOT: __ARM_FEATURE_SME
+// CHECK-NOT: __ARM_FEATURE_SME2
 
 // RUN: %clang -target aarch64-none-elf -march=armv8-r -x c -E -dM %s -o - | 
FileCheck %s -check-prefix CHECK-R-PROFILE
 // RUN: %clang -target arm64-none-linux-gnu -march=armv8-r -x c -E -dM %s -o - 
| FileCheck %s -check-prefix CHECK-R-PROFILE
@@ -634,3 +638,12 @@
 
 // RUN: %clang --target=aarch64 -march=armv8.2-a+rcpc3 -x c -E -dM %s -o - | 
FileCheck --check-prefix=CHECK-RCPC3 %s
 // CHECK-RCPC3: __ARM_FEATURE_RCPC 3
+
+// RUN: %clang --target=aarch64 -march=armv9-a+sme -x c -E -dM %s -o - | 
FileCheck --check-prefix=CHECK-SME %s
+// CHECK-SME: __ARM_FEATURE_LOCALLY_STREAMING 1
+// CHECK-SME: __ARM_FEATURE_SME 1
+//
+// RUN: %clang --target=aarch64 -march=armv9-a+sme2 -x c -E -dM %s -o - | 
FileCheck --check-prefix=CHECK-SME2 %s
+// CHECK-SME2: __ARM_FEATURE_LOCALLY_STREAMING 1
+// CHECK-SME2: __ARM_FEATURE_SME 1
+// CHECK-SME2: __ARM_FEATURE_SME2 1
diff --git a/clang/test/Preprocessor/init-aarch64.c 
b/clang/test/Preprocessor/init-aarch64.c
index f1f1bbbf66945..cf96870b27acb 100644
--- a/clang/test/Preprocessor/init-aarch64.c
+++ b/clang/test/Preprocessor/init-aarch64.c
@@ -32,6 +32,8 @@
 // AARCH64-NEXT: #define __ARM_PCS_AAPCS64 1
 // AARCH64-NEXT: #define __ARM_SIZEOF_MINIMAL_ENUM 4
 // AARCH64-NEXT: #define __ARM_SIZEOF_WCHAR_T 4
+// AARCH64-NEXT: #define __ARM_STATE_ZA 1
+// AARCH64-NEXT: #define __ARM_STATE_ZT0 1
 // AARCH64-NEXT: #define __ATOMIC_ACQUIRE 2
 // AARCH64-NEXT: #define __ATOMIC_ACQ_REL 4
 // AARCH64-NEXT: #define __A

[llvm-branch-commits] [clang] PR for llvm/llvm-project#80441 (PR #80444)

2024-02-02 Thread via llvm-branch-commits

llvmbot wrote:

@kmclaughlin-arm What do you think about merging this PR to the release branch?

https://github.com/llvm/llvm-project/pull/80444
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang] PR for llvm/llvm-project#80441 (PR #80444)

2024-02-02 Thread via llvm-branch-commits

https://github.com/llvmbot milestoned 
https://github.com/llvm/llvm-project/pull/80444
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang] PR for llvm/llvm-project#80441 (PR #80444)

2024-02-02 Thread via llvm-branch-commits

https://github.com/llvmbot created 
https://github.com/llvm/llvm-project/pull/80444

resolves llvm/llvm-project#80441

>From aac6e31e253fa93c3b59d799633b02ef7ffb5099 Mon Sep 17 00:00:00 2001
From: Sander de Smalen 
Date: Fri, 2 Feb 2024 09:29:47 +
Subject: [PATCH] [Clang][AArch64] Add missing SME macros (#80293)

__ARM_STATE_ZA and __ARM_STATE_ZT0 are set when the compiler can parse
the "za" and "zt0" strings in the SME attributes.

__ARM_FEATURE_SME and __ARM_FEATURE_SME2 are set when the compiler can
generate code for attributes with "za" and "zt0" state, respectively.

__ARM_FEATURE_LOCALLY_STREAMING is set when the compiler supports the
__arm_locally_streaming attribute.

(cherry picked from commit 9e649518e6038a5b9ea38cfa424468657d3be59e)
---
 clang/lib/Basic/Targets/AArch64.cpp   | 23 +++
 clang/lib/Basic/Targets/AArch64.h |  1 +
 .../Preprocessor/aarch64-target-features.c| 13 +++
 clang/test/Preprocessor/init-aarch64.c|  2 ++
 4 files changed, 39 insertions(+)

diff --git a/clang/lib/Basic/Targets/AArch64.cpp 
b/clang/lib/Basic/Targets/AArch64.cpp
index d47181bfca4fc..336b7a5e3d727 100644
--- a/clang/lib/Basic/Targets/AArch64.cpp
+++ b/clang/lib/Basic/Targets/AArch64.cpp
@@ -387,6 +387,11 @@ void AArch64TargetInfo::getTargetDefines(const LangOptions 
&Opts,
 
   Builder.defineMacro("__ARM_ALIGN_MAX_STACK_PWR", "4");
 
+  // These macros are set when Clang can parse declarations with these
+  // attributes.
+  Builder.defineMacro("__ARM_STATE_ZA", "1");
+  Builder.defineMacro("__ARM_STATE_ZT0", "1");
+
   // 0xe implies support for half, single and double precision operations.
   if (FPU & FPUMode)
 Builder.defineMacro("__ARM_FP", "0xE");
@@ -431,6 +436,17 @@ void AArch64TargetInfo::getTargetDefines(const LangOptions 
&Opts,
   if (HasSVE2 && HasSVE2SM4)
 Builder.defineMacro("__ARM_FEATURE_SVE2_SM4", "1");
 
+  if (HasSME) {
+Builder.defineMacro("__ARM_FEATURE_SME");
+Builder.defineMacro("__ARM_FEATURE_LOCALLY_STREAMING", "1");
+  }
+
+  if (HasSME2) {
+Builder.defineMacro("__ARM_FEATURE_SME");
+Builder.defineMacro("__ARM_FEATURE_SME2");
+Builder.defineMacro("__ARM_FEATURE_LOCALLY_STREAMING", "1");
+  }
+
   if (HasCRC)
 Builder.defineMacro("__ARM_FEATURE_CRC32", "1");
 
@@ -686,6 +702,7 @@ bool AArch64TargetInfo::hasFeature(StringRef Feature) const 
{
   .Case("sve2-sha3", FPU & SveMode && HasSVE2SHA3)
   .Case("sve2-sm4", FPU & SveMode && HasSVE2SM4)
   .Case("sme", HasSME)
+  .Case("sme2", HasSME2)
   .Case("sme-f64f64", HasSMEF64F64)
   .Case("sme-i16i64", HasSMEI16I64)
   .Case("sme-fa64", HasSMEFA64)
@@ -806,6 +823,12 @@ bool 
AArch64TargetInfo::handleTargetFeatures(std::vector &Features,
   HasBFloat16 = true;
   HasFullFP16 = true;
 }
+if (Feature == "+sme2") {
+  HasSME = true;
+  HasSME2 = true;
+  HasBFloat16 = true;
+  HasFullFP16 = true;
+}
 if (Feature == "+sme-f64f64") {
   HasSME = true;
   HasSMEF64F64 = true;
diff --git a/clang/lib/Basic/Targets/AArch64.h 
b/clang/lib/Basic/Targets/AArch64.h
index f0e0782e7abe9..9699222b0bf77 100644
--- a/clang/lib/Basic/Targets/AArch64.h
+++ b/clang/lib/Basic/Targets/AArch64.h
@@ -68,6 +68,7 @@ class LLVM_LIBRARY_VISIBILITY AArch64TargetInfo : public 
TargetInfo {
   bool HasCCDP = false;
   bool HasFRInt3264 = false;
   bool HasSME = false;
+  bool HasSME2 = false;
   bool HasSMEF64F64 = false;
   bool HasSMEI16I64 = false;
   bool HasSB = false;
diff --git a/clang/test/Preprocessor/aarch64-target-features.c 
b/clang/test/Preprocessor/aarch64-target-features.c
index 15879da04fcf0..9914775097e57 100644
--- a/clang/test/Preprocessor/aarch64-target-features.c
+++ b/clang/test/Preprocessor/aarch64-target-features.c
@@ -60,6 +60,10 @@
 // CHECK-NOT: __ARM_FEATURE_SVE_BITS 512
 // CHECK-NOT: __ARM_FEATURE_SVE_BITS 1024
 // CHECK-NOT: __ARM_FEATURE_SVE_BITS 2048
+// CHECK: __ARM_STATE_ZA 1
+// CHECK: __ARM_STATE_ZT0 1
+// CHECK-NOT: __ARM_FEATURE_SME
+// CHECK-NOT: __ARM_FEATURE_SME2
 
 // RUN: %clang -target aarch64-none-elf -march=armv8-r -x c -E -dM %s -o - | 
FileCheck %s -check-prefix CHECK-R-PROFILE
 // RUN: %clang -target arm64-none-linux-gnu -march=armv8-r -x c -E -dM %s -o - 
| FileCheck %s -check-prefix CHECK-R-PROFILE
@@ -634,3 +638,12 @@
 
 // RUN: %clang --target=aarch64 -march=armv8.2-a+rcpc3 -x c -E -dM %s -o - | 
FileCheck --check-prefix=CHECK-RCPC3 %s
 // CHECK-RCPC3: __ARM_FEATURE_RCPC 3
+
+// RUN: %clang --target=aarch64 -march=armv9-a+sme -x c -E -dM %s -o - | 
FileCheck --check-prefix=CHECK-SME %s
+// CHECK-SME: __ARM_FEATURE_LOCALLY_STREAMING 1
+// CHECK-SME: __ARM_FEATURE_SME 1
+//
+// RUN: %clang --target=aarch64 -march=armv9-a+sme2 -x c -E -dM %s -o - | 
FileCheck --check-prefix=CHECK-SME2 %s
+// CHECK-SME2: __ARM_FEATURE_LOCALLY_STREAMING 1
+// CHECK-SME2: __ARM_FEATURE_SME 1
+// CHECK-SME2: __ARM_FEATURE_SME2 1
diff --git a/clang/test/Preprocessor/init-aarch64.c

[llvm-branch-commits] [llvm] PR for llvm/llvm-project#78621 (PR #80260)

2024-02-02 Thread Nikita Popov via llvm-branch-commits

https://github.com/nikic approved this pull request.

LGTM

https://github.com/llvm/llvm-project/pull/80260
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang] PR for llvm/llvm-project#80432 (PR #80433)

2024-02-02 Thread via llvm-branch-commits

llvmbot wrote:




@llvm/pr-subscribers-clang

Author: None (llvmbot)


Changes

resolves llvm/llvm-project#80432

---
Full diff: https://github.com/llvm/llvm-project/pull/80433.diff


3 Files Affected:

- (modified) clang/include/clang/Basic/DiagnosticSemaKinds.td (+6) 
- (modified) clang/lib/Sema/SemaChecking.cpp (+23-27) 
- (modified) clang/test/Sema/aarch64-sme-func-attrs.c (+11-2) 


``diff
diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td 
b/clang/include/clang/Basic/DiagnosticSemaKinds.td
index a1c32abb4dcd8..ef8c111b1d8cc 100644
--- a/clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -3711,6 +3711,12 @@ def err_sme_za_call_no_za_state : Error<
   "call to a shared ZA function requires the caller to have ZA state">;
 def err_sme_zt0_call_no_zt0_state : Error<
   "call to a shared ZT0 function requires the caller to have ZT0 state">;
+def err_sme_unimplemented_za_save_restore : Error<
+  "call to a function that shares state other than 'za' from a "
+  "function that has live 'za' state requires a spill/fill of ZA, which is not 
yet "
+  "implemented">;
+def note_sme_use_preserves_za : Note<
+  "add '__arm_preserves(\"za\")' to the callee if it preserves ZA">;
 def err_sme_definition_using_sm_in_non_sme_target : Error<
   "function executed in streaming-SVE mode requires 'sme'">;
 def err_sme_definition_using_za_in_non_sme_target : Error<
diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp
index 7833d5a2ea20e..eef80e55e1123 100644
--- a/clang/lib/Sema/SemaChecking.cpp
+++ b/clang/lib/Sema/SemaChecking.cpp
@@ -7545,47 +7545,43 @@ void Sema::checkCall(NamedDecl *FDecl, const 
FunctionProtoType *Proto,
   }
 }
 
-// If the callee uses AArch64 SME ZA state but the caller doesn't define
-// any, then this is an error.
-FunctionType::ArmStateValue ArmZAState =
+FunctionType::ArmStateValue CalleeArmZAState =
 FunctionType::getArmZAState(ExtInfo.AArch64SMEAttributes);
-if (ArmZAState != FunctionType::ARM_None) {
+FunctionType::ArmStateValue CalleeArmZT0State =
+FunctionType::getArmZT0State(ExtInfo.AArch64SMEAttributes);
+if (CalleeArmZAState != FunctionType::ARM_None ||
+CalleeArmZT0State != FunctionType::ARM_None) {
   bool CallerHasZAState = false;
+  bool CallerHasZT0State = false;
   if (const auto *CallerFD = dyn_cast(CurContext)) {
 auto *Attr = CallerFD->getAttr();
 if (Attr && Attr->isNewZA())
   CallerHasZAState = true;
-else if (const auto *FPT =
- CallerFD->getType()->getAs())
-  CallerHasZAState = FunctionType::getArmZAState(
- FPT->getExtProtoInfo().AArch64SMEAttributes) 
!=
- FunctionType::ARM_None;
-  }
-
-  if (!CallerHasZAState)
-Diag(Loc, diag::err_sme_za_call_no_za_state);
-}
-
-// If the callee uses AArch64 SME ZT0 state but the caller doesn't define
-// any, then this is an error.
-FunctionType::ArmStateValue ArmZT0State =
-FunctionType::getArmZT0State(ExtInfo.AArch64SMEAttributes);
-if (ArmZT0State != FunctionType::ARM_None) {
-  bool CallerHasZT0State = false;
-  if (const auto *CallerFD = dyn_cast(CurContext)) {
-auto *Attr = CallerFD->getAttr();
 if (Attr && Attr->isNewZT0())
   CallerHasZT0State = true;
-else if (const auto *FPT =
- CallerFD->getType()->getAs())
-  CallerHasZT0State =
+if (const auto *FPT = CallerFD->getType()->getAs()) 
{
+  CallerHasZAState |=
+  FunctionType::getArmZAState(
+  FPT->getExtProtoInfo().AArch64SMEAttributes) !=
+  FunctionType::ARM_None;
+  CallerHasZT0State |=
   FunctionType::getArmZT0State(
   FPT->getExtProtoInfo().AArch64SMEAttributes) !=
   FunctionType::ARM_None;
+}
   }
 
-  if (!CallerHasZT0State)
+  if (CalleeArmZAState != FunctionType::ARM_None && !CallerHasZAState)
+Diag(Loc, diag::err_sme_za_call_no_za_state);
+
+  if (CalleeArmZT0State != FunctionType::ARM_None && !CallerHasZT0State)
 Diag(Loc, diag::err_sme_zt0_call_no_zt0_state);
+
+  if (CallerHasZAState && CalleeArmZAState == FunctionType::ARM_None &&
+  CalleeArmZT0State != FunctionType::ARM_None) {
+Diag(Loc, diag::err_sme_unimplemented_za_save_restore);
+Diag(Loc, diag::note_sme_use_preserves_za);
+  }
 }
   }
 
diff --git a/clang/test/Sema/aarch64-sme-func-attrs.c 
b/clang/test/Sema/aarch64-sme-func-attrs.c
index 97409ae7d6040..2bf1886951f1f 100644
--- a/clang/test/Sema/aarch64-sme-func-attrs.c
+++ b/clang/test/Sema/aarch64-sme-func-attrs.c
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme 
-fsyntax-only -verify %s
-// RUN: %clang_cc1 -triple aarch64-none-linux-gn

[llvm-branch-commits] [clang] PR for llvm/llvm-project#80432 (PR #80433)

2024-02-02 Thread via llvm-branch-commits

llvmbot wrote:

@dtemirbulatov What do you think about merging this PR to the release branch?

https://github.com/llvm/llvm-project/pull/80433
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang] PR for llvm/llvm-project#80432 (PR #80433)

2024-02-02 Thread via llvm-branch-commits

https://github.com/llvmbot milestoned 
https://github.com/llvm/llvm-project/pull/80433
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang] PR for llvm/llvm-project#80432 (PR #80433)

2024-02-02 Thread via llvm-branch-commits

https://github.com/llvmbot created 
https://github.com/llvm/llvm-project/pull/80433

resolves llvm/llvm-project#80432

>From cacabf06ef3aedcfacacd9d2664abd8acec003a8 Mon Sep 17 00:00:00 2001
From: Sander de Smalen 
Date: Fri, 2 Feb 2024 11:56:38 +
Subject: [PATCH] [Clang][AArch64] Emit 'unimplemented' diagnostic for SME
 (#80295)

When a function F has ZA and ZT0 state, calls another function G that
only shares ZT0 state with its caller, F will have to save ZA before
the call to G, and restore it afterwards (rather than setting up a
lazy-sve).

This is not yet implemented in LLVM and does not result in a
compile-time error either. So instead of silently generating incorrect
code, it's better to emit an error saying this is not yet implemented.

(cherry picked from commit 319f4c03ba2909c7240ac157cc46216bf1518c10)
---
 .../clang/Basic/DiagnosticSemaKinds.td|  6 +++
 clang/lib/Sema/SemaChecking.cpp   | 50 +--
 clang/test/Sema/aarch64-sme-func-attrs.c  | 13 -
 3 files changed, 40 insertions(+), 29 deletions(-)

diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td 
b/clang/include/clang/Basic/DiagnosticSemaKinds.td
index a1c32abb4dcd8..ef8c111b1d8cc 100644
--- a/clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -3711,6 +3711,12 @@ def err_sme_za_call_no_za_state : Error<
   "call to a shared ZA function requires the caller to have ZA state">;
 def err_sme_zt0_call_no_zt0_state : Error<
   "call to a shared ZT0 function requires the caller to have ZT0 state">;
+def err_sme_unimplemented_za_save_restore : Error<
+  "call to a function that shares state other than 'za' from a "
+  "function that has live 'za' state requires a spill/fill of ZA, which is not 
yet "
+  "implemented">;
+def note_sme_use_preserves_za : Note<
+  "add '__arm_preserves(\"za\")' to the callee if it preserves ZA">;
 def err_sme_definition_using_sm_in_non_sme_target : Error<
   "function executed in streaming-SVE mode requires 'sme'">;
 def err_sme_definition_using_za_in_non_sme_target : Error<
diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp
index 7833d5a2ea20e..eef80e55e1123 100644
--- a/clang/lib/Sema/SemaChecking.cpp
+++ b/clang/lib/Sema/SemaChecking.cpp
@@ -7545,47 +7545,43 @@ void Sema::checkCall(NamedDecl *FDecl, const 
FunctionProtoType *Proto,
   }
 }
 
-// If the callee uses AArch64 SME ZA state but the caller doesn't define
-// any, then this is an error.
-FunctionType::ArmStateValue ArmZAState =
+FunctionType::ArmStateValue CalleeArmZAState =
 FunctionType::getArmZAState(ExtInfo.AArch64SMEAttributes);
-if (ArmZAState != FunctionType::ARM_None) {
+FunctionType::ArmStateValue CalleeArmZT0State =
+FunctionType::getArmZT0State(ExtInfo.AArch64SMEAttributes);
+if (CalleeArmZAState != FunctionType::ARM_None ||
+CalleeArmZT0State != FunctionType::ARM_None) {
   bool CallerHasZAState = false;
+  bool CallerHasZT0State = false;
   if (const auto *CallerFD = dyn_cast(CurContext)) {
 auto *Attr = CallerFD->getAttr();
 if (Attr && Attr->isNewZA())
   CallerHasZAState = true;
-else if (const auto *FPT =
- CallerFD->getType()->getAs())
-  CallerHasZAState = FunctionType::getArmZAState(
- FPT->getExtProtoInfo().AArch64SMEAttributes) 
!=
- FunctionType::ARM_None;
-  }
-
-  if (!CallerHasZAState)
-Diag(Loc, diag::err_sme_za_call_no_za_state);
-}
-
-// If the callee uses AArch64 SME ZT0 state but the caller doesn't define
-// any, then this is an error.
-FunctionType::ArmStateValue ArmZT0State =
-FunctionType::getArmZT0State(ExtInfo.AArch64SMEAttributes);
-if (ArmZT0State != FunctionType::ARM_None) {
-  bool CallerHasZT0State = false;
-  if (const auto *CallerFD = dyn_cast(CurContext)) {
-auto *Attr = CallerFD->getAttr();
 if (Attr && Attr->isNewZT0())
   CallerHasZT0State = true;
-else if (const auto *FPT =
- CallerFD->getType()->getAs())
-  CallerHasZT0State =
+if (const auto *FPT = CallerFD->getType()->getAs()) 
{
+  CallerHasZAState |=
+  FunctionType::getArmZAState(
+  FPT->getExtProtoInfo().AArch64SMEAttributes) !=
+  FunctionType::ARM_None;
+  CallerHasZT0State |=
   FunctionType::getArmZT0State(
   FPT->getExtProtoInfo().AArch64SMEAttributes) !=
   FunctionType::ARM_None;
+}
   }
 
-  if (!CallerHasZT0State)
+  if (CalleeArmZAState != FunctionType::ARM_None && !CallerHasZAState)
+Diag(Loc, diag::err_sme_za_call_no_za_state);
+
+  if (CalleeArmZT0State != FunctionType::ARM_None && !CallerHasZT0State)
 Diag(Loc, diag::err_sme_zt0_call_no_zt0_state);
+
+  if

[llvm-branch-commits] [mlir] [mlir] Start moving some builtin type formats to the dialect (PR #80421)

2024-02-02 Thread Markus Böck via llvm-branch-commits

https://github.com/zero9178 updated 
https://github.com/llvm/llvm-project/pull/80421

From e67e980cd077de77bb1683f4a9ad948f13ad4289 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Markus=20B=C3=B6ck?= 
Date: Fri, 2 Feb 2024 12:47:05 +0100
Subject: [PATCH] [mlir] Start moving some builtin type formats to the dialect

Most types and attributes in the builtin dialect are parsed and printed using 
special-purpose printers and parsers for that type. They also use the low-level 
`Printer` rather than the `AsmPrinter`, making the implementations inconsistent 
compared to all other dialects in MLIR.

This PR starts moving some builtin types to be parsed using the usual `print` 
and `parse` methods like all other MLIR dialects. This has the following 
advantages:
* The implementation now looks like any other dialect's types
* It is now possible to use `assemblyFormat` for builtin types and attributes
* The code can be easily moved to other dialects if desired
* Arguably better layering and less code
* As a side-effect, it is now also possible to write `!builtin.` for any 
types moved

A future benefit would include being able to print types and attributes in 
stripped format as well (e.g. `` vs `complex`), just like all other 
dialect types and attributes. This is currently explicitly disabled as it 
causes a LOT of changes in IR syntax and I believe some ambiguities in the 
parser.

For the purpose of reviewing and incremental development, this PR only moves 
`tuple`, `tensor`, `none`, `memref` and `complex`. The plan is to eventually 
move all attributes and types where the current syntax can be implemented 
within the dialect.

For backwards compatibility with the existing syntax, the builtin dialect is 
special-cased in the printer where the `builtin.` prefix is omitted.
---
 mlir/include/mlir/IR/BuiltinDialect.td |   2 +-
 mlir/include/mlir/IR/BuiltinTypes.td   |  25 ++-
 mlir/include/mlir/IR/OpImplementation.h|   5 +
 mlir/lib/AsmParser/DialectSymbolParser.cpp |  24 +++
 mlir/lib/AsmParser/Parser.h|  24 ++-
 mlir/lib/AsmParser/TypeParser.cpp  | 211 +
 mlir/lib/IR/AsmPrinter.cpp |  72 ++-
 mlir/lib/IR/BuiltinTypes.cpp   | 150 +++
 mlir/test/IR/invalid-builtin-types.mlir|  10 +-
 mlir/test/IR/invalid.mlir  |   4 +-
 mlir/test/IR/qualified-builtin.mlir|  11 ++
 11 files changed, 249 insertions(+), 289 deletions(-)
 create mode 100644 mlir/test/IR/qualified-builtin.mlir

diff --git a/mlir/include/mlir/IR/BuiltinDialect.td 
b/mlir/include/mlir/IR/BuiltinDialect.td
index c131107634b44..a8627170288c9 100644
--- a/mlir/include/mlir/IR/BuiltinDialect.td
+++ b/mlir/include/mlir/IR/BuiltinDialect.td
@@ -22,7 +22,7 @@ def Builtin_Dialect : Dialect {
   let name = "builtin";
   let cppNamespace = "::mlir";
   let useDefaultAttributePrinterParser = 0;
-  let useDefaultTypePrinterParser = 0;
+  let useDefaultTypePrinterParser = 1;
   let extraClassDeclaration = [{
   private:
 // Register the builtin Attributes.
diff --git a/mlir/include/mlir/IR/BuiltinTypes.td 
b/mlir/include/mlir/IR/BuiltinTypes.td
index 4cade83dd3c32..f3a51d2155040 100644
--- a/mlir/include/mlir/IR/BuiltinTypes.td
+++ b/mlir/include/mlir/IR/BuiltinTypes.td
@@ -25,7 +25,8 @@ include "mlir/IR/BuiltinTypeInterfaces.td"
 // Base class for Builtin dialect types.
 class Builtin_Type traits = [],
string baseCppClass = "::mlir::Type">
-: TypeDef {
+: TypeDef {
   let mnemonic = ?;
   let typeName = "builtin." # typeMnemonic;
 }
@@ -62,6 +63,9 @@ def Builtin_Complex : Builtin_Type<"Complex", "complex"> {
   ];
   let skipDefaultBuilders = 1;
   let genVerifyDecl = 1;
+
+  let mnemonic = "complex";
+  let assemblyFormat = "`<` $elementType `>`";
 }
 
 
//===--===//
@@ -668,6 +672,9 @@ def Builtin_MemRef : Builtin_Type<"MemRef", "memref", [
   }];
   let skipDefaultBuilders = 1;
   let genVerifyDecl = 1;
+
+  let mnemonic = "memref";
+  let hasCustomAssemblyFormat = 1;
 }
 
 
//===--===//
@@ -698,6 +705,8 @@ def Builtin_None : Builtin_Type<"None", "none"> {
   let extraClassDeclaration = [{
 static NoneType get(MLIRContext *context);
   }];
+
+  let mnemonic = "none";
 }
 
 
//===--===//
@@ -849,6 +858,9 @@ def Builtin_RankedTensor : Builtin_Type<"RankedTensor", 
"tensor", [
   }];
   let skipDefaultBuilders = 1;
   let genVerifyDecl = 1;
+
+  let mnemonic = "tensor";
+  let hasCustomAssemblyFormat = 1;
 }
 
 
//===--===//
@@ -884,7 +896,7 @@ def Builtin_Tuple : Builtin_Type<"Tuple", "tuple"> {
 tuple, i5>
 ```
   }];
-  let parameters = (ins "ArrayRef":$types);
+  let parameters = (ins OptionalArrayRefParameter<"Type">:$types);
   let

[llvm-branch-commits] [mlir] [mlir] Start moving some builtin type formats to the dialect (PR #80421)

2024-02-02 Thread via llvm-branch-commits

llvmbot wrote:




@llvm/pr-subscribers-mlir

Author: Markus Böck (zero9178)


Changes

Most types and attributes in the builtin dialect are parsed and printed using 
special-purpose printers and parsers for that type. They also use the low-level 
`Printer` rather than the `AsmPrinter`, making the implementations inconsistent 
compared to all other dialects in MLIR.

This PR starts moving some builtin types to be parsed using the usual `print` 
and `parse` methods like all other MLIR dialects. This has the following 
advantages:
* The implementation now looks like any other dialect's
* It is now possible to use `assemblyFormat` for builtin types and attributes
* The code can be easily moved to other dialects if desired
* Arguably better layering and less code
* As a side-effect, it is now also possible to write `!builtin.` 
for any types if desired

A future benefit would include being able to print types and attributes in 
stripped format as well (e.g. `` vs `complex`), just like 
all other dialect types and attributes. This is currently explicitly disabled 
as it causes a LOT of changes in IR syntax and I believe some ambiguities in 
the parser.

For the purpose of reviewing and incremental development, this PR only moves 
`tuple`, `tensor`, `none`, `memref` and `complex`. The plan is to eventually 
move all attributes and types where the current syntax can be implemented 
within the dialect.

For backwards compatibility with the existing syntax, the builtin dialect is 
special-cased in the printer where the `builtin.` prefix is omitted.

Depends on https://github.com/llvm/llvm-project/pull/80420

---

Patch is 28.53 KiB, truncated to 20.00 KiB below, full version: 
https://github.com/llvm/llvm-project/pull/80421.diff


11 Files Affected:

- (modified) mlir/include/mlir/IR/BuiltinDialect.td (+1-1) 
- (modified) mlir/include/mlir/IR/BuiltinTypes.td (+23-2) 
- (modified) mlir/include/mlir/IR/OpImplementation.h (+5) 
- (modified) mlir/lib/AsmParser/DialectSymbolParser.cpp (+24) 
- (modified) mlir/lib/AsmParser/Parser.h (+11-13) 
- (modified) mlir/lib/AsmParser/TypeParser.cpp (+3-208) 
- (modified) mlir/lib/IR/AsmPrinter.cpp (+14-58) 
- (modified) mlir/lib/IR/BuiltinTypes.cpp (+150) 
- (modified) mlir/test/IR/invalid-builtin-types.mlir (+5-5) 
- (modified) mlir/test/IR/invalid.mlir (+2-2) 
- (added) mlir/test/IR/qualified-builtin.mlir (+11) 


``diff
diff --git a/mlir/include/mlir/IR/BuiltinDialect.td 
b/mlir/include/mlir/IR/BuiltinDialect.td
index c131107634b44..a8627170288c9 100644
--- a/mlir/include/mlir/IR/BuiltinDialect.td
+++ b/mlir/include/mlir/IR/BuiltinDialect.td
@@ -22,7 +22,7 @@ def Builtin_Dialect : Dialect {
   let name = "builtin";
   let cppNamespace = "::mlir";
   let useDefaultAttributePrinterParser = 0;
-  let useDefaultTypePrinterParser = 0;
+  let useDefaultTypePrinterParser = 1;
   let extraClassDeclaration = [{
   private:
 // Register the builtin Attributes.
diff --git a/mlir/include/mlir/IR/BuiltinTypes.td 
b/mlir/include/mlir/IR/BuiltinTypes.td
index 4cade83dd3c32..f3a51d2155040 100644
--- a/mlir/include/mlir/IR/BuiltinTypes.td
+++ b/mlir/include/mlir/IR/BuiltinTypes.td
@@ -25,7 +25,8 @@ include "mlir/IR/BuiltinTypeInterfaces.td"
 // Base class for Builtin dialect types.
 class Builtin_Type traits = [],
string baseCppClass = "::mlir::Type">
-: TypeDef {
+: TypeDef {
   let mnemonic = ?;
   let typeName = "builtin." # typeMnemonic;
 }
@@ -62,6 +63,9 @@ def Builtin_Complex : Builtin_Type<"Complex", "complex"> {
   ];
   let skipDefaultBuilders = 1;
   let genVerifyDecl = 1;
+
+  let mnemonic = "complex";
+  let assemblyFormat = "`<` $elementType `>`";
 }
 
 
//===--===//
@@ -668,6 +672,9 @@ def Builtin_MemRef : Builtin_Type<"MemRef", "memref", [
   }];
   let skipDefaultBuilders = 1;
   let genVerifyDecl = 1;
+
+  let mnemonic = "memref";
+  let hasCustomAssemblyFormat = 1;
 }
 
 
//===--===//
@@ -698,6 +705,8 @@ def Builtin_None : Builtin_Type<"None", "none"> {
   let extraClassDeclaration = [{
 static NoneType get(MLIRContext *context);
   }];
+
+  let mnemonic = "none";
 }
 
 
//===--===//
@@ -849,6 +858,9 @@ def Builtin_RankedTensor : Builtin_Type<"RankedTensor", 
"tensor", [
   }];
   let skipDefaultBuilders = 1;
   let genVerifyDecl = 1;
+
+  let mnemonic = "tensor";
+  let hasCustomAssemblyFormat = 1;
 }
 
 
//===--===//
@@ -884,7 +896,7 @@ def Builtin_Tuple : Builtin_Type<"Tuple", "tuple"> {
 tuple, i5>
 ```
   }];
-  let parameters = (ins "ArrayRef":$types);
+  let parameters = (ins OptionalArrayRefParameter<"Type">:$types);
   let builders = [
 TypeBuilder<(ins "TypeRange":$elementTypes), [{
   return $_get($_ctxt, elementTypes);
@@ 

[llvm-branch-commits] [mlir] [mlir] Start moving some builtin type formats to the dialect (PR #80421)

2024-02-02 Thread via llvm-branch-commits

llvmbot wrote:




@llvm/pr-subscribers-mlir-ods

Author: Markus Böck (zero9178)


Changes

Most types and attributes in the builtin dialect are parsed and printed using 
special-purpose printers and parsers for that type. They also use the low-level 
`Printer` rather than the `AsmPrinter`, making the implementations inconsistent 
compared to all other dialects in MLIR.

This PR starts moving some builtin types to be parsed using the usual `print` 
and `parse` methods like all other MLIR dialects. This has the following 
advantages:
* The implementation now looks like any other dialect's
* It is now possible to use `assemblyFormat` for builtin types and attributes
* The code can be easily moved to other dialects if desired
* Arguably better layering and less code
* As a side-effect, it is now also possible to write `!builtin.` 
for any types if desired

A future benefit would include being able to print types and attributes in 
stripped format as well (e.g. `` vs `complex`), just like 
all other dialect types and attributes. This is currently explicitly disabled 
as it causes a LOT of changes in IR syntax and I believe some ambiguities in 
the parser.

For the purpose of reviewing and incremental development, this PR only moves 
`tuple`, `tensor`, `none`, `memref` and `complex`. The plan is to eventually 
move all attributes and types where the current syntax can be implemented 
within the dialect.

For backwards compatibility with the existing syntax, the builtin dialect is 
special-cased in the printer where the `builtin.` prefix is omitted.

Depends on https://github.com/llvm/llvm-project/pull/80420

---

Patch is 28.53 KiB, truncated to 20.00 KiB below, full version: 
https://github.com/llvm/llvm-project/pull/80421.diff


11 Files Affected:

- (modified) mlir/include/mlir/IR/BuiltinDialect.td (+1-1) 
- (modified) mlir/include/mlir/IR/BuiltinTypes.td (+23-2) 
- (modified) mlir/include/mlir/IR/OpImplementation.h (+5) 
- (modified) mlir/lib/AsmParser/DialectSymbolParser.cpp (+24) 
- (modified) mlir/lib/AsmParser/Parser.h (+11-13) 
- (modified) mlir/lib/AsmParser/TypeParser.cpp (+3-208) 
- (modified) mlir/lib/IR/AsmPrinter.cpp (+14-58) 
- (modified) mlir/lib/IR/BuiltinTypes.cpp (+150) 
- (modified) mlir/test/IR/invalid-builtin-types.mlir (+5-5) 
- (modified) mlir/test/IR/invalid.mlir (+2-2) 
- (added) mlir/test/IR/qualified-builtin.mlir (+11) 


``diff
diff --git a/mlir/include/mlir/IR/BuiltinDialect.td 
b/mlir/include/mlir/IR/BuiltinDialect.td
index c131107634b44..a8627170288c9 100644
--- a/mlir/include/mlir/IR/BuiltinDialect.td
+++ b/mlir/include/mlir/IR/BuiltinDialect.td
@@ -22,7 +22,7 @@ def Builtin_Dialect : Dialect {
   let name = "builtin";
   let cppNamespace = "::mlir";
   let useDefaultAttributePrinterParser = 0;
-  let useDefaultTypePrinterParser = 0;
+  let useDefaultTypePrinterParser = 1;
   let extraClassDeclaration = [{
   private:
 // Register the builtin Attributes.
diff --git a/mlir/include/mlir/IR/BuiltinTypes.td 
b/mlir/include/mlir/IR/BuiltinTypes.td
index 4cade83dd3c32..f3a51d2155040 100644
--- a/mlir/include/mlir/IR/BuiltinTypes.td
+++ b/mlir/include/mlir/IR/BuiltinTypes.td
@@ -25,7 +25,8 @@ include "mlir/IR/BuiltinTypeInterfaces.td"
 // Base class for Builtin dialect types.
 class Builtin_Type traits = [],
string baseCppClass = "::mlir::Type">
-: TypeDef {
+: TypeDef {
   let mnemonic = ?;
   let typeName = "builtin." # typeMnemonic;
 }
@@ -62,6 +63,9 @@ def Builtin_Complex : Builtin_Type<"Complex", "complex"> {
   ];
   let skipDefaultBuilders = 1;
   let genVerifyDecl = 1;
+
+  let mnemonic = "complex";
+  let assemblyFormat = "`<` $elementType `>`";
 }
 
 
//===--===//
@@ -668,6 +672,9 @@ def Builtin_MemRef : Builtin_Type<"MemRef", "memref", [
   }];
   let skipDefaultBuilders = 1;
   let genVerifyDecl = 1;
+
+  let mnemonic = "memref";
+  let hasCustomAssemblyFormat = 1;
 }
 
 
//===--===//
@@ -698,6 +705,8 @@ def Builtin_None : Builtin_Type<"None", "none"> {
   let extraClassDeclaration = [{
 static NoneType get(MLIRContext *context);
   }];
+
+  let mnemonic = "none";
 }
 
 
//===--===//
@@ -849,6 +858,9 @@ def Builtin_RankedTensor : Builtin_Type<"RankedTensor", 
"tensor", [
   }];
   let skipDefaultBuilders = 1;
   let genVerifyDecl = 1;
+
+  let mnemonic = "tensor";
+  let hasCustomAssemblyFormat = 1;
 }
 
 
//===--===//
@@ -884,7 +896,7 @@ def Builtin_Tuple : Builtin_Type<"Tuple", "tuple"> {
 tuple, i5>
 ```
   }];
-  let parameters = (ins "ArrayRef":$types);
+  let parameters = (ins OptionalArrayRefParameter<"Type">:$types);
   let builders = [
 TypeBuilder<(ins "TypeRange":$elementTypes), [{
   return $_get($_ctxt, elementTypes);

[llvm-branch-commits] [mlir] [mlir] Start moving some builtin type formats to the dialect (PR #80421)

2024-02-02 Thread Markus Böck via llvm-branch-commits

https://github.com/zero9178 created 
https://github.com/llvm/llvm-project/pull/80421

Most types and attributes in the builtin dialect are parsed and printed using 
special-purpose printers and parsers for that type. They also use the low-level 
`Printer` rather than the `AsmPrinter`, making the implementations inconsistent 
compared to all other dialects in MLIR.

This PR starts moving some builtin types to be parsed using the usual `print` 
and `parse` methods like all other MLIR dialects. This has the following 
advantages:
* The implementation now looks like any other dialect's
* It is now possible to use `assemblyFormat` for builtin types and attributes
* The code can be easily moved to other dialects if desired
* Arguably better layering and less code
* As a side-effect, it is now also possible to write `!builtin.` for any 
types if desired

A future benefit would include being able to print types and attributes in 
stripped format as well (e.g. `` vs `complex`), just like all other 
dialect types and attributes. This is currently explicitly disabled as it 
causes a LOT of changes in IR syntax and I believe some ambiguities in the 
parser.

For the purpose of reviewing and incremental development, this PR only moves 
`tuple`, `tensor`, `none`, `memref` and `complex`. The plan is to eventually 
move all attributes and types where the current syntax can be implemented 
within the dialect.

For backwards compatibility with the existing syntax, the builtin dialect is 
special-cased in the printer where the `builtin.` prefix is omitted.

Depends on https://github.com/llvm/llvm-project/pull/80420

From 5007356799376ecc2b0ef554d7308baf36e8e69c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Markus=20B=C3=B6ck?= 
Date: Fri, 2 Feb 2024 12:47:05 +0100
Subject: [PATCH] [mlir] Start moving some builtin type formats to the dialect

Most types and attributes in the builtin dialect are parsed and printed using 
special-purpose printers and parsers for that type. They also use the low-level 
`Printer` rather than the `AsmPrinter`, making the implementations inconsistent 
compared to all other dialects in MLIR.

This PR starts moving some builtin types to be parsed using the usual `print` 
and `parse` methods like all other MLIR dialects. This has the following 
advantages:
* The implementation now looks like any other dialect's types
* It is now possible to use `assemblyFormat` for builtin types and attributes
* The code can be easily moved to other dialects if desired
* Arguably better layering and less code
* As a side-effect, it is now also possible to write `!builtin.` for any 
types moved

A future benefit would include being able to print types and attributes in 
stripped format as well (e.g. `` vs `complex`), just like all other 
dialect types and attributes. This is currently explicitly disabled as it 
causes a LOT of changes in IR syntax and I believe some ambiguities in the 
parser.

For the purpose of reviewing and incremental development, this PR only moves 
`tuple`, `tensor`, `none`, `memref` and `complex`. The plan is to eventually 
move all attributes and types where the current syntax can be implemented 
within the dialect.

For backwards compatibility with the existing syntax, the builtin dialect is 
special-cased in the printer where the `builtin.` prefix is omitted.
---
 mlir/include/mlir/IR/BuiltinDialect.td |   2 +-
 mlir/include/mlir/IR/BuiltinTypes.td   |  25 ++-
 mlir/include/mlir/IR/OpImplementation.h|   5 +
 mlir/lib/AsmParser/DialectSymbolParser.cpp |  24 +++
 mlir/lib/AsmParser/Parser.h|  24 ++-
 mlir/lib/AsmParser/TypeParser.cpp  | 211 +
 mlir/lib/IR/AsmPrinter.cpp |  72 ++-
 mlir/lib/IR/BuiltinTypes.cpp   | 150 +++
 mlir/test/IR/invalid-builtin-types.mlir|  10 +-
 mlir/test/IR/invalid.mlir  |   4 +-
 mlir/test/IR/qualified-builtin.mlir|  11 ++
 11 files changed, 249 insertions(+), 289 deletions(-)
 create mode 100644 mlir/test/IR/qualified-builtin.mlir

diff --git a/mlir/include/mlir/IR/BuiltinDialect.td 
b/mlir/include/mlir/IR/BuiltinDialect.td
index c131107634b44..a8627170288c9 100644
--- a/mlir/include/mlir/IR/BuiltinDialect.td
+++ b/mlir/include/mlir/IR/BuiltinDialect.td
@@ -22,7 +22,7 @@ def Builtin_Dialect : Dialect {
   let name = "builtin";
   let cppNamespace = "::mlir";
   let useDefaultAttributePrinterParser = 0;
-  let useDefaultTypePrinterParser = 0;
+  let useDefaultTypePrinterParser = 1;
   let extraClassDeclaration = [{
   private:
 // Register the builtin Attributes.
diff --git a/mlir/include/mlir/IR/BuiltinTypes.td 
b/mlir/include/mlir/IR/BuiltinTypes.td
index 4cade83dd3c32..f3a51d2155040 100644
--- a/mlir/include/mlir/IR/BuiltinTypes.td
+++ b/mlir/include/mlir/IR/BuiltinTypes.td
@@ -25,7 +25,8 @@ include "mlir/IR/BuiltinTypeInterfaces.td"
 // Base class for Builtin dialect types.
 class Builtin_Type traits = [],
string baseC

[llvm-branch-commits] [lld] ReleaseNotes: add lld/ELF notes (PR #80393)

2024-02-02 Thread Peter Smith via llvm-branch-commits

https://github.com/smithp35 edited 
https://github.com/llvm/llvm-project/pull/80393
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [lld] ReleaseNotes: add lld/ELF notes (PR #80393)

2024-02-02 Thread Peter Smith via llvm-branch-commits

https://github.com/smithp35 edited 
https://github.com/llvm/llvm-project/pull/80393
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [lld] ReleaseNotes: add lld/ELF notes (PR #80393)

2024-02-02 Thread Peter Smith via llvm-branch-commits


@@ -29,8 +29,42 @@ ELF Improvements
 * ``--fat-lto-objects`` option is added to support LLVM FatLTO.
   Without ``--fat-lto-objects``, LLD will link LLVM FatLTO objects using the
   relocatable object file. (`D146778 `_)
+* ``-Bsymbolic-non-weak`` is added to directly bind non-weak definitions.
+  (`D158322 `_)
+* ``--lto-validate-all-vtables-have-type-infos``, which complements
+  ``--lto-whole-program-visibility``, is added to disable unsafe whole-program
+  devirtualization. ``--lto-known-safe-vtables=`` can be used
+  to mark known-safe vtable symbols.
+  (`D155659 `_)
+* ``--no-allow-shlib-undefined`` now reports errors for DSO referencing
+  non-exported definitions.
+  (`#70769 `_)
 * common-page-size can now be larger than the system page-size.
   (`#57618 `_)
+* When call graph profile information is availablue due to instrumentation or
+  sample PGO, input sections are now sorted using the new ``cdsort`` algorithm,
+  better than the previous ``hfsort`` algorithm.
+  (`D152840 `_)
+* Symbol assignments like ``a = DEFINED(a) ? a : 0;`` are now handled.
+  (`#65866 `_)
+* ``OVERLAY`` now supports optional start address and LMA
+  (`#77272 `_)
+* Relocations referencing a symbol defined in ``/DISCARD/`` section now lead to
+  an error.
+  (`#69295 `_)
+* For AArch64 MTE, global variable descriptors have been implemented.
+  (`D152921 `_)
+* ``R_LARCH_PCREL20_S2``/``R_LARCH_ADD6``/``R_LARCH_CALL36`` and extreme code
+  model relocations are now supported.
+* ``--emit-relocs`` is now supported for RISC-V linker relaxation.
+  (`D159082 `_)
+* Call relaxation respects RVC when mixing +c and -c relocatable files.
+  (`#73977 `_)
+* ``R_RISCV_SET_ULEB128``/``R_RISCV_SUB_ULEB128`` relocations are now 
supported.
+  (`#72610 `_)
+  (`#77261 `_)
+* RISC-V TLSDESC is now supported.
+  (`#79239 `_)
 

smithp35 wrote:

Could be worth adding
* R_AARCH64_GOTPCREL32 is now supported. (`#72584 
`_)

https://github.com/llvm/llvm-project/pull/80393
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [lld] ReleaseNotes: add lld/ELF notes (PR #80393)

2024-02-02 Thread Peter Smith via llvm-branch-commits

https://github.com/smithp35 edited 
https://github.com/llvm/llvm-project/pull/80393
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [lld] ReleaseNotes: add lld/ELF notes (PR #80393)

2024-02-02 Thread Peter Smith via llvm-branch-commits

https://github.com/smithp35 commented:

What's there LGTM too, I've suggested a couple of possible additions that you 
might want to consider.


https://github.com/llvm/llvm-project/pull/80393
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [lld] ReleaseNotes: add lld/ELF notes (PR #80393)

2024-02-02 Thread Peter Smith via llvm-branch-commits


@@ -29,8 +29,42 @@ ELF Improvements
 * ``--fat-lto-objects`` option is added to support LLVM FatLTO.
   Without ``--fat-lto-objects``, LLD will link LLVM FatLTO objects using the
   relocatable object file. (`D146778 `_)
+* ``-Bsymbolic-non-weak`` is added to directly bind non-weak definitions.
+  (`D158322 `_)
+* ``--lto-validate-all-vtables-have-type-infos``, which complements
+  ``--lto-whole-program-visibility``, is added to disable unsafe whole-program
+  devirtualization. ``--lto-known-safe-vtables=`` can be used
+  to mark known-safe vtable symbols.
+  (`D155659 `_)

smithp35 wrote:

Could be worth adding
* ``--save-temps --lto-emit-asm`` now derives ELF/asm file names from bitcode 
file names. ld.lld --save-temps a.o d/b.o -o out` will create ELF relocatable 
files `out.lto.a.o`/`d/out.lto.b.o` instead of `out1.lto.o`/`out2.lto.o`. 
(`#78835 `_)


https://github.com/llvm/llvm-project/pull/80393
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] PR for llvm/llvm-project#80296 (PR #80408)

2024-02-02 Thread Graham Hunter via llvm-branch-commits

https://github.com/huntergr-arm approved this pull request.

LGTM

https://github.com/llvm/llvm-project/pull/80408
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] PR for llvm/llvm-project#79137 (PR #79561)

2024-02-02 Thread Florian Hahn via llvm-branch-commits

https://github.com/fhahn approved this pull request.

LGTM, thanks!

Should be low risk and good to have this fixed in the release

https://github.com/llvm/llvm-project/pull/79561
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang-tools-extra] [clang] Backport '[clang] static operators should evaluate object argument (reland)' to release/18.x (PR #80109)

2024-02-02 Thread via llvm-branch-commits

https://github.com/cor3ntin approved this pull request.


https://github.com/llvm/llvm-project/pull/80109
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] PR for llvm/llvm-project#80296 (PR #80408)

2024-02-02 Thread via llvm-branch-commits

llvmbot wrote:



@llvm/pr-subscribers-llvm-transforms

@llvm/pr-subscribers-llvm-analysis

Author: None (llvmbot)


Changes

resolves llvm/llvm-project#80296

---

Patch is 197.37 KiB, truncated to 20.00 KiB below, full version: 
https://github.com/llvm/llvm-project/pull/80408.diff


3 Files Affected:

- (modified) llvm/include/llvm/Analysis/VecFuncs.def (+6-12) 
- (modified) 
llvm/test/Transforms/LoopVectorize/AArch64/veclib-function-calls.ll (+874-16) 
- (modified) llvm/test/Transforms/Util/add-TLI-mappings.ll (+25-43) 


``diff
diff --git a/llvm/include/llvm/Analysis/VecFuncs.def 
b/llvm/include/llvm/Analysis/VecFuncs.def
index f09e12f3038ca..07edf68c667a2 100644
--- a/llvm/include/llvm/Analysis/VecFuncs.def
+++ b/llvm/include/llvm/Analysis/VecFuncs.def
@@ -771,8 +771,8 @@ TLI_DEFINE_VECFUNC("log2f", "_ZGVsMxv_log2f", SCALABLE(4), 
MASKED, "_ZGVsMxv")
 TLI_DEFINE_VECFUNC("llvm.log2.f64", "_ZGVsMxv_log2", SCALABLE(2), MASKED, 
"_ZGVsMxv")
 TLI_DEFINE_VECFUNC("llvm.log2.f32", "_ZGVsMxv_log2f", SCALABLE(4), MASKED, 
"_ZGVsMxv")
 
-TLI_DEFINE_VECFUNC("modf", "_ZGVsMxvl8_modf", SCALABLE(2), MASKED, 
"_ZGVsMxvl8")
-TLI_DEFINE_VECFUNC("modff", "_ZGVsMxvl4_modff", SCALABLE(4), MASKED, 
"_ZGVsMxvl4")
+TLI_DEFINE_VECFUNC("modf", "_ZGVsNxvl8_modf", SCALABLE(2), NOMASK, 
"_ZGVsNxvl8")
+TLI_DEFINE_VECFUNC("modff", "_ZGVsNxvl4_modff", SCALABLE(4), NOMASK, 
"_ZGVsNxvl4")
 
 TLI_DEFINE_VECFUNC("nextafter", "_ZGVsMxvv_nextafter", SCALABLE(2), MASKED, 
"_ZGVsMxvv")
 TLI_DEFINE_VECFUNC("nextafterf", "_ZGVsMxvv_nextafterf", SCALABLE(4), MASKED, 
"_ZGVsMxvv")
@@ -787,11 +787,11 @@ TLI_DEFINE_VECFUNC("sinf", "_ZGVsMxv_sinf", SCALABLE(4), 
MASKED, "_ZGVsMxv")
 TLI_DEFINE_VECFUNC("llvm.sin.f64", "_ZGVsMxv_sin", SCALABLE(2), MASKED, 
"_ZGVsMxv")
 TLI_DEFINE_VECFUNC("llvm.sin.f32", "_ZGVsMxv_sinf", SCALABLE(4), MASKED, 
"_ZGVsMxv")
 
-TLI_DEFINE_VECFUNC("sincos", "_ZGVsMxvl8l8_sincos", SCALABLE(2), MASKED, 
"_ZGVsMxvl8l8")
-TLI_DEFINE_VECFUNC("sincosf", "_ZGVsMxvl4l4_sincosf", SCALABLE(4), MASKED, 
"_ZGVsMxvl4l4")
+TLI_DEFINE_VECFUNC("sincos", "_ZGVsNxvl8l8_sincos", SCALABLE(2), NOMASK, 
"_ZGVsNxvl8l8")
+TLI_DEFINE_VECFUNC("sincosf", "_ZGVsNxvl4l4_sincosf", SCALABLE(4), NOMASK, 
"_ZGVsNxvl4l4")
 
-TLI_DEFINE_VECFUNC("sincospi", "_ZGVsMxvl8l8_sincospi", SCALABLE(2), MASKED, 
"_ZGVsMxvl8l8")
-TLI_DEFINE_VECFUNC("sincospif", "_ZGVsMxvl4l4_sincospif", SCALABLE(4), MASKED, 
"_ZGVsMxvl4l4")
+TLI_DEFINE_VECFUNC("sincospi", "_ZGVsNxvl8l8_sincospi", SCALABLE(2), NOMASK, 
"_ZGVsNxvl8l8")
+TLI_DEFINE_VECFUNC("sincospif", "_ZGVsNxvl4l4_sincospif", SCALABLE(4), NOMASK, 
"_ZGVsNxvl4l4")
 
 TLI_DEFINE_VECFUNC("sinh", "_ZGVsMxv_sinh",  SCALABLE(2), MASKED, "_ZGVsMxv")
 TLI_DEFINE_VECFUNC("sinhf", "_ZGVsMxv_sinhf", SCALABLE(4), MASKED, "_ZGVsMxv")
@@ -1005,8 +1005,6 @@ TLI_DEFINE_VECFUNC("llvm.log2.f32", "armpl_svlog2_f32_x", 
SCALABLE(4), MASKED, "
 
 TLI_DEFINE_VECFUNC("modf", "armpl_vmodfq_f64", FIXED(2), NOMASK, 
"_ZGV_LLVM_N2vl8")
 TLI_DEFINE_VECFUNC("modff", "armpl_vmodfq_f32", FIXED(4), NOMASK, 
"_ZGV_LLVM_N4vl4")
-TLI_DEFINE_VECFUNC("modf", "armpl_svmodf_f64_x",  SCALABLE(2), MASKED, 
"_ZGVsMxvl8")
-TLI_DEFINE_VECFUNC("modff", "armpl_svmodf_f32_x", SCALABLE(4), MASKED, 
"_ZGVsMxvl4")
 
 TLI_DEFINE_VECFUNC("nextafter", "armpl_vnextafterq_f64", FIXED(2), NOMASK, 
"_ZGV_LLVM_N2vv")
 TLI_DEFINE_VECFUNC("nextafterf", "armpl_vnextafterq_f32", FIXED(4), NOMASK, 
"_ZGV_LLVM_N4vv")
@@ -1035,13 +1033,9 @@ TLI_DEFINE_VECFUNC("llvm.sin.f32", "armpl_svsin_f32_x", 
SCALABLE(4), MASKED, "_Z
 
 TLI_DEFINE_VECFUNC("sincos", "armpl_vsincosq_f64", FIXED(2), NOMASK, 
"_ZGV_LLVM_N2vl8l8")
 TLI_DEFINE_VECFUNC("sincosf", "armpl_vsincosq_f32", FIXED(4), NOMASK, 
"_ZGV_LLVM_N4vl4l4")
-TLI_DEFINE_VECFUNC("sincos", "armpl_svsincos_f64_x",  SCALABLE(2), MASKED, 
"_ZGVsMxvl8l8")
-TLI_DEFINE_VECFUNC("sincosf", "armpl_svsincos_f32_x", SCALABLE(4), MASKED, 
"_ZGVsMxvl4l4")
 
 TLI_DEFINE_VECFUNC("sincospi", "armpl_vsincospiq_f64", FIXED(2), NOMASK, 
"_ZGV_LLVM_N2vl8l8")
 TLI_DEFINE_VECFUNC("sincospif", "armpl_vsincospiq_f32", FIXED(4), NOMASK, 
"_ZGV_LLVM_N4vl4l4")
-TLI_DEFINE_VECFUNC("sincospi", "armpl_svsincospi_f64_x", SCALABLE(2), MASKED, 
"_ZGVsMxvl8l8")
-TLI_DEFINE_VECFUNC("sincospif", "armpl_svsincospi_f32_x", SCALABLE(4), MASKED, 
"_ZGVsMxvl4l4")
 
 TLI_DEFINE_VECFUNC("sinh", "armpl_vsinhq_f64", FIXED(2), NOMASK, 
"_ZGV_LLVM_N2v")
 TLI_DEFINE_VECFUNC("sinhf", "armpl_vsinhq_f32", FIXED(4), NOMASK, 
"_ZGV_LLVM_N4v")
diff --git 
a/llvm/test/Transforms/LoopVectorize/AArch64/veclib-function-calls.ll 
b/llvm/test/Transforms/LoopVectorize/AArch64/veclib-function-calls.ll
index d07f72792e6b9..dd1495626eb98 100644
--- a/llvm/test/Transforms/LoopVectorize/AArch64/veclib-function-calls.ll
+++ b/llvm/test/Transforms/LoopVectorize/AArch64/veclib-function-calls.ll
@@ -1,8 +1,12 @@
 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py 
UTC_ARGS: --filter 
"call.*(cos|sin|tan|cbrt|erf|exp[^e]|gamma|log|sqrt|copysign|dim|min|mod|hypot|nextafter|pow

[llvm-branch-commits] [llvm] PR for llvm/llvm-project#80296 (PR #80408)

2024-02-02 Thread via llvm-branch-commits

llvmbot wrote:

@huntergr-arm What do you think about merging this PR to the release branch?

https://github.com/llvm/llvm-project/pull/80408
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] PR for llvm/llvm-project#80296 (PR #80408)

2024-02-02 Thread via llvm-branch-commits

https://github.com/llvmbot milestoned 
https://github.com/llvm/llvm-project/pull/80408
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits