[llvm-branch-commits] [clang] [Serialization] Code cleanups and polish 83233 (PR #83237)

2024-04-05 Thread Ilya Biryukov via llvm-branch-commits

ilya-biryukov wrote:

Sorry for the delay, I had an emergency and took a week off.
We have hit some form of OOM (an infinite loop or some exponential computation 
allocating memory?)  on the following small example (ready as a test case, also 
in [this 
commit](https://github.com/ilya-biryukov/llvm-project/commit/6e2f55a1d1fa90b325ca2891c2a101bc79a32b9d)):

```cpp
// RUN: rm -rf %t
// RUN: mkdir -p %t
// RUN: split-file %s %t
//
// RUN: %clang_cc1 -std=c++20 %t/type_traits.cppm -emit-module-interface -o 
%t/type_traits.pcm
// RUN: %clang_cc1 -std=c++20 %t/test.cpp -fprebuilt-module-path=%t -verify

//--- type_traits.cppm
export module type_traits;

export template 
constexpr bool is_pod_v = __is_pod(T);

//--- test.cpp
import type_traits;
// Base is either void or wrapper.
template  struct wrapper : Base {};
template <> struct wrapper {};

// wrap<0>::type is wrapper, wrap<1>::type is wrapper>,
// and so on.
template 
struct wrap {
  template 
  using type = wrapper::template type>;
};

template <>
struct wrap<0> {
  template 
  using type = wrapper;
};

inline constexpr int kMaxRank = 40;
template 
using rank = typename wrap::template type;
using rank_selector_t = rank<40>;

static_assert(is_pod_v, "Must be POD");
```

There might be more problems as this one has been caught early and blocked 
further progress.

https://github.com/llvm/llvm-project/pull/83237
___
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] [RISCV] Use larger copies when register tuples are aligned (PR #84455)

2024-04-05 Thread Luke Lau via llvm-branch-commits

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


https://github.com/llvm/llvm-project/pull/84455
___
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] c68fcbf - Revert "[mlir][SCF] `ValueBoundsConstraintSet`: Support `scf.if` (branches) (…"

2024-04-05 Thread via llvm-branch-commits

Author: Anton Korobeynikov
Date: 2024-04-05T02:25:30-07:00
New Revision: c68fcbf785119789ac3354f1d0efa5de0b71ae41

URL: 
https://github.com/llvm/llvm-project/commit/c68fcbf785119789ac3354f1d0efa5de0b71ae41
DIFF: 
https://github.com/llvm/llvm-project/commit/c68fcbf785119789ac3354f1d0efa5de0b71ae41.diff

LOG: Revert "[mlir][SCF] `ValueBoundsConstraintSet`: Support `scf.if` 
(branches) (…"

This reverts commit 6b30ffef28c35c24bfd8190e06eeaa0c5cd73cbd.

Added: 


Modified: 
mlir/include/mlir/Interfaces/ValueBoundsOpInterface.h
mlir/lib/Dialect/SCF/IR/ValueBoundsOpInterfaceImpl.cpp
mlir/lib/Dialect/Vector/IR/ScalableValueBoundsConstraintSet.cpp
mlir/lib/Interfaces/ValueBoundsOpInterface.cpp
mlir/test/Dialect/SCF/value-bounds-op-interface-impl.mlir

Removed: 




diff  --git a/mlir/include/mlir/Interfaces/ValueBoundsOpInterface.h 
b/mlir/include/mlir/Interfaces/ValueBoundsOpInterface.h
index 3543ab52407a36..83107a3f5f9418 100644
--- a/mlir/include/mlir/Interfaces/ValueBoundsOpInterface.h
+++ b/mlir/include/mlir/Interfaces/ValueBoundsOpInterface.h
@@ -203,26 +203,6 @@ class ValueBoundsConstraintSet
std::optional dim1 = std::nullopt,
std::optional dim2 = std::nullopt);
 
-  /// Traverse the IR starting from the given value/dim and populate 
constraints
-  /// as long as the stop condition holds. Also process all values/dims that 
are
-  /// already on the worklist.
-  void populateConstraints(Value value, std::optional dim);
-
-  /// Comparison operator for `ValueBoundsConstraintSet::compare`.
-  enum ComparisonOperator { LT, LE, EQ, GT, GE };
-
-  /// Try to prove that, based on the current state of this constraint set
-  /// (i.e., without analyzing additional IR or adding new constraints), the
-  /// "lhs" value/dim is LE/LT/EQ/GT/GE than the "rhs" value/dim.
-  ///
-  /// Return "true" if the specified relation between the two values/dims was
-  /// proven to hold. Return "false" if the specified relation could not be
-  /// proven. This could be because the specified relation does in fact not 
hold
-  /// or because there is not enough information in the constraint set. In 
other
-  /// words, if we do not know for sure, this function returns "false".
-  bool compare(Value lhs, std::optional lhsDim, ComparisonOperator 
cmp,
-   Value rhs, std::optional rhsDim);
-
   /// Compute whether the given values/dimensions are equal. Return "failure" 
if
   /// equality could not be determined.
   ///
@@ -294,13 +274,13 @@ class ValueBoundsConstraintSet
 
   ValueBoundsConstraintSet(MLIRContext *ctx, StopConditionFn stopCondition);
 
-  /// Given an affine map with a single result (and map operands), add a new
-  /// column to the constraint set that represents the result of the map.
-  /// Traverse additional IR starting from the map operands as needed (as long
-  /// as the stop condition is not satisfied). Also process all values/dims 
that
-  /// are already on the worklist. Return the position of the newly added
-  /// column.
-  int64_t populateConstraints(AffineMap map, ValueDimList mapOperands);
+  /// Populates the constraint set for a value/map without actually computing
+  /// the bound. Returns the position for the value/map (via the return value
+  /// and `posOut` output parameter).
+  int64_t populateConstraintsSet(Value value,
+ std::optional dim = std::nullopt);
+  int64_t populateConstraintsSet(AffineMap map, ValueDimList mapOperands,
+ int64_t *posOut = nullptr);
 
   /// Iteratively process all elements on the worklist until an index-typed
   /// value or shaped value meets `stopCondition`. Such values are not 
processed
@@ -315,19 +295,14 @@ class ValueBoundsConstraintSet
   /// value/dimension exists in the constraint set.
   int64_t getPos(Value value, std::optional dim = std::nullopt) const;
 
-  /// Return an affine expression that represents column `pos` in the 
constraint
-  /// set.
-  AffineExpr getPosExpr(int64_t pos);
-
   /// Insert a value/dimension into the constraint set. If `isSymbol` is set to
   /// "false", a dimension is added. The value/dimension is added to the
-  /// worklist if `addToWorklist` is set.
+  /// worklist.
   ///
   /// Note: There are certain affine restrictions wrt. dimensions. E.g., they
   /// cannot be multiplied. Furthermore, bounds can only be queried for
   /// dimensions but not for symbols.
-  int64_t insert(Value value, std::optional dim, bool isSymbol = true,
- bool addToWorklist = true);
+  int64_t insert(Value value, std::optional dim, bool isSymbol = 
true);
 
   /// Insert an anonymous column into the constraint set. The column is not
   /// bound to any value/dimension. If `isSymbol` is set to "false", a 
dimension

diff  --git a/mlir/lib/Dialect/SCF/IR/ValueBoundsOpInterfaceImpl.cpp 
b/mlir/lib/Dialect

[llvm-branch-commits] [llvm][RISCV] Enable trailing fences for seq-cst stores by default (PR #87376)

2024-04-05 Thread Alex Bradbury via llvm-branch-commits

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

LGTM, thanks.

https://github.com/llvm/llvm-project/pull/87376
___
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] release/18.x: [Headers] Don't declare unreachable() from stddef.h in C++ (#86748) (PR #87696)

2024-04-05 Thread Aaron Ballman via llvm-branch-commits

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

LGTM for backporting

https://github.com/llvm/llvm-project/pull/87696
___
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] [BOLT] Cover all call sites in writeBATYAML (PR #87743)

2024-04-05 Thread Amir Ayupov via llvm-branch-commits

https://github.com/aaupov updated 
https://github.com/llvm/llvm-project/pull/87743

>From 251020f10d1e6a7a888164748f78acc6994e0ab3 Mon Sep 17 00:00:00 2001
From: Amir Ayupov 
Date: Fri, 5 Apr 2024 07:36:40 -0700
Subject: [PATCH] Remove stats logging

Created using spr 1.3.4
---
 bolt/lib/Profile/DataAggregator.cpp | 13 -
 1 file changed, 13 deletions(-)

diff --git a/bolt/lib/Profile/DataAggregator.cpp 
b/bolt/lib/Profile/DataAggregator.cpp
index 119d082c50c18c..1d0737167c808e 100644
--- a/bolt/lib/Profile/DataAggregator.cpp
+++ b/bolt/lib/Profile/DataAggregator.cpp
@@ -2395,19 +2395,6 @@ std::error_code 
DataAggregator::writeBATYAML(BinaryContext &BC,
 !YamlBB.CallSites.empty())
   YamlBF.Blocks.emplace_back(YamlBB);
   }
-
-  for (const auto &[BranchOffset, _] : Branches.InterIndex) {
-bool Matched =
-llvm::any_of(llvm::make_second_range(BFBranches),
- [&](const std::vector &BranchOffsets) {
-   return llvm::is_contained(BranchOffsets,
- BranchOffset);
- });
-if (!Matched && opts::Verbosity >= 1)
-  errs() << "BOLT-WARNING: Couldn't match call site "
- << formatv("{0}@{1:x} to YAML profile\n", FuncName,
-BranchOffset);
-  }
   BP.Functions.emplace_back(YamlBF);
 }
   }

___
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] [BOLT][BAT] Fix handling of split functions (PR #87569)

2024-04-05 Thread Amir Ayupov via llvm-branch-commits

https://github.com/aaupov updated 
https://github.com/llvm/llvm-project/pull/87569

>From a3b0326428924a9565c673ffc6bc899ee788a19b Mon Sep 17 00:00:00 2001
From: Amir Ayupov 
Date: Fri, 5 Apr 2024 07:40:41 -0700
Subject: [PATCH] Move comment to NumColdSamples

Created using spr 1.3.4
---
 bolt/include/bolt/Profile/DataAggregator.h | 4 
 1 file changed, 4 insertions(+)

diff --git a/bolt/include/bolt/Profile/DataAggregator.h 
b/bolt/include/bolt/Profile/DataAggregator.h
index 659a8488d1534c..3b8624585c19bd 100644
--- a/bolt/include/bolt/Profile/DataAggregator.h
+++ b/bolt/include/bolt/Profile/DataAggregator.h
@@ -225,6 +225,10 @@ class DataAggregator : public DataReader {
   /// Aggregation statistics
   uint64_t NumInvalidTraces{0};
   uint64_t NumLongRangeTraces{0};
+  /// Specifies how many samples were recorded in cold areas if we are dealing
+  /// with profiling data collected in a bolted binary. For LBRs, incremented
+  /// for the source of the branch to avoid counting cold activity twice (one
+  /// for source and another for destination).
   uint64_t NumColdSamples{0};
 
   /// Looks into system PATH for Linux Perf and set up the aggregator to use it

___
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] [BOLT][BAT] Fix handling of split functions (PR #87569)

2024-04-05 Thread Amir Ayupov via llvm-branch-commits

https://github.com/aaupov edited https://github.com/llvm/llvm-project/pull/87569
___
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][IR] Extend BranchWeightMetadata to track provenance of weights (PR #86609)

2024-04-05 Thread David Li via llvm-branch-commits


@@ -1210,12 +1210,22 @@ Instruction *Instruction::cloneImpl() const {
 
 void Instruction::swapProfMetadata() {
   MDNode *ProfileData = getBranchWeightMDNode(*this);
-  if (!ProfileData || ProfileData->getNumOperands() != 3)
+  if (!isBranchWeightMD(ProfileData))

david-xl wrote:

Extract this and other similar refactoring change into a different patch?

https://github.com/llvm/llvm-project/pull/86609
___
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][IR] Extend BranchWeightMetadata to track provenance of weights (PR #86609)

2024-04-05 Thread Paul Kirth via llvm-branch-commits


@@ -1210,12 +1210,22 @@ Instruction *Instruction::cloneImpl() const {
 
 void Instruction::swapProfMetadata() {
   MDNode *ProfileData = getBranchWeightMDNode(*this);
-  if (!ProfileData || ProfileData->getNumOperands() != 3)
+  if (!isBranchWeightMD(ProfileData))

ilovepi wrote:

Oh, that's a good point. In my head these were all tied together w/ the change 
to the metadata layout, but maybe I can restructure ProfdataUtils first, and 
then update the surrounding code, and after that's done introduce the metadata 
changes. Thanks for the suggestion. I'll take a pass at that soon.

https://github.com/llvm/llvm-project/pull/86609
___
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] release/18.x: [libcxx] coerce formatter precision to int (#87738) (PR #87801)

2024-04-05 Thread via llvm-branch-commits

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

Backport e1830f586ac4c504f632bdb69aab49234256e899

Requested by: @androm3da

>From 0b39e23a5a34957fa31a3180dcaf18df0bec9e95 Mon Sep 17 00:00:00 2001
From: Brian Cain 
Date: Fri, 5 Apr 2024 11:06:37 -0500
Subject: [PATCH] [libcxx] coerce formatter precision to int (#87738)

__precision_ is declared as an int32_t which on some hexagon platforms
is defined as a long.

This change fixes errors like the ones below:

In file included from
/local/mnt/workspace/hex/llvm-project/libcxx/test/libcxx/diagnostics/format.nodiscard_extensions.compile.pass.cpp:19:
In file included from
/local/mnt/workspace/hex/obj_runtimes_hex88_qurt_v75_ON_ON_shared/include/c++/v1/format:202:
In file included from
/local/mnt/workspace/hex/obj_runtimes_hex88_qurt_v75_ON_ON_shared/include/c++/v1/__format/format_functions.h:29:

/local/mnt/workspace/hex/obj_runtimes_hex88_qurt_v75_ON_ON_shared/include/c++/v1/__format/formatter_floating_point.h:700:17:
error: no matching function for call to 'max'
700 | int __p = std::max(1, (__specs.__has_precision() ?
__specs.__precision_ : 6));
  | ^~~~

/local/mnt/workspace/hex/obj_runtimes_hex88_qurt_v75_ON_ON_shared/include/c++/v1/__format/formatter_floating_point.h:771:25:
note: in instantiation of function template specialization
'std::__formatter::__format_floating_point' requested here
771 | return __formatter::__format_floating_point(__value, __ctx,
__parser_.__get_parsed_std_specifications(__ctx));
  | ^

/local/mnt/workspace/hex/obj_runtimes_hex88_qurt_v75_ON_ON_shared/include/c++/v1/__format/format_functions.h:284:42:
note: in instantiation of function template specialization
'std::__formatter_floating_point::format' requested here
284 | __ctx.advance_to(__formatter.format(__arg, __ctx));
  |  ^

/local/mnt/workspace/hex/obj_runtimes_hex88_qurt_v75_ON_ON_shared/include/c++/v1/__format/format_functions.h:429:15:
note: in instantiation of function template specialization
'std::__vformat_to, char,
std::back_insert_iterator>>'
requested here
429 | return std::__vformat_to(std::move(__out_it), __fmt, __args);
  |   ^

/local/mnt/workspace/hex/obj_runtimes_hex88_qurt_v75_ON_ON_shared/include/c++/v1/__format/format_functions.h:462:8:
note: in instantiation of function template specialization
'std::vformat_to>' requested here
  462 |   std::vformat_to(std::back_inserter(__res), __fmt, __args);
  |^

/local/mnt/workspace/hex/llvm-project/libcxx/test/libcxx/diagnostics/format.nodiscard_extensions.compile.pass.cpp:29:8:
note: in instantiation of function template specialization
'std::vformat' requested here
   29 |   std::vformat("", std::make_format_args());
  |^

/local/mnt/workspace/hex/obj_runtimes_hex88_qurt_v75_ON_ON_shared/include/c++/v1/__algorithm/max.h:35:1:
note: candidate template ignored: deduced conflicting types for
parameter '_Tp' ('int' vs. 'int32_t' (aka 'long'))
35 | max(_LIBCPP_LIFETIMEBOUND const _Tp& __a, _LIBCPP_LIFETIMEBOUND
const _Tp& __b) {
  | ^

/local/mnt/workspace/hex/obj_runtimes_hex88_qurt_v75_ON_ON_shared/include/c++/v1/__algorithm/max.h:43:1:
note: candidate template ignored: could not match
'initializer_list<_Tp>' against 'int'
   43 | max(initializer_list<_Tp> __t, _Compare __comp) {
  | ^

/local/mnt/workspace/hex/obj_runtimes_hex88_qurt_v75_ON_ON_shared/include/c++/v1/__algorithm/max.h:48:86:
note: candidate function template not viable: requires single argument
'__t', but 2 arguments were provided
48 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI
_LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp max(initializer_list<_Tp> __t) {
| ^ ~

/local/mnt/workspace/hex/obj_runtimes_hex88_qurt_v75_ON_ON_shared/include/c++/v1/__algorithm/max.h:29:1:
note: candidate function template not viable: requires 3 arguments, but
2 were provided
29 | max(_LIBCPP_LIFETIMEBOUND const _Tp& __a, _LIBCPP_LIFETIMEBOUND
const _Tp& __b, _Compare __comp) {
| ^
~

(cherry picked from commit e1830f586ac4c504f632bdb69aab49234256e899)
---
 libcxx/include/__format/formatter_floating_point.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libcxx/include/__format/formatter_floating_point.h 
b/libcxx/include/__format/formatter_floating_point.h
index 6802a8b7bd4ca3..46a090a787ae28 100644
--- a/libcxx/include/__format/formatter_floating_point.h
+++ b/libcxx/include/__format/formatter_floating_point.h
@@ -689,7 +689,7 @@ __format_floating_point(_Tp __value, _FormatContext& __ctx, 
__format_spec::__par
   // Let P equal the precision if nonzero, 6 if the precision is not
   // specified, or 1 if the precision is 0. Then, if a conversion with
   // style E would have an exponent of X:
-  int __p = std::max(1, (__specs.__has_p

[llvm-branch-commits] [libcxx] release/18.x: [libcxx] coerce formatter precision to int (#87738) (PR #87801)

2024-04-05 Thread via llvm-branch-commits

https://github.com/llvmbot milestoned 
https://github.com/llvm/llvm-project/pull/87801
___
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] release/18.x: [libcxx] coerce formatter precision to int (#87738) (PR #87801)

2024-04-05 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/87801
___
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] release/18.x: [libcxx] coerce formatter precision to int (#87738) (PR #87801)

2024-04-05 Thread via llvm-branch-commits

llvmbot wrote:




@llvm/pr-subscribers-libcxx

Author: None (llvmbot)


Changes

Backport e1830f586ac4c504f632bdb69aab49234256e899

Requested by: @androm3da

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


1 Files Affected:

- (modified) libcxx/include/__format/formatter_floating_point.h (+1-1) 


``diff
diff --git a/libcxx/include/__format/formatter_floating_point.h 
b/libcxx/include/__format/formatter_floating_point.h
index 6802a8b7bd4ca3..46a090a787ae28 100644
--- a/libcxx/include/__format/formatter_floating_point.h
+++ b/libcxx/include/__format/formatter_floating_point.h
@@ -689,7 +689,7 @@ __format_floating_point(_Tp __value, _FormatContext& __ctx, 
__format_spec::__par
   // Let P equal the precision if nonzero, 6 if the precision is not
   // specified, or 1 if the precision is 0. Then, if a conversion with
   // style E would have an exponent of X:
-  int __p = std::max(1, (__specs.__has_precision() ? __specs.__precision_ 
: 6));
+  int __p = std::max(1, (__specs.__has_precision() ? 
__specs.__precision_ : 6));
   if (__result.__exponent == __result.__last)
 // if P > X >= -4, the conversion is with style f or F and precision P 
- 1 - X.
 // By including the radix point it calculates P - (1 + X)

``




https://github.com/llvm/llvm-project/pull/87801
___
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] [BOLT][NFC] Const-ify DataAggregator::getLocationName (PR #76908)

2024-04-05 Thread Amir Ayupov via llvm-branch-commits

https://github.com/aaupov closed https://github.com/llvm/llvm-project/pull/76908
___
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] [BOLT][NFC] Const-ify DataAggregator::getLocationName (PR #76908)

2024-04-05 Thread Amir Ayupov via llvm-branch-commits

aaupov wrote:

Rolled into https://github.com/llvm/llvm-project/pull/87569

https://github.com/llvm/llvm-project/pull/76908
___
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] release/18.x: [libcxx] coerce formatter precision to int (#87738) (PR #87801)

2024-04-05 Thread Mark de Wever via llvm-branch-commits

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


https://github.com/llvm/llvm-project/pull/87801
___
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] [RISCV] Use the thread local stack protector for Android targets (PR #87672)

2024-04-05 Thread Paul Kirth via llvm-branch-commits

ilovepi wrote:

> > s/master/main/ in the url to get the current version. (master "works" but 
> > it's frozen in time; main will track future changes.)
> > otherwise lgtm...
> 
> Probably someone should update AArch64 which has the same comment?

Done in #87726

https://github.com/llvm/llvm-project/pull/87672
___
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] [RISCV] Use the thread local stack protector for Android targets (PR #87672)

2024-04-05 Thread Paul Kirth via llvm-branch-commits

https://github.com/ilovepi edited 
https://github.com/llvm/llvm-project/pull/87672
___
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] [RISCV] Use the thread local stack protector for Android targets (PR #87672)

2024-04-05 Thread Paul Kirth via llvm-branch-commits

https://github.com/ilovepi updated 
https://github.com/llvm/llvm-project/pull/87672


___
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] [RISCV] Use the thread local stack protector for Android targets (PR #87672)

2024-04-05 Thread Paul Kirth via llvm-branch-commits

https://github.com/ilovepi updated 
https://github.com/llvm/llvm-project/pull/87672


___
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] [GlobalISel] Handle more commutable instructions in `commute_constant_to_rhs` (PR #87424)

2024-04-05 Thread via llvm-branch-commits

https://github.com/darkbuck updated 
https://github.com/llvm/llvm-project/pull/87424


___
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] [GlobalISel] Handle more commutable instructions in `commute_constant_to_rhs` (PR #87424)

2024-04-05 Thread via llvm-branch-commits

https://github.com/darkbuck updated 
https://github.com/llvm/llvm-project/pull/87424


___
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] [GlobalISel] Handle more commutable instructions in `commute_constant_to_rhs` (PR #87424)

2024-04-05 Thread via llvm-branch-commits

https://github.com/darkbuck edited 
https://github.com/llvm/llvm-project/pull/87424
___
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] [polly] release/18.x: [clang-format] Correctly annotate braces of empty ctors/dtors (#82097) (PR #87735)

2024-04-05 Thread Björn Schäpers via llvm-branch-commits

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


https://github.com/llvm/llvm-project/pull/87735
___
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][CallGraphSection] Add type id metadata to indirect call and targets (PR #87573)

2024-04-05 Thread Eli Friedman via llvm-branch-commits


@@ -93,9 +93,17 @@ RValue CodeGenFunction::EmitCXXMemberOrOperatorCall(
   *this, MD, This, ImplicitParam, ImplicitParamTy, CE, Args, RtlArgs);
   auto &FnInfo = CGM.getTypes().arrangeCXXMethodCall(
   Args, FPT, CallInfo.ReqArgs, CallInfo.PrefixSize);
-  return EmitCall(FnInfo, Callee, ReturnValue, Args, nullptr,
+  llvm::CallBase *CallOrInvoke = nullptr;
+  auto Call = EmitCall(FnInfo, Callee, ReturnValue, Args, &CallOrInvoke,
   CE && CE == MustTailCall,
   CE ? CE->getExprLoc() : SourceLocation());
+  
+  // Set type identifier metadata of indirect calls for call graph section.
+  if (CGM.getCodeGenOpts().CallGraphSection && CallOrInvoke &&
+  CallOrInvoke->isIndirectCall())
+CGM.CreateFunctionTypeMetadataForIcall(MD->getType(), CallOrInvoke);

efriedma-quic wrote:

This seems like it's scattering calls to CreateFunctionTypeMetadataForIcall 
across a lot of different places; code like this is hard to maintain.  Is there 
some reason we can't just do it in EmitCall() itself, or something like that?

https://github.com/llvm/llvm-project/pull/87573
___
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] [BOLT][BAT] Fix encoded NumBasicBlocks (PR #87830)

2024-04-05 Thread Amir Ayupov via llvm-branch-commits

https://github.com/aaupov created 
https://github.com/llvm/llvm-project/pull/87830

Emit the recorded number of blocks, not the number of basic block
hashes. There might be differences in corner cases (openssl
BN_BLINDING_convert_ex function).

Test Plan:
Updated openssl.test in https://github.com/rafaelauler/bolt-tests/pull/31



___
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] [BOLT] Cover all call sites in writeBATYAML (PR #87743)

2024-04-05 Thread Amir Ayupov via llvm-branch-commits

https://github.com/aaupov updated 
https://github.com/llvm/llvm-project/pull/87743

>From 251020f10d1e6a7a888164748f78acc6994e0ab3 Mon Sep 17 00:00:00 2001
From: Amir Ayupov 
Date: Fri, 5 Apr 2024 07:36:40 -0700
Subject: [PATCH] Remove stats logging

Created using spr 1.3.4
---
 bolt/lib/Profile/DataAggregator.cpp | 13 -
 1 file changed, 13 deletions(-)

diff --git a/bolt/lib/Profile/DataAggregator.cpp 
b/bolt/lib/Profile/DataAggregator.cpp
index 119d082c50c18c..1d0737167c808e 100644
--- a/bolt/lib/Profile/DataAggregator.cpp
+++ b/bolt/lib/Profile/DataAggregator.cpp
@@ -2395,19 +2395,6 @@ std::error_code 
DataAggregator::writeBATYAML(BinaryContext &BC,
 !YamlBB.CallSites.empty())
   YamlBF.Blocks.emplace_back(YamlBB);
   }
-
-  for (const auto &[BranchOffset, _] : Branches.InterIndex) {
-bool Matched =
-llvm::any_of(llvm::make_second_range(BFBranches),
- [&](const std::vector &BranchOffsets) {
-   return llvm::is_contained(BranchOffsets,
- BranchOffset);
- });
-if (!Matched && opts::Verbosity >= 1)
-  errs() << "BOLT-WARNING: Couldn't match call site "
- << formatv("{0}@{1:x} to YAML profile\n", FuncName,
-BranchOffset);
-  }
   BP.Functions.emplace_back(YamlBF);
 }
   }

___
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] [BOLT] Cover all call sites in writeBATYAML (PR #87743)

2024-04-05 Thread Amir Ayupov via llvm-branch-commits

https://github.com/aaupov updated 
https://github.com/llvm/llvm-project/pull/87743

>From 251020f10d1e6a7a888164748f78acc6994e0ab3 Mon Sep 17 00:00:00 2001
From: Amir Ayupov 
Date: Fri, 5 Apr 2024 07:36:40 -0700
Subject: [PATCH] Remove stats logging

Created using spr 1.3.4
---
 bolt/lib/Profile/DataAggregator.cpp | 13 -
 1 file changed, 13 deletions(-)

diff --git a/bolt/lib/Profile/DataAggregator.cpp 
b/bolt/lib/Profile/DataAggregator.cpp
index 119d082c50c18c..1d0737167c808e 100644
--- a/bolt/lib/Profile/DataAggregator.cpp
+++ b/bolt/lib/Profile/DataAggregator.cpp
@@ -2395,19 +2395,6 @@ std::error_code 
DataAggregator::writeBATYAML(BinaryContext &BC,
 !YamlBB.CallSites.empty())
   YamlBF.Blocks.emplace_back(YamlBB);
   }
-
-  for (const auto &[BranchOffset, _] : Branches.InterIndex) {
-bool Matched =
-llvm::any_of(llvm::make_second_range(BFBranches),
- [&](const std::vector &BranchOffsets) {
-   return llvm::is_contained(BranchOffsets,
- BranchOffset);
- });
-if (!Matched && opts::Verbosity >= 1)
-  errs() << "BOLT-WARNING: Couldn't match call site "
- << formatv("{0}@{1:x} to YAML profile\n", FuncName,
-BranchOffset);
-  }
   BP.Functions.emplace_back(YamlBF);
 }
   }

___
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] [BOLT] Use BAT for YAML profile call target information (PR #86219)

2024-04-05 Thread Amir Ayupov via llvm-branch-commits

https://github.com/aaupov updated 
https://github.com/llvm/llvm-project/pull/86219

>From 685d3f5fa6ae75d6c3e22873a52ea8347e170c1e Mon Sep 17 00:00:00 2001
From: Amir Ayupov 
Date: Thu, 28 Mar 2024 10:16:15 -0700
Subject: [PATCH 1/6] Get rid of std::map::at

Created using spr 1.3.4
---
 bolt/lib/Profile/BoltAddressTranslation.cpp | 5 -
 bolt/lib/Profile/YAMLProfileWriter.cpp  | 3 ++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/bolt/lib/Profile/BoltAddressTranslation.cpp 
b/bolt/lib/Profile/BoltAddressTranslation.cpp
index 6d3f83efbe5f5a..7c54ba1971cbac 100644
--- a/bolt/lib/Profile/BoltAddressTranslation.cpp
+++ b/bolt/lib/Profile/BoltAddressTranslation.cpp
@@ -600,7 +600,10 @@ BoltAddressTranslation::getBFBranches(uint64_t 
OutputAddress) const {
 unsigned
 BoltAddressTranslation::getSecondaryEntryPointId(uint64_t Address,
  uint32_t Offset) const {
-  const std::vector &Offsets = SecondaryEntryPointsMap.at(Address);
+  auto FunctionIt = SecondaryEntryPointsMap.find(Address);
+  if (FunctionIt == SecondaryEntryPointsMap.end())
+return UINT_MAX;
+  const std::vector &Offsets = FunctionIt->second;
   auto OffsetIt = std::find(Offsets.begin(), Offsets.end(), Offset);
   if (OffsetIt == Offsets.end())
 return UINT_MAX;
diff --git a/bolt/lib/Profile/YAMLProfileWriter.cpp 
b/bolt/lib/Profile/YAMLProfileWriter.cpp
index 78fb1e8539d477..bacee136de3f87 100644
--- a/bolt/lib/Profile/YAMLProfileWriter.cpp
+++ b/bolt/lib/Profile/YAMLProfileWriter.cpp
@@ -48,7 +48,8 @@ setCSIDestination(const BinaryContext &BC, 
yaml::bolt::CallSiteInfo &CSI,
 if (SymbolValue.getError())
   return Callee;
 if (uint32_t Offset = SymbolValue.get() - Callee->getAddress())
-  EntryID = (*GetBATSecondaryEntryPointId)(Callee->getAddress(), Offset);
+  EntryID =
+  (*GetBATSecondaryEntryPointId)(Callee->getAddress(), Offset) + 1;
   } else {
 BC.getFunctionForSymbol(Symbol, &EntryID);
   }

>From 03520283ff38a47bc44cfa395534837d8da66934 Mon Sep 17 00:00:00 2001
From: Amir Ayupov 
Date: Thu, 28 Mar 2024 22:37:24 -0700
Subject: [PATCH 2/6] Fixed setting of BAT secondary entry point, updated test

Created using spr 1.3.4
---
 bolt/include/bolt/Profile/YAMLProfileWriter.h | 11 +--
 bolt/lib/Profile/DataAggregator.cpp   | 11 +--
 bolt/lib/Profile/YAMLProfileWriter.cpp| 71 ---
 .../X86/yaml-secondary-entry-discriminator.s  | 52 +-
 4 files changed, 97 insertions(+), 48 deletions(-)

diff --git a/bolt/include/bolt/Profile/YAMLProfileWriter.h 
b/bolt/include/bolt/Profile/YAMLProfileWriter.h
index 7db581652a5b73..0db2e3fd90f9f1 100644
--- a/bolt/include/bolt/Profile/YAMLProfileWriter.h
+++ b/bolt/include/bolt/Profile/YAMLProfileWriter.h
@@ -15,6 +15,7 @@
 
 namespace llvm {
 namespace bolt {
+class BoltAddressTranslation;
 class RewriteInstance;
 
 class YAMLProfileWriter {
@@ -31,17 +32,9 @@ class YAMLProfileWriter {
   /// Save execution profile for that instance.
   std::error_code writeProfile(const RewriteInstance &RI);
 
-  /// Callback to determine if a function is covered by BAT.
-  using IsBATCallbackTy = std::optional>;
-  /// Callback to get secondary entry point id for a given function and offset.
-  using GetBATSecondaryEntryPointIdCallbackTy =
-  std::optional>;
-
   static yaml::bolt::BinaryFunctionProfile
   convert(const BinaryFunction &BF, bool UseDFS,
-  IsBATCallbackTy IsBATFunction = std::nullopt,
-  GetBATSecondaryEntryPointIdCallbackTy GetBATSecondaryEntryPointId =
-  std::nullopt);
+  const BoltAddressTranslation *BAT = nullptr);
 };
 
 } // namespace bolt
diff --git a/bolt/lib/Profile/DataAggregator.cpp 
b/bolt/lib/Profile/DataAggregator.cpp
index 5b5ce5532ffdb9..71824e2cc0e97a 100644
--- a/bolt/lib/Profile/DataAggregator.cpp
+++ b/bolt/lib/Profile/DataAggregator.cpp
@@ -2324,13 +2324,6 @@ std::error_code 
DataAggregator::writeBATYAML(BinaryContext &BC,
   BP.Header.Flags = opts::BasicAggregation ? BinaryFunction::PF_SAMPLE
: BinaryFunction::PF_LBR;
 
-  auto IsBATFunction = [&](uint64_t Address) {
-return BAT->isBATFunction(Address);
-  };
-  auto GetSecondaryEntryPointId = [&](uint64_t Address, uint32_t Offset) {
-return BAT->getSecondaryEntryPointId(Address, Offset);
-  };
-
   if (!opts::BasicAggregation) {
 // Convert profile for functions not covered by BAT
 for (auto &BFI : BC.getBinaryFunctions()) {
@@ -2339,8 +2332,8 @@ std::error_code 
DataAggregator::writeBATYAML(BinaryContext &BC,
 continue;
   if (BAT->isBATFunction(Function.getAddress()))
 continue;
-  BP.Functions.emplace_back(YAMLProfileWriter::convert(
-  Function, /*UseDFS=*/false, IsBATFunction, 
GetSecondaryEntryPointId));
+  BP.Functions.emplace_back(
+  YAMLProfileWriter::convert(Function, /*UseDFS=*/false, BAT));
 }
 
 for (const auto &KV : Names

[llvm-branch-commits] [llvm] [BOLT] Use BAT for YAML profile call target information (PR #86219)

2024-04-05 Thread Amir Ayupov via llvm-branch-commits

https://github.com/aaupov edited https://github.com/llvm/llvm-project/pull/86219
___
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] [BOLT] Use BAT for YAML profile call target information (PR #86219)

2024-04-05 Thread Amir Ayupov via llvm-branch-commits

https://github.com/aaupov updated 
https://github.com/llvm/llvm-project/pull/86219

>From 685d3f5fa6ae75d6c3e22873a52ea8347e170c1e Mon Sep 17 00:00:00 2001
From: Amir Ayupov 
Date: Thu, 28 Mar 2024 10:16:15 -0700
Subject: [PATCH 1/7] Get rid of std::map::at

Created using spr 1.3.4
---
 bolt/lib/Profile/BoltAddressTranslation.cpp | 5 -
 bolt/lib/Profile/YAMLProfileWriter.cpp  | 3 ++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/bolt/lib/Profile/BoltAddressTranslation.cpp 
b/bolt/lib/Profile/BoltAddressTranslation.cpp
index 6d3f83efbe5f5a..7c54ba1971cbac 100644
--- a/bolt/lib/Profile/BoltAddressTranslation.cpp
+++ b/bolt/lib/Profile/BoltAddressTranslation.cpp
@@ -600,7 +600,10 @@ BoltAddressTranslation::getBFBranches(uint64_t 
OutputAddress) const {
 unsigned
 BoltAddressTranslation::getSecondaryEntryPointId(uint64_t Address,
  uint32_t Offset) const {
-  const std::vector &Offsets = SecondaryEntryPointsMap.at(Address);
+  auto FunctionIt = SecondaryEntryPointsMap.find(Address);
+  if (FunctionIt == SecondaryEntryPointsMap.end())
+return UINT_MAX;
+  const std::vector &Offsets = FunctionIt->second;
   auto OffsetIt = std::find(Offsets.begin(), Offsets.end(), Offset);
   if (OffsetIt == Offsets.end())
 return UINT_MAX;
diff --git a/bolt/lib/Profile/YAMLProfileWriter.cpp 
b/bolt/lib/Profile/YAMLProfileWriter.cpp
index 78fb1e8539d477..bacee136de3f87 100644
--- a/bolt/lib/Profile/YAMLProfileWriter.cpp
+++ b/bolt/lib/Profile/YAMLProfileWriter.cpp
@@ -48,7 +48,8 @@ setCSIDestination(const BinaryContext &BC, 
yaml::bolt::CallSiteInfo &CSI,
 if (SymbolValue.getError())
   return Callee;
 if (uint32_t Offset = SymbolValue.get() - Callee->getAddress())
-  EntryID = (*GetBATSecondaryEntryPointId)(Callee->getAddress(), Offset);
+  EntryID =
+  (*GetBATSecondaryEntryPointId)(Callee->getAddress(), Offset) + 1;
   } else {
 BC.getFunctionForSymbol(Symbol, &EntryID);
   }

>From 03520283ff38a47bc44cfa395534837d8da66934 Mon Sep 17 00:00:00 2001
From: Amir Ayupov 
Date: Thu, 28 Mar 2024 22:37:24 -0700
Subject: [PATCH 2/7] Fixed setting of BAT secondary entry point, updated test

Created using spr 1.3.4
---
 bolt/include/bolt/Profile/YAMLProfileWriter.h | 11 +--
 bolt/lib/Profile/DataAggregator.cpp   | 11 +--
 bolt/lib/Profile/YAMLProfileWriter.cpp| 71 ---
 .../X86/yaml-secondary-entry-discriminator.s  | 52 +-
 4 files changed, 97 insertions(+), 48 deletions(-)

diff --git a/bolt/include/bolt/Profile/YAMLProfileWriter.h 
b/bolt/include/bolt/Profile/YAMLProfileWriter.h
index 7db581652a5b73..0db2e3fd90f9f1 100644
--- a/bolt/include/bolt/Profile/YAMLProfileWriter.h
+++ b/bolt/include/bolt/Profile/YAMLProfileWriter.h
@@ -15,6 +15,7 @@
 
 namespace llvm {
 namespace bolt {
+class BoltAddressTranslation;
 class RewriteInstance;
 
 class YAMLProfileWriter {
@@ -31,17 +32,9 @@ class YAMLProfileWriter {
   /// Save execution profile for that instance.
   std::error_code writeProfile(const RewriteInstance &RI);
 
-  /// Callback to determine if a function is covered by BAT.
-  using IsBATCallbackTy = std::optional>;
-  /// Callback to get secondary entry point id for a given function and offset.
-  using GetBATSecondaryEntryPointIdCallbackTy =
-  std::optional>;
-
   static yaml::bolt::BinaryFunctionProfile
   convert(const BinaryFunction &BF, bool UseDFS,
-  IsBATCallbackTy IsBATFunction = std::nullopt,
-  GetBATSecondaryEntryPointIdCallbackTy GetBATSecondaryEntryPointId =
-  std::nullopt);
+  const BoltAddressTranslation *BAT = nullptr);
 };
 
 } // namespace bolt
diff --git a/bolt/lib/Profile/DataAggregator.cpp 
b/bolt/lib/Profile/DataAggregator.cpp
index 5b5ce5532ffdb9..71824e2cc0e97a 100644
--- a/bolt/lib/Profile/DataAggregator.cpp
+++ b/bolt/lib/Profile/DataAggregator.cpp
@@ -2324,13 +2324,6 @@ std::error_code 
DataAggregator::writeBATYAML(BinaryContext &BC,
   BP.Header.Flags = opts::BasicAggregation ? BinaryFunction::PF_SAMPLE
: BinaryFunction::PF_LBR;
 
-  auto IsBATFunction = [&](uint64_t Address) {
-return BAT->isBATFunction(Address);
-  };
-  auto GetSecondaryEntryPointId = [&](uint64_t Address, uint32_t Offset) {
-return BAT->getSecondaryEntryPointId(Address, Offset);
-  };
-
   if (!opts::BasicAggregation) {
 // Convert profile for functions not covered by BAT
 for (auto &BFI : BC.getBinaryFunctions()) {
@@ -2339,8 +2332,8 @@ std::error_code 
DataAggregator::writeBATYAML(BinaryContext &BC,
 continue;
   if (BAT->isBATFunction(Function.getAddress()))
 continue;
-  BP.Functions.emplace_back(YAMLProfileWriter::convert(
-  Function, /*UseDFS=*/false, IsBATFunction, 
GetSecondaryEntryPointId));
+  BP.Functions.emplace_back(
+  YAMLProfileWriter::convert(Function, /*UseDFS=*/false, BAT));
 }
 
 for (const auto &KV : Names

[llvm-branch-commits] [llvm] [BOLT] Use BAT for YAML profile call target information (PR #86219)

2024-04-05 Thread Amir Ayupov via llvm-branch-commits

https://github.com/aaupov updated 
https://github.com/llvm/llvm-project/pull/86219

>From 685d3f5fa6ae75d6c3e22873a52ea8347e170c1e Mon Sep 17 00:00:00 2001
From: Amir Ayupov 
Date: Thu, 28 Mar 2024 10:16:15 -0700
Subject: [PATCH 1/8] Get rid of std::map::at

Created using spr 1.3.4
---
 bolt/lib/Profile/BoltAddressTranslation.cpp | 5 -
 bolt/lib/Profile/YAMLProfileWriter.cpp  | 3 ++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/bolt/lib/Profile/BoltAddressTranslation.cpp 
b/bolt/lib/Profile/BoltAddressTranslation.cpp
index 6d3f83efbe5f5a..7c54ba1971cbac 100644
--- a/bolt/lib/Profile/BoltAddressTranslation.cpp
+++ b/bolt/lib/Profile/BoltAddressTranslation.cpp
@@ -600,7 +600,10 @@ BoltAddressTranslation::getBFBranches(uint64_t 
OutputAddress) const {
 unsigned
 BoltAddressTranslation::getSecondaryEntryPointId(uint64_t Address,
  uint32_t Offset) const {
-  const std::vector &Offsets = SecondaryEntryPointsMap.at(Address);
+  auto FunctionIt = SecondaryEntryPointsMap.find(Address);
+  if (FunctionIt == SecondaryEntryPointsMap.end())
+return UINT_MAX;
+  const std::vector &Offsets = FunctionIt->second;
   auto OffsetIt = std::find(Offsets.begin(), Offsets.end(), Offset);
   if (OffsetIt == Offsets.end())
 return UINT_MAX;
diff --git a/bolt/lib/Profile/YAMLProfileWriter.cpp 
b/bolt/lib/Profile/YAMLProfileWriter.cpp
index 78fb1e8539d477..bacee136de3f87 100644
--- a/bolt/lib/Profile/YAMLProfileWriter.cpp
+++ b/bolt/lib/Profile/YAMLProfileWriter.cpp
@@ -48,7 +48,8 @@ setCSIDestination(const BinaryContext &BC, 
yaml::bolt::CallSiteInfo &CSI,
 if (SymbolValue.getError())
   return Callee;
 if (uint32_t Offset = SymbolValue.get() - Callee->getAddress())
-  EntryID = (*GetBATSecondaryEntryPointId)(Callee->getAddress(), Offset);
+  EntryID =
+  (*GetBATSecondaryEntryPointId)(Callee->getAddress(), Offset) + 1;
   } else {
 BC.getFunctionForSymbol(Symbol, &EntryID);
   }

>From 03520283ff38a47bc44cfa395534837d8da66934 Mon Sep 17 00:00:00 2001
From: Amir Ayupov 
Date: Thu, 28 Mar 2024 22:37:24 -0700
Subject: [PATCH 2/8] Fixed setting of BAT secondary entry point, updated test

Created using spr 1.3.4
---
 bolt/include/bolt/Profile/YAMLProfileWriter.h | 11 +--
 bolt/lib/Profile/DataAggregator.cpp   | 11 +--
 bolt/lib/Profile/YAMLProfileWriter.cpp| 71 ---
 .../X86/yaml-secondary-entry-discriminator.s  | 52 +-
 4 files changed, 97 insertions(+), 48 deletions(-)

diff --git a/bolt/include/bolt/Profile/YAMLProfileWriter.h 
b/bolt/include/bolt/Profile/YAMLProfileWriter.h
index 7db581652a5b73..0db2e3fd90f9f1 100644
--- a/bolt/include/bolt/Profile/YAMLProfileWriter.h
+++ b/bolt/include/bolt/Profile/YAMLProfileWriter.h
@@ -15,6 +15,7 @@
 
 namespace llvm {
 namespace bolt {
+class BoltAddressTranslation;
 class RewriteInstance;
 
 class YAMLProfileWriter {
@@ -31,17 +32,9 @@ class YAMLProfileWriter {
   /// Save execution profile for that instance.
   std::error_code writeProfile(const RewriteInstance &RI);
 
-  /// Callback to determine if a function is covered by BAT.
-  using IsBATCallbackTy = std::optional>;
-  /// Callback to get secondary entry point id for a given function and offset.
-  using GetBATSecondaryEntryPointIdCallbackTy =
-  std::optional>;
-
   static yaml::bolt::BinaryFunctionProfile
   convert(const BinaryFunction &BF, bool UseDFS,
-  IsBATCallbackTy IsBATFunction = std::nullopt,
-  GetBATSecondaryEntryPointIdCallbackTy GetBATSecondaryEntryPointId =
-  std::nullopt);
+  const BoltAddressTranslation *BAT = nullptr);
 };
 
 } // namespace bolt
diff --git a/bolt/lib/Profile/DataAggregator.cpp 
b/bolt/lib/Profile/DataAggregator.cpp
index 5b5ce5532ffdb9..71824e2cc0e97a 100644
--- a/bolt/lib/Profile/DataAggregator.cpp
+++ b/bolt/lib/Profile/DataAggregator.cpp
@@ -2324,13 +2324,6 @@ std::error_code 
DataAggregator::writeBATYAML(BinaryContext &BC,
   BP.Header.Flags = opts::BasicAggregation ? BinaryFunction::PF_SAMPLE
: BinaryFunction::PF_LBR;
 
-  auto IsBATFunction = [&](uint64_t Address) {
-return BAT->isBATFunction(Address);
-  };
-  auto GetSecondaryEntryPointId = [&](uint64_t Address, uint32_t Offset) {
-return BAT->getSecondaryEntryPointId(Address, Offset);
-  };
-
   if (!opts::BasicAggregation) {
 // Convert profile for functions not covered by BAT
 for (auto &BFI : BC.getBinaryFunctions()) {
@@ -2339,8 +2332,8 @@ std::error_code 
DataAggregator::writeBATYAML(BinaryContext &BC,
 continue;
   if (BAT->isBATFunction(Function.getAddress()))
 continue;
-  BP.Functions.emplace_back(YAMLProfileWriter::convert(
-  Function, /*UseDFS=*/false, IsBATFunction, 
GetSecondaryEntryPointId));
+  BP.Functions.emplace_back(
+  YAMLProfileWriter::convert(Function, /*UseDFS=*/false, BAT));
 }
 
 for (const auto &KV : Names

[llvm-branch-commits] [llvm] [BOLT] Use BAT for YAML profile call target information (PR #86219)

2024-04-05 Thread Amir Ayupov via llvm-branch-commits

https://github.com/aaupov edited https://github.com/llvm/llvm-project/pull/86219
___
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] [BOLT][BAT] Fix encoded NumBasicBlocks (PR #87830)

2024-04-05 Thread Alexander Yermolovich via llvm-branch-commits


@@ -444,6 +444,8 @@ void BoltAddressTranslation::dump(raw_ostream &OS) {
 OS << formatv(" hash: {0:x}", BBHashMap.getBBHash(Val));
   OS << "\n";
 }
+if (HotAddress == 0)

ayermolo wrote:

Can you add a comment on why we output on !HotAddress?

https://github.com/llvm/llvm-project/pull/87830
___
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] [BOLT] Cover all call sites in writeBATYAML (PR #87743)

2024-04-05 Thread Amir Ayupov via llvm-branch-commits

https://github.com/aaupov updated 
https://github.com/llvm/llvm-project/pull/87743

>From 251020f10d1e6a7a888164748f78acc6994e0ab3 Mon Sep 17 00:00:00 2001
From: Amir Ayupov 
Date: Fri, 5 Apr 2024 07:36:40 -0700
Subject: [PATCH] Remove stats logging

Created using spr 1.3.4
---
 bolt/lib/Profile/DataAggregator.cpp | 13 -
 1 file changed, 13 deletions(-)

diff --git a/bolt/lib/Profile/DataAggregator.cpp 
b/bolt/lib/Profile/DataAggregator.cpp
index 119d082c50c18c..1d0737167c808e 100644
--- a/bolt/lib/Profile/DataAggregator.cpp
+++ b/bolt/lib/Profile/DataAggregator.cpp
@@ -2395,19 +2395,6 @@ std::error_code 
DataAggregator::writeBATYAML(BinaryContext &BC,
 !YamlBB.CallSites.empty())
   YamlBF.Blocks.emplace_back(YamlBB);
   }
-
-  for (const auto &[BranchOffset, _] : Branches.InterIndex) {
-bool Matched =
-llvm::any_of(llvm::make_second_range(BFBranches),
- [&](const std::vector &BranchOffsets) {
-   return llvm::is_contained(BranchOffsets,
- BranchOffset);
- });
-if (!Matched && opts::Verbosity >= 1)
-  errs() << "BOLT-WARNING: Couldn't match call site "
- << formatv("{0}@{1:x} to YAML profile\n", FuncName,
-BranchOffset);
-  }
   BP.Functions.emplace_back(YamlBF);
 }
   }

___
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] [BOLT] Cover all call sites in writeBATYAML (PR #87743)

2024-04-05 Thread Amir Ayupov via llvm-branch-commits

https://github.com/aaupov updated 
https://github.com/llvm/llvm-project/pull/87743

>From 251020f10d1e6a7a888164748f78acc6994e0ab3 Mon Sep 17 00:00:00 2001
From: Amir Ayupov 
Date: Fri, 5 Apr 2024 07:36:40 -0700
Subject: [PATCH] Remove stats logging

Created using spr 1.3.4
---
 bolt/lib/Profile/DataAggregator.cpp | 13 -
 1 file changed, 13 deletions(-)

diff --git a/bolt/lib/Profile/DataAggregator.cpp 
b/bolt/lib/Profile/DataAggregator.cpp
index 119d082c50c18c..1d0737167c808e 100644
--- a/bolt/lib/Profile/DataAggregator.cpp
+++ b/bolt/lib/Profile/DataAggregator.cpp
@@ -2395,19 +2395,6 @@ std::error_code 
DataAggregator::writeBATYAML(BinaryContext &BC,
 !YamlBB.CallSites.empty())
   YamlBF.Blocks.emplace_back(YamlBB);
   }
-
-  for (const auto &[BranchOffset, _] : Branches.InterIndex) {
-bool Matched =
-llvm::any_of(llvm::make_second_range(BFBranches),
- [&](const std::vector &BranchOffsets) {
-   return llvm::is_contained(BranchOffsets,
- BranchOffset);
- });
-if (!Matched && opts::Verbosity >= 1)
-  errs() << "BOLT-WARNING: Couldn't match call site "
- << formatv("{0}@{1:x} to YAML profile\n", FuncName,
-BranchOffset);
-  }
   BP.Functions.emplace_back(YamlBF);
 }
   }

___
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] [BOLT] Cover all call sites in writeBATYAML (PR #87743)

2024-04-05 Thread Amir Ayupov via llvm-branch-commits

https://github.com/aaupov edited https://github.com/llvm/llvm-project/pull/87743
___
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] [BOLT] Use BAT for YAML profile call target information (PR #86219)

2024-04-05 Thread Maksim Panchenko via llvm-branch-commits

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

Looks good with nits addressed.

https://github.com/llvm/llvm-project/pull/86219
___
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] [BOLT] Use BAT for YAML profile call target information (PR #86219)

2024-04-05 Thread Maksim Panchenko via llvm-branch-commits


@@ -123,6 +124,12 @@ class BoltAddressTranslation {
   std::unordered_map>
   getBFBranches(uint64_t FuncOutputAddress) const;
 
+  /// For a given \p Symbol in the output binary, returns a corresponding pair
+  /// of parent BinaryFunction and secondary entry point in it.

maksfb wrote:

Update comment with `Offset` info.

https://github.com/llvm/llvm-project/pull/86219
___
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] [BOLT] Use BAT for YAML profile call target information (PR #86219)

2024-04-05 Thread Maksim Panchenko via llvm-branch-commits


@@ -161,6 +164,10 @@ class BoltAddressTranslation {
   /// Map a function to its secondary entry points vector
   std::unordered_map> SecondaryEntryPointsMap;
 
+  /// Translates a given \p Symbol into a BinaryFunction and
+  /// Returns a secondary entry point id for a given \p Address and \p Offset.

maksfb wrote:

```suggestion
  /// Return a secondary entry point ID for a function located at \p Address 
and \p Offset within that function.
```

https://github.com/llvm/llvm-project/pull/86219
___
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] [BOLT] Use BAT for YAML profile call target information (PR #86219)

2024-04-05 Thread Maksim Panchenko via llvm-branch-commits

https://github.com/maksfb edited https://github.com/llvm/llvm-project/pull/86219
___
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] [BOLT] Use BAT for YAML profile call target information (PR #86219)

2024-04-05 Thread Amir Ayupov via llvm-branch-commits

https://github.com/aaupov updated 
https://github.com/llvm/llvm-project/pull/86219

>From 685d3f5fa6ae75d6c3e22873a52ea8347e170c1e Mon Sep 17 00:00:00 2001
From: Amir Ayupov 
Date: Thu, 28 Mar 2024 10:16:15 -0700
Subject: [PATCH 1/9] Get rid of std::map::at

Created using spr 1.3.4
---
 bolt/lib/Profile/BoltAddressTranslation.cpp | 5 -
 bolt/lib/Profile/YAMLProfileWriter.cpp  | 3 ++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/bolt/lib/Profile/BoltAddressTranslation.cpp 
b/bolt/lib/Profile/BoltAddressTranslation.cpp
index 6d3f83efbe5f5a..7c54ba1971cbac 100644
--- a/bolt/lib/Profile/BoltAddressTranslation.cpp
+++ b/bolt/lib/Profile/BoltAddressTranslation.cpp
@@ -600,7 +600,10 @@ BoltAddressTranslation::getBFBranches(uint64_t 
OutputAddress) const {
 unsigned
 BoltAddressTranslation::getSecondaryEntryPointId(uint64_t Address,
  uint32_t Offset) const {
-  const std::vector &Offsets = SecondaryEntryPointsMap.at(Address);
+  auto FunctionIt = SecondaryEntryPointsMap.find(Address);
+  if (FunctionIt == SecondaryEntryPointsMap.end())
+return UINT_MAX;
+  const std::vector &Offsets = FunctionIt->second;
   auto OffsetIt = std::find(Offsets.begin(), Offsets.end(), Offset);
   if (OffsetIt == Offsets.end())
 return UINT_MAX;
diff --git a/bolt/lib/Profile/YAMLProfileWriter.cpp 
b/bolt/lib/Profile/YAMLProfileWriter.cpp
index 78fb1e8539d477..bacee136de3f87 100644
--- a/bolt/lib/Profile/YAMLProfileWriter.cpp
+++ b/bolt/lib/Profile/YAMLProfileWriter.cpp
@@ -48,7 +48,8 @@ setCSIDestination(const BinaryContext &BC, 
yaml::bolt::CallSiteInfo &CSI,
 if (SymbolValue.getError())
   return Callee;
 if (uint32_t Offset = SymbolValue.get() - Callee->getAddress())
-  EntryID = (*GetBATSecondaryEntryPointId)(Callee->getAddress(), Offset);
+  EntryID =
+  (*GetBATSecondaryEntryPointId)(Callee->getAddress(), Offset) + 1;
   } else {
 BC.getFunctionForSymbol(Symbol, &EntryID);
   }

>From 03520283ff38a47bc44cfa395534837d8da66934 Mon Sep 17 00:00:00 2001
From: Amir Ayupov 
Date: Thu, 28 Mar 2024 22:37:24 -0700
Subject: [PATCH 2/9] Fixed setting of BAT secondary entry point, updated test

Created using spr 1.3.4
---
 bolt/include/bolt/Profile/YAMLProfileWriter.h | 11 +--
 bolt/lib/Profile/DataAggregator.cpp   | 11 +--
 bolt/lib/Profile/YAMLProfileWriter.cpp| 71 ---
 .../X86/yaml-secondary-entry-discriminator.s  | 52 +-
 4 files changed, 97 insertions(+), 48 deletions(-)

diff --git a/bolt/include/bolt/Profile/YAMLProfileWriter.h 
b/bolt/include/bolt/Profile/YAMLProfileWriter.h
index 7db581652a5b73..0db2e3fd90f9f1 100644
--- a/bolt/include/bolt/Profile/YAMLProfileWriter.h
+++ b/bolt/include/bolt/Profile/YAMLProfileWriter.h
@@ -15,6 +15,7 @@
 
 namespace llvm {
 namespace bolt {
+class BoltAddressTranslation;
 class RewriteInstance;
 
 class YAMLProfileWriter {
@@ -31,17 +32,9 @@ class YAMLProfileWriter {
   /// Save execution profile for that instance.
   std::error_code writeProfile(const RewriteInstance &RI);
 
-  /// Callback to determine if a function is covered by BAT.
-  using IsBATCallbackTy = std::optional>;
-  /// Callback to get secondary entry point id for a given function and offset.
-  using GetBATSecondaryEntryPointIdCallbackTy =
-  std::optional>;
-
   static yaml::bolt::BinaryFunctionProfile
   convert(const BinaryFunction &BF, bool UseDFS,
-  IsBATCallbackTy IsBATFunction = std::nullopt,
-  GetBATSecondaryEntryPointIdCallbackTy GetBATSecondaryEntryPointId =
-  std::nullopt);
+  const BoltAddressTranslation *BAT = nullptr);
 };
 
 } // namespace bolt
diff --git a/bolt/lib/Profile/DataAggregator.cpp 
b/bolt/lib/Profile/DataAggregator.cpp
index 5b5ce5532ffdb9..71824e2cc0e97a 100644
--- a/bolt/lib/Profile/DataAggregator.cpp
+++ b/bolt/lib/Profile/DataAggregator.cpp
@@ -2324,13 +2324,6 @@ std::error_code 
DataAggregator::writeBATYAML(BinaryContext &BC,
   BP.Header.Flags = opts::BasicAggregation ? BinaryFunction::PF_SAMPLE
: BinaryFunction::PF_LBR;
 
-  auto IsBATFunction = [&](uint64_t Address) {
-return BAT->isBATFunction(Address);
-  };
-  auto GetSecondaryEntryPointId = [&](uint64_t Address, uint32_t Offset) {
-return BAT->getSecondaryEntryPointId(Address, Offset);
-  };
-
   if (!opts::BasicAggregation) {
 // Convert profile for functions not covered by BAT
 for (auto &BFI : BC.getBinaryFunctions()) {
@@ -2339,8 +2332,8 @@ std::error_code 
DataAggregator::writeBATYAML(BinaryContext &BC,
 continue;
   if (BAT->isBATFunction(Function.getAddress()))
 continue;
-  BP.Functions.emplace_back(YAMLProfileWriter::convert(
-  Function, /*UseDFS=*/false, IsBATFunction, 
GetSecondaryEntryPointId));
+  BP.Functions.emplace_back(
+  YAMLProfileWriter::convert(Function, /*UseDFS=*/false, BAT));
 }
 
 for (const auto &KV : Names

[llvm-branch-commits] [BOLT][BAT] Fix encoded NumBasicBlocks (PR #87830)

2024-04-05 Thread Amir Ayupov via llvm-branch-commits

https://github.com/aaupov updated 
https://github.com/llvm/llvm-project/pull/87830


___
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] [BOLT][BAT] Fix encoded NumBasicBlocks (PR #87830)

2024-04-05 Thread Amir Ayupov via llvm-branch-commits

https://github.com/aaupov updated 
https://github.com/llvm/llvm-project/pull/87830


___
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] [BOLT][BAT] Support multi-way split functions (PR #87123)

2024-04-05 Thread Amir Ayupov via llvm-branch-commits

https://github.com/aaupov updated 
https://github.com/llvm/llvm-project/pull/87123

>From d575235e6d61ea73757ec313a26b8b2aedc2c13d Mon Sep 17 00:00:00 2001
From: Amir Ayupov 
Date: Fri, 29 Mar 2024 20:14:11 -0700
Subject: [PATCH] Address comment

Created using spr 1.3.4
---
 bolt/lib/Profile/BoltAddressTranslation.cpp | 1 -
 1 file changed, 1 deletion(-)

diff --git a/bolt/lib/Profile/BoltAddressTranslation.cpp 
b/bolt/lib/Profile/BoltAddressTranslation.cpp
index 2c00bf6291eb9c..279490170ed446 100644
--- a/bolt/lib/Profile/BoltAddressTranslation.cpp
+++ b/bolt/lib/Profile/BoltAddressTranslation.cpp
@@ -197,7 +197,6 @@ void BoltAddressTranslation::writeMaps(std::map &Maps,
 ? SecondaryEntryPointsMap[Address].size()
 : 0;
 if (Cold) {
-  // `Maps` is keyed by output addresses.
   auto HotEntryIt = Maps.find(ColdPartSource[Address]);
   assert(HotEntryIt != Maps.end());
   size_t HotIndex = std::distance(Maps.begin(), HotEntryIt);

___
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] [BOLT][BAT] Support multi-way split functions (PR #87123)

2024-04-05 Thread Amir Ayupov via llvm-branch-commits

https://github.com/aaupov updated 
https://github.com/llvm/llvm-project/pull/87123

>From d575235e6d61ea73757ec313a26b8b2aedc2c13d Mon Sep 17 00:00:00 2001
From: Amir Ayupov 
Date: Fri, 29 Mar 2024 20:14:11 -0700
Subject: [PATCH] Address comment

Created using spr 1.3.4
---
 bolt/lib/Profile/BoltAddressTranslation.cpp | 1 -
 1 file changed, 1 deletion(-)

diff --git a/bolt/lib/Profile/BoltAddressTranslation.cpp 
b/bolt/lib/Profile/BoltAddressTranslation.cpp
index 2c00bf6291eb9c..279490170ed446 100644
--- a/bolt/lib/Profile/BoltAddressTranslation.cpp
+++ b/bolt/lib/Profile/BoltAddressTranslation.cpp
@@ -197,7 +197,6 @@ void BoltAddressTranslation::writeMaps(std::map &Maps,
 ? SecondaryEntryPointsMap[Address].size()
 : 0;
 if (Cold) {
-  // `Maps` is keyed by output addresses.
   auto HotEntryIt = Maps.find(ColdPartSource[Address]);
   assert(HotEntryIt != Maps.end());
   size_t HotIndex = std::distance(Maps.begin(), HotEntryIt);

___
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] [BOLT][BAT] Fix encoded NumBasicBlocks (PR #87830)

2024-04-05 Thread Alexander Yermolovich via llvm-branch-commits


@@ -426,8 +426,9 @@ void BoltAddressTranslation::dump(raw_ostream &OS) {
   for (const auto &MapEntry : Maps) {
 const uint64_t Address = MapEntry.first;
 const uint64_t HotAddress = fetchParentAddress(Address);
+bool IsHotFunction = HotAddress == 0;

ayermolo wrote:

const

https://github.com/llvm/llvm-project/pull/87830
___
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] [BOLT][BAT] Fix encoded NumBasicBlocks (PR #87830)

2024-04-05 Thread Amir Ayupov via llvm-branch-commits

https://github.com/aaupov updated 
https://github.com/llvm/llvm-project/pull/87830


___
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] [BOLT][BAT] Fix encoded NumBasicBlocks (PR #87830)

2024-04-05 Thread Amir Ayupov via llvm-branch-commits

https://github.com/aaupov updated 
https://github.com/llvm/llvm-project/pull/87830


___
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] [BOLT][BAT] Fix encoded NumBasicBlocks (PR #87830)

2024-04-05 Thread Alexander Yermolovich via llvm-branch-commits

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


https://github.com/llvm/llvm-project/pull/87830
___
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] [BOLT] Cover all call sites in writeBATYAML (PR #87743)

2024-04-05 Thread Amir Ayupov via llvm-branch-commits

https://github.com/aaupov updated 
https://github.com/llvm/llvm-project/pull/87743

>From 251020f10d1e6a7a888164748f78acc6994e0ab3 Mon Sep 17 00:00:00 2001
From: Amir Ayupov 
Date: Fri, 5 Apr 2024 07:36:40 -0700
Subject: [PATCH] Remove stats logging

Created using spr 1.3.4
---
 bolt/lib/Profile/DataAggregator.cpp | 13 -
 1 file changed, 13 deletions(-)

diff --git a/bolt/lib/Profile/DataAggregator.cpp 
b/bolt/lib/Profile/DataAggregator.cpp
index 119d082c50c18c..1d0737167c808e 100644
--- a/bolt/lib/Profile/DataAggregator.cpp
+++ b/bolt/lib/Profile/DataAggregator.cpp
@@ -2395,19 +2395,6 @@ std::error_code 
DataAggregator::writeBATYAML(BinaryContext &BC,
 !YamlBB.CallSites.empty())
   YamlBF.Blocks.emplace_back(YamlBB);
   }
-
-  for (const auto &[BranchOffset, _] : Branches.InterIndex) {
-bool Matched =
-llvm::any_of(llvm::make_second_range(BFBranches),
- [&](const std::vector &BranchOffsets) {
-   return llvm::is_contained(BranchOffsets,
- BranchOffset);
- });
-if (!Matched && opts::Verbosity >= 1)
-  errs() << "BOLT-WARNING: Couldn't match call site "
- << formatv("{0}@{1:x} to YAML profile\n", FuncName,
-BranchOffset);
-  }
   BP.Functions.emplace_back(YamlBF);
 }
   }

___
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] [BOLT] Cover all call sites in writeBATYAML (PR #87743)

2024-04-05 Thread Amir Ayupov via llvm-branch-commits

https://github.com/aaupov updated 
https://github.com/llvm/llvm-project/pull/87743

>From 251020f10d1e6a7a888164748f78acc6994e0ab3 Mon Sep 17 00:00:00 2001
From: Amir Ayupov 
Date: Fri, 5 Apr 2024 07:36:40 -0700
Subject: [PATCH] Remove stats logging

Created using spr 1.3.4
---
 bolt/lib/Profile/DataAggregator.cpp | 13 -
 1 file changed, 13 deletions(-)

diff --git a/bolt/lib/Profile/DataAggregator.cpp 
b/bolt/lib/Profile/DataAggregator.cpp
index 119d082c50c18c..1d0737167c808e 100644
--- a/bolt/lib/Profile/DataAggregator.cpp
+++ b/bolt/lib/Profile/DataAggregator.cpp
@@ -2395,19 +2395,6 @@ std::error_code 
DataAggregator::writeBATYAML(BinaryContext &BC,
 !YamlBB.CallSites.empty())
   YamlBF.Blocks.emplace_back(YamlBB);
   }
-
-  for (const auto &[BranchOffset, _] : Branches.InterIndex) {
-bool Matched =
-llvm::any_of(llvm::make_second_range(BFBranches),
- [&](const std::vector &BranchOffsets) {
-   return llvm::is_contained(BranchOffsets,
- BranchOffset);
- });
-if (!Matched && opts::Verbosity >= 1)
-  errs() << "BOLT-WARNING: Couldn't match call site "
- << formatv("{0}@{1:x} to YAML profile\n", FuncName,
-BranchOffset);
-  }
   BP.Functions.emplace_back(YamlBF);
 }
   }

___
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] [BOLT][BAT] Fix encoded NumBasicBlocks (PR #87830)

2024-04-05 Thread Amir Ayupov via llvm-branch-commits

https://github.com/aaupov edited https://github.com/llvm/llvm-project/pull/87830
___
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] [BOLT][BAT] Fix encoded NumBasicBlocks (PR #87830)

2024-04-05 Thread Amir Ayupov via llvm-branch-commits

https://github.com/aaupov updated 
https://github.com/llvm/llvm-project/pull/87830


___
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] [BOLT][BAT] Fix encoded NumBasicBlocks (PR #87830)

2024-04-05 Thread Amir Ayupov via llvm-branch-commits

https://github.com/aaupov updated 
https://github.com/llvm/llvm-project/pull/87830


___
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] [BOLT] Use offset deduplication for cold fragments (PR #87853)

2024-04-05 Thread Amir Ayupov via llvm-branch-commits

https://github.com/aaupov created 
https://github.com/llvm/llvm-project/pull/87853

Apply deduplication for uniformity and BAT section size reduction.

Changes BAT section size to:
- large binary: 39541552 bytes (1.02x original),
- medium binary: 3828996 bytes (0.64x),
- small binary: 928 bytes (0.65x).

Test Plan: Updated bolt-address-translation{,-yaml}.test



___
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] [BOLT] Use offset deduplication for cold fragments (PR #87853)

2024-04-05 Thread Amir Ayupov via llvm-branch-commits

https://github.com/aaupov edited https://github.com/llvm/llvm-project/pull/87853
___
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] [BOLT] Use offset deduplication for cold fragments (PR #87853)

2024-04-05 Thread Amir Ayupov via llvm-branch-commits

https://github.com/aaupov updated 
https://github.com/llvm/llvm-project/pull/87853


___
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] [BOLT] Use offset deduplication for cold fragments (PR #87853)

2024-04-05 Thread Amir Ayupov via llvm-branch-commits

https://github.com/aaupov updated 
https://github.com/llvm/llvm-project/pull/87853


___
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] release/18.x: [SPARC] Implement L and H inline asm argument modifiers (#87259) (PR #87714)

2024-04-05 Thread via llvm-branch-commits

koachan wrote:

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

Personally I'm okay with it but I thought 18.x is already well past release?

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