[Lldb-commits] [libcxx] [clang-tools-extra] [libc] [lldb] [flang] [lld] [clang] [llvm] [compiler-rt] [Legalizer] Expand fmaximum and fminimum (PR #67301)

2023-12-19 Thread Qiu Chaofan via lldb-commits

ecnelises wrote:

> Is there any existing vector test coverage?

Yes, there are vector tests in PowerPC's fminimum-fmaximum.ll.

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


[Lldb-commits] [clang-tools-extra] [clang] [libcxx] [lld] [libc] [llvm] [flang] [lldb] [compiler-rt] [Legalizer] Expand fmaximum and fminimum (PR #67301)

2023-12-19 Thread Qiu Chaofan via lldb-commits


@@ -8262,6 +8262,64 @@ SDValue TargetLowering::expandFMINNUM_FMAXNUM(SDNode 
*Node,
   return SDValue();
 }
 
+SDValue TargetLowering::expandFMINIMUM_FMAXIMUM(SDNode *N,
+SelectionDAG &DAG) const {
+  SDLoc DL(N);
+  SDValue LHS = N->getOperand(0);
+  SDValue RHS = N->getOperand(1);
+  unsigned Opc = N->getOpcode();
+  EVT VT = N->getValueType(0);
+  EVT CCVT = getSetCCResultType(DAG.getDataLayout(), *DAG.getContext(), VT);
+  bool IsMax = Opc == ISD::FMAXIMUM;
+
+  if (VT.isVector() &&
+  isOperationLegalOrCustomOrPromote(Opc, VT.getScalarType()))
+return SDValue();
+
+  // First, implement comparison not propagating NaN. If no native fmin or fmax
+  // available, use plain select with setcc instead.
+  SDValue MinMax;
+  if (isOperationLegalOrCustom(IsMax ? ISD::FMAXNUM_IEEE : ISD::FMINNUM_IEEE,
+   VT)) {
+MinMax = DAG.getNode(IsMax ? ISD::FMAXNUM_IEEE : ISD::FMINNUM_IEEE, DL, VT,
+ LHS, RHS);
+  } else if (isOperationLegalOrCustom(IsMax ? ISD::FMAXNUM : ISD::FMINNUM,
+  VT)) {
+MinMax = DAG.getNode(IsMax ? ISD::FMAXNUM : ISD::FMINNUM, DL, VT, LHS, 
RHS);
+  } else {
+SDValue Compare =
+DAG.getSetCC(DL, CCVT, LHS, RHS, IsMax ? ISD::SETGT : ISD::SETLT);

ecnelises wrote:

Yes here it assumes no NaN exists (if either operand is NaN, it will be 
propagated in following code)

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


[Lldb-commits] [clang-tools-extra] [clang] [libcxx] [lld] [libc] [llvm] [flang] [lldb] [compiler-rt] [Legalizer] Expand fmaximum and fminimum (PR #67301)

2023-12-19 Thread Qiu Chaofan via lldb-commits


@@ -8262,6 +8262,64 @@ SDValue TargetLowering::expandFMINNUM_FMAXNUM(SDNode 
*Node,
   return SDValue();
 }
 
+SDValue TargetLowering::expandFMINIMUM_FMAXIMUM(SDNode *N,
+SelectionDAG &DAG) const {
+  SDLoc DL(N);
+  SDValue LHS = N->getOperand(0);
+  SDValue RHS = N->getOperand(1);
+  unsigned Opc = N->getOpcode();
+  EVT VT = N->getValueType(0);
+  EVT CCVT = getSetCCResultType(DAG.getDataLayout(), *DAG.getContext(), VT);
+  bool IsMax = Opc == ISD::FMAXIMUM;
+
+  if (VT.isVector() &&
+  isOperationLegalOrCustomOrPromote(Opc, VT.getScalarType()))
+return SDValue();
+
+  // First, implement comparison not propagating NaN. If no native fmin or fmax
+  // available, use plain select with setcc instead.
+  SDValue MinMax;
+  if (isOperationLegalOrCustom(IsMax ? ISD::FMAXNUM_IEEE : ISD::FMINNUM_IEEE,
+   VT)) {
+MinMax = DAG.getNode(IsMax ? ISD::FMAXNUM_IEEE : ISD::FMINNUM_IEEE, DL, VT,
+ LHS, RHS);
+  } else if (isOperationLegalOrCustom(IsMax ? ISD::FMAXNUM : ISD::FMINNUM,
+  VT)) {
+MinMax = DAG.getNode(IsMax ? ISD::FMAXNUM : ISD::FMINNUM, DL, VT, LHS, 
RHS);
+  } else {
+SDValue Compare =
+DAG.getSetCC(DL, CCVT, LHS, RHS, IsMax ? ISD::SETGT : ISD::SETLT);
+MinMax = DAG.getSelect(DL, VT, Compare, LHS, RHS);
+  }
+
+  // Propagate any NaN of both operands
+  if (!N->getFlags().hasNoNaNs() &&
+  (!DAG.isKnownNeverNaN(LHS) || !DAG.isKnownNeverNaN(RHS))) {
+ConstantFP *FPNaN = ConstantFP::get(
+*DAG.getContext(), APFloat::getNaN(DAG.EVTToAPFloatSemantics(VT)));
+MinMax = DAG.getSelect(DL, VT, DAG.getSetCC(DL, CCVT, LHS, RHS, 
ISD::SETUO),
+   DAG.getConstantFP(*FPNaN, DL, VT), MinMax);
+  }
+
+  // fminimum/fmaximum requires -0.0 less than +0.0
+  if (!N->getFlags().hasNoSignedZeros() && !DAG.isKnownNeverZeroFloat(LHS) &&
+  !DAG.isKnownNeverZeroFloat(RHS)) {
+SDValue IsZero = DAG.getSetCC(DL, CCVT, MinMax,
+  DAG.getConstantFP(0.0, DL, VT), ISD::SETEQ);
+SDValue TestZero =
+DAG.getTargetConstant(IsMax ? fcPosZero : fcNegZero, DL, MVT::i32);
+SDValue LCmp = DAG.getSelect(
+DL, VT, DAG.getNode(ISD::IS_FPCLASS, DL, CCVT, LHS, TestZero), LHS,
+MinMax);
+SDValue RCmp = DAG.getSelect(
+DL, VT, DAG.getNode(ISD::IS_FPCLASS, DL, CCVT, RHS, TestZero), RHS,
+LCmp);
+MinMax = DAG.getSelect(DL, VT, IsZero, RCmp, MinMax);

ecnelises wrote:

We still need isfpclass to know which is negative/positive zero and whether 
both are zeros, I think.

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


[Lldb-commits] [clang-tools-extra] [clang] [libcxx] [lld] [libc] [llvm] [flang] [lldb] [compiler-rt] [Legalizer] Expand fmaximum and fminimum (PR #67301)

2023-12-19 Thread Qiu Chaofan via lldb-commits

https://github.com/ecnelises updated 
https://github.com/llvm/llvm-project/pull/67301

>From 92abb76631594dfc2ca586c46c38031610be0548 Mon Sep 17 00:00:00 2001
From: Qiu Chaofan 
Date: Mon, 25 Sep 2023 17:08:59 +0800
Subject: [PATCH 1/5] [Legalizer] Expand fmaximum and fminimum

According to langref, llvm.maximum/minimum has -0.0 < +0.0 semantics and
propagates NaN.

Expand the nodes on targets not supporting the operation, by adding
extra check for NaN and using is_fpclass to check zero signs.
---
 llvm/include/llvm/CodeGen/TargetLowering.h|   3 +
 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp |   6 +
 .../SelectionDAG/LegalizeVectorOps.cpp|   7 +
 .../CodeGen/SelectionDAG/TargetLowering.cpp   |  58 ++
 llvm/lib/Target/ARM/ARMISelLowering.cpp   |  14 +-
 llvm/lib/Target/RISCV/RISCVISelLowering.cpp   |  10 +-
 .../CodeGen/ARM/minnum-maxnum-intrinsics.ll   |  28 +-
 .../CodeGen/PowerPC/fminimum-fmaximum-f128.ll |  97 ++
 .../test/CodeGen/PowerPC/fminimum-fmaximum.ll | 847 ++
 9 files changed, 1039 insertions(+), 31 deletions(-)
 create mode 100644 llvm/test/CodeGen/PowerPC/fminimum-fmaximum-f128.ll
 create mode 100644 llvm/test/CodeGen/PowerPC/fminimum-fmaximum.ll

diff --git a/llvm/include/llvm/CodeGen/TargetLowering.h 
b/llvm/include/llvm/CodeGen/TargetLowering.h
index c6a7aa17146dd4..429cfd72af2e6e 100644
--- a/llvm/include/llvm/CodeGen/TargetLowering.h
+++ b/llvm/include/llvm/CodeGen/TargetLowering.h
@@ -5089,6 +5089,9 @@ class TargetLowering : public TargetLoweringBase {
   /// Expand fminnum/fmaxnum into fminnum_ieee/fmaxnum_ieee with quieted 
inputs.
   SDValue expandFMINNUM_FMAXNUM(SDNode *N, SelectionDAG &DAG) const;
 
+  /// Expand fminimum/fmaximum into multiple comparison with selects.
+  SDValue expandFMINIMUM_FMAXIMUM(SDNode *N, SelectionDAG &DAG) const;
+
   /// Expand FP_TO_[US]INT_SAT into FP_TO_[US]INT and selects or min/max.
   /// \param N Node to expand
   /// \returns The expansion result
diff --git a/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp 
b/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
index f19beea3a3ed8b..33f6354d558454 100644
--- a/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
@@ -3540,6 +3540,12 @@ bool SelectionDAGLegalize::ExpandNode(SDNode *Node) {
   Results.push_back(Expanded);
 break;
   }
+  case ISD::FMINIMUM:
+  case ISD::FMAXIMUM: {
+if (SDValue Expanded = TLI.expandFMINIMUM_FMAXIMUM(Node, DAG))
+  Results.push_back(Expanded);
+break;
+  }
   case ISD::FSIN:
   case ISD::FCOS: {
 EVT VT = Node->getValueType(0);
diff --git a/llvm/lib/CodeGen/SelectionDAG/LegalizeVectorOps.cpp 
b/llvm/lib/CodeGen/SelectionDAG/LegalizeVectorOps.cpp
index dec81475f3a88f..db132035adcf29 100644
--- a/llvm/lib/CodeGen/SelectionDAG/LegalizeVectorOps.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/LegalizeVectorOps.cpp
@@ -949,6 +949,13 @@ void VectorLegalizer::Expand(SDNode *Node, 
SmallVectorImpl &Results) {
   return;
 }
 break;
+  case ISD::FMINIMUM:
+  case ISD::FMAXIMUM:
+if (SDValue Expanded = TLI.expandFMINIMUM_FMAXIMUM(Node, DAG)) {
+  Results.push_back(Expanded);
+  return;
+}
+break;
   case ISD::SMIN:
   case ISD::SMAX:
   case ISD::UMIN:
diff --git a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp 
b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
index 39489e0bf142eb..23de9829b5e9ff 100644
--- a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
@@ -8177,6 +8177,64 @@ SDValue TargetLowering::expandFMINNUM_FMAXNUM(SDNode 
*Node,
   return SDValue();
 }
 
+SDValue TargetLowering::expandFMINIMUM_FMAXIMUM(SDNode *N,
+SelectionDAG &DAG) const {
+  SDLoc DL(N);
+  SDValue LHS = N->getOperand(0);
+  SDValue RHS = N->getOperand(1);
+  unsigned Opc = N->getOpcode();
+  EVT VT = N->getValueType(0);
+  EVT CCVT = getSetCCResultType(DAG.getDataLayout(), *DAG.getContext(), VT);
+  bool NoNaN = (N->getFlags().hasNoNaNs() ||
+(DAG.isKnownNeverNaN(LHS) && DAG.isKnownNeverNaN(RHS)));
+  bool NoZeroSign =
+  (N->getFlags().hasNoSignedZeros() || DAG.isKnownNeverZeroFloat(LHS) ||
+   DAG.isKnownNeverZeroFloat(RHS));
+  bool IsMax = Opc == ISD::FMAXIMUM;
+
+  if (VT.isVector() &&
+  isOperationLegalOrCustomOrPromote(Opc, VT.getScalarType()))
+return SDValue();
+
+  SDValue MinMax;
+  if (isOperationLegalOrCustom(IsMax ? ISD::FMAXNUM_IEEE : ISD::FMINNUM_IEEE,
+   VT))
+MinMax = DAG.getNode(IsMax ? ISD::FMAXNUM_IEEE : ISD::FMINNUM_IEEE, DL, VT,
+ LHS, RHS);
+  else if (isOperationLegalOrCustom(IsMax ? ISD::FMAXNUM : ISD::FMINNUM, VT))
+MinMax = DAG.getNode(IsMax ? ISD::FMAXNUM : ISD::FMINNUM, DL, VT, LHS, 
RHS);
+  else
+MinMax = DAG.getSelect(
+DL, VT,
+DAG.getSetCC(DL, CCVT, LHS, RHS, IsMax ? ISD::SETGT : ISD::SETLT), LHS,
+RHS);
+
+  // Propagate

[Lldb-commits] [openmp] [clang-tools-extra] [clang] [libcxx] [libc] [mlir] [llvm] [flang] [lldb] [compiler-rt] [libc++][span] P2821R5: span.at() (PR #74994)

2023-12-19 Thread Hristo Hristov via lldb-commits

https://github.com/H-G-Hristov updated 
https://github.com/llvm/llvm-project/pull/74994

>From 6e26ca239c49e1b7d9ab72217db7339e92df163f Mon Sep 17 00:00:00 2001
From: Zingam 
Date: Sun, 10 Dec 2023 14:16:02 +0200
Subject: [PATCH 01/17] [libc++][span] P2821R5: span.at()

---
 libcxx/include/span   |  30 +++
 .../views/views.span/span.elem/at.pass.cpp| 246 ++
 .../views.span/span.elem/op_idx.pass.cpp  |   1 -
 3 files changed, 276 insertions(+), 1 deletion(-)
 create mode 100644 
libcxx/test/std/containers/views/views.span/span.elem/at.pass.cpp

diff --git a/libcxx/include/span b/libcxx/include/span
index 69b0a2875e26cc..b015d7cf1c15b6 100644
--- a/libcxx/include/span
+++ b/libcxx/include/span
@@ -92,6 +92,7 @@ public:
 
 // [span.elem], span element access
 constexpr reference operator[](size_type idx) const;
+constexpr reference at(size_type idx) const; // since C++26
 constexpr reference front() const;
 constexpr reference back() const;
 constexpr pointer data() const noexcept;
@@ -146,6 +147,9 @@ template
 #include <__utility/forward.h>
 #include // for array
 #include   // for byte
+#if _LIBCPP_STD_VER >= 26
+#  include 
+#endif
 #include 
 
 // standard-mandated includes
@@ -343,6 +347,15 @@ public:
 return __data_[__idx];
 }
 
+#  if _LIBCPP_STD_VER >= 26
+_LIBCPP_HIDE_FROM_ABI constexpr reference at(size_type __idx) const {
+  if (__idx >= size()) {
+__throw_out_of_range();
+  }
+  return *(data() + __idx);
+}
+#  endif
+
 _LIBCPP_INLINE_VISIBILITY constexpr reference front() const noexcept
 {
 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "span::front() on 
empty span");
@@ -383,6 +396,10 @@ public:
 
 private:
 pointer__data_;
+
+#  if _LIBCPP_STD_VER >= 26
+_LIBCPP_NORETURN _LIBCPP_HIDE_FROM_ABI void __throw_out_of_range() const { 
std::__throw_out_of_range("span"); }
+#  endif
 };
 
 
@@ -510,6 +527,15 @@ public:
 return __data_[__idx];
 }
 
+#  if _LIBCPP_STD_VER >= 26
+_LIBCPP_HIDE_FROM_ABI constexpr reference at(size_type __idx) const {
+  if (__idx >= size()) {
+__throw_out_of_range();
+  }
+  return *(data() + __idx);
+}
+#  endif
+
 _LIBCPP_INLINE_VISIBILITY constexpr reference front() const noexcept
 {
 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "span::front() on 
empty span");
@@ -552,6 +578,10 @@ public:
 private:
 pointer   __data_;
 size_type __size_;
+
+#  if _LIBCPP_STD_VER >= 26
+_LIBCPP_NORETURN _LIBCPP_HIDE_FROM_ABI void __throw_out_of_range() const { 
std::__throw_out_of_range("span"); }
+#  endif
 };
 
 template 
diff --git a/libcxx/test/std/containers/views/views.span/span.elem/at.pass.cpp 
b/libcxx/test/std/containers/views/views.span/span.elem/at.pass.cpp
new file mode 100644
index 00..2a9ce2baeec1a5
--- /dev/null
+++ b/libcxx/test/std/containers/views/views.span/span.elem/at.pass.cpp
@@ -0,0 +1,246 @@
+//===--===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20, c++23
+
+// 
+
+// constexpr reference at(size_type idx) const; // since C++26
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "test_macros.h"
+
+// template 
+// constexpr bool testConstexprSpan(Span sp, std::size_t idx)
+// {
+// LIBCPP_ASSERT(noexcept(sp[idx]));
+
+// typename Span::reference r1 = sp[idx];
+// typename Span::reference r2 = *(sp.data() + idx);
+
+// return r1 == r2;
+// }
+
+// template 
+// void testRuntimeSpan(Span sp, std::size_t idx)
+// {
+// LIBCPP_ASSERT(noexcept(sp[idx]));
+
+// typename Span::reference r1 = sp[idx];
+// typename Span::reference r2 = *(sp.data() + idx);
+
+// assert(r1 == r2);
+// }
+
+// struct A{};
+// constexpr int iArr1[] = { 0,  1,  2,  3,  4,  5,  6,  7,  8,  9};
+//   int iArr2[] = {10, 11, 12, 13, 14, 15, 16, 17, 18, 19};
+
+// int main(int, char**)
+// {
+// static_assert(testConstexprSpan(std::span(iArr1, 1), 0), "");
+
+// static_assert(testConstexprSpan(std::span(iArr1, 2), 0), "");
+// static_assert(testConstexprSpan(std::span(iArr1, 2), 1), "");
+
+// static_assert(testConstexprSpan(std::span(iArr1, 3), 0), "");
+// static_assert(testConstexprSpan(std::span(iArr1, 3), 1), "");
+// static_assert(testConstexprSpan(std::span(iArr1, 3), 2), "");
+
+// static_assert(testConstexprSpan(std::span(iArr1, 4), 0), "");
+// static_assert(testConstexprSpan(std::span(iArr1, 4), 1), "");
+// static_assert(testConstexprSpan(std::span(iArr1, 4), 2), "");
+// static_assert(t

[Lldb-commits] [lldb] [lldb] In-progress — All ValueObjectSP instances are now valid (non-null) but have an error state (PR #74912)

2023-12-19 Thread Pete Lawrence via lldb-commits

https://github.com/PortalPete closed 
https://github.com/llvm/llvm-project/pull/74912
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Remove 2nd "error: " substring in output to developer (PR #72150)

2023-12-19 Thread Pete Lawrence via lldb-commits

https://github.com/PortalPete closed 
https://github.com/llvm/llvm-project/pull/72150
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [libunwind] [lldb] [llvm] [libc] [clang-tools-extra] [compiler-rt] [flang] [clang] Reland the reland "[PGO][GlobalValue][LTO]In GlobalValues::getGlobalIdentifier, use semicolon as delim

2023-12-19 Thread Mingming Liu via lldb-commits

minglotus-6 wrote:

And pushed https://github.com/llvm/llvm-project/pull/76005 to require 64-bit 
systems for IR test. Raw profile reader swaps byte orders properly so 
`REQUIRES: host-byteorder-little-endian` looks actually unnecessary but will 
keep it fwiw for now.

I feel sorry for dance around but figured fix forwards of test requirements is 
much faster than getting various machines and setting up environments there.. 
Will monitor the build-bots .

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


[Lldb-commits] [clang] [lldb] [libunwind] [libc] [clang-tools-extra] [compiler-rt] [llvm] [flang] Reland the reland "[PGO][GlobalValue][LTO]In GlobalValues::getGlobalIdentifier, use semicolon as delim

2023-12-19 Thread Mingming Liu via lldb-commits

minglotus-6 wrote:

> I'm seeing spurious failures from big-endian systems. I'll revert and 
> investigate a fix.

I ended up sending a fix forward in 
https://github.com/llvm/llvm-project/pull/76001 . Will monitor the build-bots.

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


[Lldb-commits] [clang] [libc] [flang] [lldb] [clang-tools-extra] [libunwind] [llvm] [compiler-rt] Reland the reland "[PGO][GlobalValue][LTO]In GlobalValues::getGlobalIdentifier, use semicolon as delim

2023-12-19 Thread Mingming Liu via lldb-commits

minglotus-6 wrote:

I'm seeing spurious failures from big-endian systems. I'll revert and 
investigate a fix.

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


[Lldb-commits] [llvm] [flang] [lldb] [clang] [libunwind] [compiler-rt] [libcxx] [libc] [lld] Remove wrong float-128 extension for CLang (PR #75909)

2023-12-19 Thread Igor Popov via lldb-commits

https://github.com/silver-popov updated 
https://github.com/llvm/llvm-project/pull/75909

>From 00edd52687d6e15f3453912b5dbf236714a386f9 Mon Sep 17 00:00:00 2001
From: Igor Popov 
Date: Tue, 19 Dec 2023 11:43:45 +0300
Subject: [PATCH] Remove wrong float-128 extension for CLang

---
 libc/src/__support/macros/properties/float.h | 5 -
 1 file changed, 5 deletions(-)

diff --git a/libc/src/__support/macros/properties/float.h 
b/libc/src/__support/macros/properties/float.h
index 756579024cad8b..1953a6b6ef6250 100644
--- a/libc/src/__support/macros/properties/float.h
+++ b/libc/src/__support/macros/properties/float.h
@@ -59,11 +59,6 @@ using float16 = _Float16;
  defined(LIBC_TARGET_ARCH_IS_X86_64))
 #define LIBC_COMPILER_HAS_C23_FLOAT128
 #endif
-#if (defined(LIBC_COMPILER_CLANG_VER) && (LIBC_COMPILER_CLANG_VER >= 500)) &&  
\
-(defined(LIBC_TARGET_ARCH_IS_X86_64) &&
\
- !defined(LIBC_TARGET_OS_IS_FUCHSIA))
-#define LIBC_COMPILER_HAS_FLOAT128_EXTENSION
-#endif
 
 #if defined(LIBC_COMPILER_HAS_C23_FLOAT128)
 using float128 = _Float128;

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


[Lldb-commits] [clang] [lldb] [lld] [flang] [clang-tools-extra] [libcxx] [llvm] [libc] [compiler-rt] [AMDGPU] Use alias scope to relax waitcounts for LDS DMA (PR #75974)

2023-12-19 Thread Stanislav Mekhanoshin via lldb-commits

rampitec wrote:

This is the place I am creating it: https://reviews.llvm.org/D108315

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


[Lldb-commits] [lldb] [DRAFT] Add support for inline DWARF source files. (PR #75880)

2023-12-19 Thread Adrian Prantl via lldb-commits

adrian-prantl wrote:

@JDevlieghere and I had an offline conversation about whether we couldn't 
separate out a SupportFileList from FileSpecList to limit the amount of places 
that need to think about lazy files and also to potentially move the 
FileSpec::m_checksum into. Here is a very rough patch that implements this idea 
to show how much of LLDB is affected by the change.

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


[Lldb-commits] [lldb] [DRAFT] Add support for inline DWARF source files. (PR #75880)

2023-12-19 Thread Adrian Prantl via lldb-commits

https://github.com/adrian-prantl updated 
https://github.com/llvm/llvm-project/pull/75880

>From e089e1d67c01a42da16b7544abf8c4935cde4aed Mon Sep 17 00:00:00 2001
From: Adrian Prantl 
Date: Mon, 18 Dec 2023 15:59:00 -0800
Subject: [PATCH 1/2] Add support for inline DWARF source files.

LLVM supports DWARF 5 linetable extension to store source files inline
in DWARF. This is particularly useful for compiler-generated source
code. This implementation tries to materialize them as temporary files
lazily, so SBAPI clients don't need to be aware of them.
---
 lldb/include/lldb/Utility/FileSpecList.h  | 45 +++---
 lldb/source/Core/ModuleList.cpp   |  8 ++--
 .../Clang/ClangUserExpression.cpp | 12 ++---
 .../Clang/CppModuleConfiguration.cpp  |  6 +--
 .../SymbolFile/DWARF/SymbolFileDWARF.cpp  | 47 +++
 lldb/source/Utility/FileSpecList.cpp  | 21 +
 .../inline-sourcefile/Makefile| 11 +
 .../TestInlineSourceFiles.py  | 17 +++
 .../inline-sourcefile/inline.ll   | 39 +++
 .../functionalities/inline-sourcefile/main.c  |  7 +++
 10 files changed, 186 insertions(+), 27 deletions(-)
 create mode 100644 lldb/test/API/functionalities/inline-sourcefile/Makefile
 create mode 100644 
lldb/test/API/functionalities/inline-sourcefile/TestInlineSourceFiles.py
 create mode 100644 lldb/test/API/functionalities/inline-sourcefile/inline.ll
 create mode 100644 lldb/test/API/functionalities/inline-sourcefile/main.c

diff --git a/lldb/include/lldb/Utility/FileSpecList.h 
b/lldb/include/lldb/Utility/FileSpecList.h
index 77587aa917916b..8eda721b607fd6 100644
--- a/lldb/include/lldb/Utility/FileSpecList.h
+++ b/lldb/include/lldb/Utility/FileSpecList.h
@@ -17,13 +17,41 @@
 namespace lldb_private {
 class Stream;
 
+/// Represents a source file whose contents is known (for example
+/// because it can be reconstructed from debug info), but that
+/// hasn't been written to a local disk yet.
+struct LazyFileSpec {
+  virtual ~LazyFileSpec() {}
+  virtual const FileSpec &Materialize() = 0;
+};
+
+/// Wraps either a FileSpec that represents a local file or a
+/// LazyFileSpec that could be materialized into a local file.
+class FileSpecHolder {
+  FileSpec m_file_spec;
+  std::shared_ptr m_lazy;
+
+public:
+  FileSpecHolder(const FileSpec &spec, std::shared_ptr lazy = {})
+  : m_file_spec(spec), m_lazy(lazy) {}
+  FileSpecHolder(const FileSpecHolder &other) = default;
+  FileSpecHolder(FileSpecHolder &&other) = default;
+  FileSpecHolder &operator=(const FileSpecHolder &other) = default;
+  const FileSpec &GetSpecOnly() const { return m_file_spec; };
+  const FileSpec &Materialize() const {
+if (m_lazy)
+  return m_lazy->Materialize();
+return m_file_spec;
+  }
+};
+
 /// \class FileSpecList FileSpecList.h "lldb/Utility/FileSpecList.h"
 /// A file collection class.
 ///
 /// A class that contains a mutable list of FileSpec objects.
 class FileSpecList {
 public:
-  typedef std::vector collection;
+  typedef std::vector collection;
   typedef collection::const_iterator const_iterator;
 
   /// Default constructor.
@@ -38,7 +66,10 @@ class FileSpecList {
   FileSpecList(FileSpecList &&rhs) = default;
 
   /// Initialize this object from a vector of FileSpecs
-  FileSpecList(std::vector &&rhs) : m_files(std::move(rhs)) {}
+  FileSpecList(std::vector &&rhs) {
+for (auto &fs : rhs)
+  m_files.emplace_back(fs);
+  }
 
   /// Destructor.
   ~FileSpecList();
@@ -83,9 +114,11 @@ class FileSpecList {
   /// \param[in] args
   /// Arguments to create the FileSpec
   template  void EmplaceBack(Args &&...args) {
-m_files.emplace_back(std::forward(args)...);
+m_files.emplace_back(FileSpec(std::forward(args)...));
   }
 
+  void Append(FileSpecHolder &&fsh) { m_files.push_back(std::move(fsh)); }
+
   /// Clears the file list.
   void Clear();
 
@@ -175,10 +208,10 @@ class FileSpecList {
 
   bool Insert(size_t idx, const FileSpec &file) {
 if (idx < m_files.size()) {
-  m_files.insert(m_files.begin() + idx, file);
+  m_files.insert(m_files.begin() + idx, FileSpecHolder(file));
   return true;
 } else if (idx == m_files.size()) {
-  m_files.push_back(file);
+  m_files.push_back(FileSpecHolder(file));
   return true;
 }
 return false;
@@ -186,7 +219,7 @@ class FileSpecList {
 
   bool Replace(size_t idx, const FileSpec &file) {
 if (idx < m_files.size()) {
-  m_files[idx] = file;
+  m_files[idx] = FileSpecHolder(file);
   return true;
 }
 return false;
diff --git a/lldb/source/Core/ModuleList.cpp b/lldb/source/Core/ModuleList.cpp
index aa89c93c8d0521..3b6c3ea899caf7 100644
--- a/lldb/source/Core/ModuleList.cpp
+++ b/lldb/source/Core/ModuleList.cpp
@@ -164,11 +164,13 @@ void ModuleListProperties::UpdateSymlinkMappings() {
   llvm::sys::ScopedWriter lock(m_symlink_paths_mutex);
   const bool notify = false;
   m_symlink_pat

[Lldb-commits] [clang] [lldb] [flang] [llvm] [libc] [libcxx] [lld] [clang-tools-extra] [compiler-rt] [AMDGPU] Use alias scope to relax waitcounts for LDS DMA (PR #75974)

2023-12-19 Thread Stanislav Mekhanoshin via lldb-commits

rampitec wrote:

One thing to note: this alias.scope I am creating myself in the module LDS 
lowering, so I do exactly know what to expect. And then since there is this 
module LDS lowering even if any alias scope would be created before (which 
never happens, much less for an intrinsic call) it is already lost. It is lost 
along with the memory objects deleted by the lowering. That is the whole point 
of creating alias.scope metadata during the lowering: we are putting all module 
LDS into a single structure, so no AA will ever disambiguate it w/o alias scope 
info. In this situation I am the sole creator of the metadata, instructions 
carrying it, memory object accessed, and the consumer of this metadata.

At -O0 there will be no LDS lowering, but there will be no AA either. I do not 
see how to exploit it on practice.

One other thing to note here: there is also !noalias metadata generated in the 
very same place. I do not care about this because I am really searching for a 
store into this memory, which is a scope.

When I was writing code to generate this metadata I kept in mind exactly a 
scenario similar to this.

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


[Lldb-commits] [lldb] [lldb] Remove 2nd "error: " substring in output to developer (PR #72150)

2023-12-19 Thread Pete Lawrence via lldb-commits

https://github.com/PortalPete edited 
https://github.com/llvm/llvm-project/pull/72150
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [compiler-rt] [lld] [lldb] [llvm] [clang] [flang] [mlir] [libcxx] [builtins] Refactor cpu_model support to reduce #if nesting. NFCI (PR #75635)

2023-12-19 Thread Jon Roelofs via lldb-commits

jroelofs wrote:

I am surprised I haven't seen any complaints from buildbots about Andoid... 
anyway, thanks.

394e481a38c774f12c765fde7e9302d039a7cd94

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


[Lldb-commits] [compiler-rt] [lldb] [llvm] [libunwind] [clang] [flang] [clang-tools-extra] [libc] Reland the reland "[PGO][GlobalValue][LTO]In GlobalValues::getGlobalIdentifier, use semicolon as delim

2023-12-19 Thread Mingming Liu via lldb-commits

minglotus-6 wrote:

> It fails here https://lab.llvm.org/buildbot/#/builders/18/builds/13216

thanks for the report. I marked the two relevant tests as `UNSUPPORTED` in 
[commit 
85525f8](https://github.com/llvm/llvm-project/commit/85525f8fb6740a4cc117b00a238c85bda4ea01bf).

Will need to investigate and re-enable them after getting access to ppc machine 
from [gcc farm](https://gcc.gnu.org/wiki/CompileFarm)


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


[Lldb-commits] [compiler-rt] [lldb] [llvm] [libunwind] [clang] [flang] [clang-tools-extra] [libc] Reland the reland "[PGO][GlobalValue][LTO]In GlobalValues::getGlobalIdentifier, use semicolon as delim

2023-12-19 Thread Vitaly Buka via lldb-commits

vitalybuka wrote:

It fails here 
https://lab.llvm.org/buildbot/#/builders/18/builds/13216

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


[Lldb-commits] [compiler-rt] [lld] [lldb] [llvm] [clang] [flang] [mlir] [libcxx] [builtins] Refactor cpu_model support to reduce #if nesting. NFCI (PR #75635)

2023-12-19 Thread Arthur Eubanks via lldb-commits

aeubanks wrote:

still seeing Android errors
```
 [275/404] Building C object 
CMakeFiles/clang_rt.builtins-aarch64.dir/cpu_model/aarch64.c.o
 FAILED: CMakeFiles/clang_rt.builtins-aarch64.dir/cpu_model/aarch64.c.o 
 /b/s/w/ir/cache/builder/src/third_party/llvm-build/Release+Asserts/./bin/clang 
--target=aarch64-linux-android21 
--sysroot=/b/s/w/ir/cache/builder/src/third_party/llvm-build-tools/debian_bullseye_amd64_sysroot
 -DHAS_ASM_LSE -DVISIBILITY_HIDDEN  
--sysroot=/b/s/w/ir/cache/builder/src/third_party/android_toolchain/ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot
 --unwindlib=none -mbranch-protection=standard -O2 -g -DNDEBUG -fno-lto 
-std=c11 -fPIC -fno-builtin -fvisibility=hidden -fomit-frame-pointer 
-DCOMPILER_RT_HAS_FLOAT16 -MD -MT 
CMakeFiles/clang_rt.builtins-aarch64.dir/cpu_model/aarch64.c.o -MF 
CMakeFiles/clang_rt.builtins-aarch64.dir/cpu_model/aarch64.c.o.d -o 
CMakeFiles/clang_rt.builtins-aarch64.dir/cpu_model/aarch64.c.o -c 
/b/s/w/ir/cache/builder/src/third_party/llvm/compiler-rt/lib/builtins/cpu_model/aarch64.c
 clang: warning: argument unused during compilation: '--unwindlib=none' 
[-Wunused-command-line-argument]
 In file included from 
/b/s/w/ir/cache/builder/src/third_party/llvm/compiler-rt/lib/builtins/cpu_model/aarch64.c:41:
 
/b/s/w/ir/cache/builder/src/third_party/llvm/compiler-rt/lib/builtins/cpu_model/aarch64/lse_atomics/android.inc:6:3:
 error: void function '__isExynos9810' should not return a value [-Wreturn-type]
 6 |   return __system_property_get("ro.arch", arch) > 0 &&
   |   ^  ~
 7 | strncmp(arch, "exynos9810", sizeof("exynos9810") - 1) == 0;
   | ~~
 
/b/s/w/ir/cache/builder/src/third_party/llvm/compiler-rt/lib/builtins/cpu_model/aarch64/lse_atomics/android.inc:11:25:
 error: call to undeclared function 'getauxval'; ISO C99 and later do not 
support implicit function declarations [-Wimplicit-function-declaration]
11 |   unsigned long hwcap = getauxval(AT_HWCAP);
   | ^
 
/b/s/w/ir/cache/builder/src/third_party/llvm/compiler-rt/lib/builtins/cpu_model/aarch64/lse_atomics/android.inc:11:35:
 error: use of undeclared identifier 'AT_HWCAP'
11 |   unsigned long hwcap = getauxval(AT_HWCAP);
   |   ^
 
/b/s/w/ir/cache/builder/src/third_party/llvm/compiler-rt/lib/builtins/cpu_model/aarch64/lse_atomics/android.inc:12:27:
 error: use of undeclared identifier 'HWCAP_ATOMICS'
12 |   _Bool result = (hwcap & HWCAP_ATOMICS) != 0;
   |   ^
 
/b/s/w/ir/cache/builder/src/third_party/llvm/compiler-rt/lib/builtins/cpu_model/aarch64/lse_atomics/android.inc:23:5:
 error: statement requires expression of scalar type ('void' invalid)
23 | if (__isExynos9810())
   | ^   
 In file included from 
/b/s/w/ir/cache/builder/src/third_party/llvm/compiler-rt/lib/builtins/cpu_model/aarch64.c:135:
 In file included from 
/b/s/w/ir/cache/builder/src/third_party/llvm/compiler-rt/lib/builtins/cpu_model/aarch64/fmv/mrs.inc:2:
 
/b/s/w/ir/cache/builder/src/third_party/android_toolchain/ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/sys/auxv.h:53:19:
 error: conflicting types for 'getauxval'
53 | unsigned long int getauxval(unsigned long int __type) 
__INTRODUCED_IN(18);
   |   ^
 
/b/s/w/ir/cache/builder/src/third_party/llvm/compiler-rt/lib/builtins/cpu_model/aarch64/lse_atomics/android.inc:11:25:
 note: previous implicit declaration is here
11 |   unsigned long hwcap = getauxval(AT_HWCAP);
   | ^
 In file included from 
/b/s/w/ir/cache/builder/src/third_party/llvm/compiler-rt/lib/builtins/cpu_model/aarch64.c:136:
 
/b/s/w/ir/cache/builder/src/third_party/llvm/compiler-rt/lib/builtins/cpu_model/aarch64/fmv/android.inc:25:3:
 error: statement requires expression of scalar type ('void' invalid)
25 |   if (__isExynos9810())
   |   ^   
 7 errors generated.
```


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


[Lldb-commits] [lldb] [lldb] In-progress — All ValueObjectSP instances are now valid (non-null) but have an error state (PR #74912)

2023-12-19 Thread Pete Lawrence via lldb-commits

PortalPete wrote:

> > ### Goal
> > Every `ValueObjectSP` will have an actual value and will never be equal to 
> > `nullptr`.
> 
> I would like to learn more about the goal. It seems like the existing code 
> will result in widespread use of `optional>`. Is the 
> plan to reduce these cases to a smaller amount? If not, then it's not clear 
> to me how having the codebase predominantly use 
> `optional>` is better than mostly using 
> `shared_ptr`. Is this refactoring a known (named) pattern? Are 
> there other examples of where a `shared_ptr` is replaced with 
> `optional>`?

I believe this is a step towards using `class [[nodiscard]] Expected`, which 
@adrian-prantl can probably explain better than I can.

The reasoning behind the goal comes from all the places callers of these 
methods _only_ checking against `nullptr` when they should be checking its 
underlying error state (with `→GetError()`).

This change takes away the ability to use an `ValueObjectSP` instance as a 
Boolean, which lets the compiler tell us all the places where the code is doing 
just that, some of which are ok, and thee other places where it's not ok. 
Similarly, the hope is this restriction gets people in the habit of checking 
the value object's error state going forward.

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


[Lldb-commits] [lldb] [lldb] In-progress — All ValueObjectSP instances are now valid (non-null) but have an error state (PR #74912)

2023-12-19 Thread Greg Clayton via lldb-commits

clayborg wrote:

> > ### Goal
> > Every `ValueObjectSP` will have an actual value and will never be equal to 
> > `nullptr`.
> 
> I would like to learn more about the goal. It seems like the existing code 
> will result in widespread use of `optional>`. Is the 
> plan to reduce these cases to a smaller amount? If not, then it's not clear 
> to me how having the codebase predominantly use 
> `optional>` is better than mostly using 
> `shared_ptr`. Is this refactoring a known (named) pattern? Are 
> there other examples of where a `shared_ptr` is replaced with 
> `optional>`?

I agree. Returning a empty shared pointer is better than adding std:optional on 
top of that. Hopefully we can avoid that.

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


[Lldb-commits] [lldb] [lldb] In-progress — All ValueObjectSP instances are now valid (non-null) but have an error state (PR #74912)

2023-12-19 Thread Dave Lee via lldb-commits

kastiglione wrote:

> ### Goal
>
> Every `ValueObjectSP` will have an actual value and will never be equal to 
> `nullptr`.

I would like to learn more about the goal. It seems like the existing code will 
result in widespread use of `optional>`. Is the plan to 
reduce these cases to a smaller amount? If not, then it's not clear to me how 
having the codebase predominantly use `optional>` is 
better than mostly using `shared_ptr`. Is this refactoring a known 
(named) pattern? Are there other examples of where a `shared_ptr` is 
replaced with `optional>`?

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


[Lldb-commits] [lldb] [lldb] In-progress — All ValueObjectSP instances are now valid (non-null) but have an error state (PR #74912)

2023-12-19 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Pete Lawrence (PortalPete)


Changes

### Purpose
For now, we'd like to get people's thought's on the goal, design, and scope of 
this PR by reviewing these preliminary changes.

I recommend focussing (or starting) on these files:
* `ValueObject.h`
* `ValueObject.cpp`


### Goal
Every `ValueObjectSP` will have an actual value and will never be equal to 
`nullptr`.


### Design
To force each `ValueObjectSP` to contain _something_, we're considering 
changing the type from a typedef…
```cpp
typedef std::shared_ptr ValueObjectSP;

```

to this subclass:
```cpp
class ValueObjectSP : public std::shared_ptr {
  ValueObjectSP() = delete;
  operator bool() = delete;

public:
  ValueObjectSP(std::shared_ptr 
&&pointer)
  : std::shared_ptr(std::move(pointer)) {
assert(pointer);
  }
};
```

This class removes the default constructor to force each `ValueObjectSP` to 
point to a real `ValueObject` instance. It also removes `operator bool()` 
because no instance will ever equal `nullptr`. 


### Change Patterns
The bulk of the changes into one of these two camps:
1. For methods that have a `Status &error` parameter **and** return an 
`ValueObjectSP`, the return value *becomes* the container for the error state, 
which eliminate the need for a parameter.
* This means that callers of these methods need to check the return value's 
error state.
  * `return_value->GetError.Success()`
  * `return_value->GetError.Fail()`

2. For all other methods that return a `ValueObjectSP` but don't have a `Status 
&` parameter, they now return `std::optional`.
* This changes a fair amount of code in these ways:
  * Code which had been using the `std::shared_ptr` Boolean operator now uses 
the `std::optional` Boolean operator.
  * Nearby code has to call the optional's `value()` method to get the shared 
pointer inside.
  * Methods with lines that return `ValueObjectSP()` now return `{}`, which 
creates an optional with nothing in it.

Again, I recommend focussing (or starting) on these files:
* `ValueObject.h`
* `ValueObject.cpp`


### Remaining work
This is very much a work-in-progress for a proof of concept, which means:
* It doesn't compile (yet)
* So far I've modified 53 files
* I estimate another 100-250 more files need to change based on the ninja build 
progress indicator.

The remaining changes will just be more of the same but now's a good time to 
take a look at this sample to get a sense of the magnitude and trajectory of 
the remaining changes.

---

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


53 Files Affected:

- (modified) lldb/include/lldb/Breakpoint/Watchpoint.h (+2-2) 
- (modified) lldb/include/lldb/Core/ValueObject.h (+43-34) 
- (modified) lldb/include/lldb/Core/ValueObjectConstResult.h (+4-4) 
- (modified) lldb/include/lldb/Core/ValueObjectConstResultCast.h (+3-3) 
- (modified) lldb/include/lldb/Core/ValueObjectConstResultChild.h (+3-3) 
- (modified) lldb/include/lldb/Core/ValueObjectConstResultImpl.h (+4-4) 
- (modified) lldb/include/lldb/Core/ValueObjectList.h (+10-7) 
- (modified) lldb/include/lldb/Core/ValueObjectRegister.h (+2-2) 
- (modified) lldb/include/lldb/Core/ValueObjectSyntheticFilter.h (+5-5) 
- (modified) lldb/include/lldb/Core/ValueObjectUpdater.h (+3-3) 
- (modified) lldb/include/lldb/DataFormatters/TypeSynthetic.h (+12-10) 
- (modified) lldb/include/lldb/DataFormatters/ValueObjectPrinter.h (+2-1) 
- (modified) lldb/include/lldb/DataFormatters/VectorIterator.h (+1-1) 
- (modified) lldb/include/lldb/Expression/ExpressionVariable.h (+37-16) 
- (modified) lldb/include/lldb/Expression/UserExpression.h (+1-1) 
- (modified) lldb/include/lldb/Interpreter/ScriptInterpreter.h (+4-4) 
- (modified) lldb/include/lldb/Target/LanguageRuntime.h (+3-3) 
- (modified) lldb/include/lldb/Target/StackFrame.h (+6-6) 
- (modified) lldb/include/lldb/Target/StackFrameRecognizer.h (+1-3) 
- (modified) lldb/include/lldb/Target/Target.h (+1-1) 
- (modified) lldb/include/lldb/Target/Thread.h (+2-2) 
- (modified) lldb/include/lldb/Target/ThreadPlan.h (+2-2) 
- (modified) lldb/include/lldb/Target/ThreadPlanCallFunction.h (+1-1) 
- (modified) lldb/include/lldb/lldb-forward.h (+19-1) 
- (modified) lldb/source/Breakpoint/BreakpointLocation.cpp (+2-4) 
- (modified) lldb/source/Breakpoint/Watchpoint.cpp (+13-9) 
- (modified) lldb/source/Commands/CommandObjectDWIMPrint.cpp (+12-11) 
- (modified) lldb/source/Commands/CommandObjectExpression.cpp (+14-11) 
- (modified) lldb/source/Commands/CommandObjectFrame.cpp (+19-17) 
- (modified) lldb/source/Commands/CommandObjectMemory.cpp (+9-16) 
- (modified) lldb/source/Commands/CommandObjectTarget.cpp (+3-4) 
- (modified) lldb/source/Commands/CommandObjectThread.cpp (+5-10) 
- (modified) lldb/source/Commands/CommandObjectType.cpp (+7-5) 
- 

[Lldb-commits] [lldb] [lldb] In-progress — All ValueObjectSP instances are now valid (non-null) but have an error state (PR #74912)

2023-12-19 Thread Pete Lawrence via lldb-commits

https://github.com/PortalPete ready_for_review 
https://github.com/llvm/llvm-project/pull/74912
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] In-progress — All ValueObjectSP instances are now valid (non-null) but have an error state (PR #74912)

2023-12-19 Thread Pete Lawrence via lldb-commits

https://github.com/PortalPete edited 
https://github.com/llvm/llvm-project/pull/74912
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] DRAFT All ValueObjectSP instances are now valid (non-null) but have an error state (PR #74912)

2023-12-19 Thread Pete Lawrence via lldb-commits

https://github.com/PortalPete edited 
https://github.com/llvm/llvm-project/pull/74912
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] 8ddf98a - [lldb] Remove unused GetChildAtIndexPath(...) methods from ValueObject.cpp (#75870)

2023-12-19 Thread via lldb-commits

Author: Pete Lawrence
Date: 2023-12-19T15:00:56-08:00
New Revision: 8ddf98ad4bb14867987b48a37dd29750c665112f

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

LOG: [lldb] Remove unused GetChildAtIndexPath(...) methods from ValueObject.cpp 
(#75870)

This a follow-up PR from this other one:
https://github.com/llvm/llvm-project/pull/74413

Nothing calls into these two methods, so we (@DavidSpickett,
@adrian-prantl, and I) agreed to remove them once we merged the previous
PR.

Added: 


Modified: 
lldb/include/lldb/Core/ValueObject.h
lldb/source/Core/ValueObject.cpp

Removed: 




diff  --git a/lldb/include/lldb/Core/ValueObject.h 
b/lldb/include/lldb/Core/ValueObject.h
index a158199e7fab1a..3f8005ba696ce8 100644
--- a/lldb/include/lldb/Core/ValueObject.h
+++ b/lldb/include/lldb/Core/ValueObject.h
@@ -468,14 +468,6 @@ class ValueObject {
   virtual lldb::ValueObjectSP GetChildAtIndex(size_t idx,
   bool can_create = true);
 
-  // The method always creates missing children in the path, if necessary.
-  lldb::ValueObjectSP GetChildAtIndexPath(llvm::ArrayRef idxs,
-  size_t *index_of_error = nullptr);
-
-  lldb::ValueObjectSP
-  GetChildAtIndexPath(llvm::ArrayRef> idxs,
-  size_t *index_of_error = nullptr);
-
   // The method always creates missing children in the path, if necessary.
   lldb::ValueObjectSP GetChildAtNamePath(llvm::ArrayRef 
names);
 

diff  --git a/lldb/source/Core/ValueObject.cpp 
b/lldb/source/Core/ValueObject.cpp
index b82e6082eebddf..b2a6d9412ab40b 100644
--- a/lldb/source/Core/ValueObject.cpp
+++ b/lldb/source/Core/ValueObject.cpp
@@ -392,46 +392,6 @@ ValueObjectSP ValueObject::GetChildAtIndex(size_t idx, 
bool can_create) {
   return child_sp;
 }
 
-lldb::ValueObjectSP
-ValueObject::GetChildAtIndexPath(llvm::ArrayRef idxs,
- size_t *index_of_error) {
-  if (idxs.size() == 0)
-return GetSP();
-  ValueObjectSP root(GetSP());
-
-  size_t current_index = 0;
-  for (size_t idx : idxs) {
-root = root->GetChildAtIndex(idx);
-if (!root) {
-  if (index_of_error)
-*index_of_error = current_index;
-  return root;
-}
-current_index += 1;
-  }
-  return root;
-}
-
-lldb::ValueObjectSP ValueObject::GetChildAtIndexPath(
-  llvm::ArrayRef> idxs, size_t *index_of_error) {
-  if (idxs.size() == 0)
-return GetSP();
-  ValueObjectSP root(GetSP());
-
-  size_t current_index = 0;
-  for (std::pair idx : idxs) {
-root = root->GetChildAtIndex(idx.first, idx.second);
-if (!root) {
-  if (index_of_error)
-*index_of_error = current_index;
-  return root;
-}
-
-current_index += 1;
-  }
-  return root;
-}
-
 lldb::ValueObjectSP
 ValueObject::GetChildAtNamePath(llvm::ArrayRef names) {
   if (names.size() == 0)



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


[Lldb-commits] [lldb] [lldb] Remove unused GetChildAtIndexPath(...) methods from ValueObject.cpp (PR #75870)

2023-12-19 Thread Adrian Prantl via lldb-commits

https://github.com/adrian-prantl closed 
https://github.com/llvm/llvm-project/pull/75870
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [DRAFT] Add support for inline DWARF source files. (PR #75880)

2023-12-19 Thread Adrian Prantl via lldb-commits

https://github.com/adrian-prantl edited 
https://github.com/llvm/llvm-project/pull/75880
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [DRAFT] Add support for inline DWARF source files. (PR #75880)

2023-12-19 Thread Adrian Prantl via lldb-commits


@@ -38,7 +65,10 @@ class FileSpecList {
   FileSpecList(FileSpecList &&rhs) = default;
 
   /// Initialize this object from a vector of FileSpecs
-  FileSpecList(std::vector &&rhs) : m_files(std::move(rhs)) {}
+  FileSpecList(std::vector &&rhs) {
+for (auto &fs : rhs)
+  m_files.emplace_back(fs);

adrian-prantl wrote:

Yes: one is a vector the other a vector

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


[Lldb-commits] [lld] [compiler-rt] [flang] [libc] [libcxx] [llvm] [clang] [lldb] [clang-tools-extra] [AMDGPU] Use alias scope to relax waitcounts for LDS DMA (PR #75974)

2023-12-19 Thread Stanislav Mekhanoshin via lldb-commits

https://github.com/rampitec updated 
https://github.com/llvm/llvm-project/pull/75974

>From 7e382620cdc5999c645ed0746f242595f0294c58 Mon Sep 17 00:00:00 2001
From: Stanislav Mekhanoshin 
Date: Mon, 4 Dec 2023 16:11:53 -0800
Subject: [PATCH 01/12] [AMDGPU] Use alias info to relax waitcounts for LDS DMA

LDA DMA loads increase VMCNT and a load from the LDS stored must
wait on this counter to only read memory after it is written.
Wait count insertion pass does not track memory dependencies, it
tracks register dependencies. To model the LDS dependency a
psuedo register is used in the scoreboard, acting like if LDS DMA
writes it and LDS load reads it.

This patch adds 8 more pseudo registers to use for independent LDS
locations if we can prove they are disjoint using alias analysis.

Fixes: SWDEV-433427
---
 llvm/lib/Target/AMDGPU/SIISelLowering.cpp   |  16 +-
 llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp |  73 +-
 llvm/lib/Target/AMDGPU/SIInstrInfo.cpp  |   4 +-
 llvm/lib/Target/AMDGPU/SIInstrInfo.h|   8 +
 llvm/lib/Target/AMDGPU/lds-dma-waits.ll | 154 
 llvm/test/CodeGen/AMDGPU/llc-pipeline.ll|   2 +
 6 files changed, 241 insertions(+), 16 deletions(-)
 create mode 100644 llvm/lib/Target/AMDGPU/lds-dma-waits.ll

diff --git a/llvm/lib/Target/AMDGPU/SIISelLowering.cpp 
b/llvm/lib/Target/AMDGPU/SIISelLowering.cpp
index a7f4d63229b7ef..2e079404b087fa 100644
--- a/llvm/lib/Target/AMDGPU/SIISelLowering.cpp
+++ b/llvm/lib/Target/AMDGPU/SIISelLowering.cpp
@@ -1128,11 +1128,10 @@ bool SITargetLowering::getTgtMemIntrinsic(IntrinsicInfo 
&Info,
 MachineMemOperand::MOStore |
 MachineMemOperand::MODereferenceable;
 
-  // XXX - Should this be volatile without known ordering?
-  Info.flags |= MachineMemOperand::MOVolatile;
-
   switch (IntrID) {
   default:
+// XXX - Should this be volatile without known ordering?
+Info.flags |= MachineMemOperand::MOVolatile;
 break;
   case Intrinsic::amdgcn_raw_buffer_load_lds:
   case Intrinsic::amdgcn_raw_ptr_buffer_load_lds:
@@ -1140,6 +1139,7 @@ bool SITargetLowering::getTgtMemIntrinsic(IntrinsicInfo 
&Info,
   case Intrinsic::amdgcn_struct_ptr_buffer_load_lds: {
 unsigned Width = 
cast(CI.getArgOperand(2))->getZExtValue();
 Info.memVT = EVT::getIntegerVT(CI.getContext(), Width * 8);
+Info.ptrVal = CI.getArgOperand(1);
 return true;
   }
   }
@@ -1268,8 +1268,8 @@ bool SITargetLowering::getTgtMemIntrinsic(IntrinsicInfo 
&Info,
 Info.opc = ISD::INTRINSIC_VOID;
 unsigned Width = cast(CI.getArgOperand(2))->getZExtValue();
 Info.memVT = EVT::getIntegerVT(CI.getContext(), Width * 8);
-Info.flags |= MachineMemOperand::MOLoad | MachineMemOperand::MOStore |
-  MachineMemOperand::MOVolatile;
+Info.ptrVal = CI.getArgOperand(1);
+Info.flags |= MachineMemOperand::MOLoad | MachineMemOperand::MOStore;
 return true;
   }
   case Intrinsic::amdgcn_ds_bvh_stack_rtn: {
@@ -9084,7 +9084,9 @@ SDValue SITargetLowering::LowerINTRINSIC_VOID(SDValue Op,
 MachinePointerInfo LoadPtrI = LoadMMO->getPointerInfo();
 
 MachinePointerInfo StorePtrI = LoadPtrI;
-StorePtrI.V = nullptr;
+LoadPtrI.V = UndefValue::get(
+PointerType::get(*DAG.getContext(), AMDGPUAS::GLOBAL_ADDRESS));
+LoadPtrI.AddrSpace = AMDGPUAS::GLOBAL_ADDRESS;
 StorePtrI.AddrSpace = AMDGPUAS::LOCAL_ADDRESS;
 
 auto F = LoadMMO->getFlags() &
@@ -9162,6 +9164,8 @@ SDValue SITargetLowering::LowerINTRINSIC_VOID(SDValue Op,
 MachinePointerInfo LoadPtrI = LoadMMO->getPointerInfo();
 LoadPtrI.Offset = Op->getConstantOperandVal(5);
 MachinePointerInfo StorePtrI = LoadPtrI;
+LoadPtrI.V = UndefValue::get(
+PointerType::get(*DAG.getContext(), AMDGPUAS::GLOBAL_ADDRESS));
 LoadPtrI.AddrSpace = AMDGPUAS::GLOBAL_ADDRESS;
 StorePtrI.AddrSpace = AMDGPUAS::LOCAL_ADDRESS;
 auto F = LoadMMO->getFlags() &
diff --git a/llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp 
b/llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp
index ede4841b8a5fd7..50ad22130e939e 100644
--- a/llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp
+++ b/llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp
@@ -31,6 +31,7 @@
 #include "llvm/ADT/MapVector.h"
 #include "llvm/ADT/PostOrderIterator.h"
 #include "llvm/ADT/Sequence.h"
+#include "llvm/Analysis/AliasAnalysis.h"
 #include "llvm/CodeGen/MachineLoopInfo.h"
 #include "llvm/CodeGen/MachinePostDominators.h"
 #include "llvm/InitializePasses.h"
@@ -121,8 +122,13 @@ enum RegisterMapping {
   SQ_MAX_PGM_VGPRS = 512, // Maximum programmable VGPRs across all targets.
   AGPR_OFFSET = 256,  // Maximum programmable ArchVGPRs across all targets.
   SQ_MAX_PGM_SGPRS = 256, // Maximum programmable SGPRs across all targets.
-  NUM_EXTRA_VGPRS = 1,// A reserved slot for DS.
-  EXTRA_VGPR_LDS = 0, // An artificial register to track LDS writes.
+  NUM_EXTRA_VGPRS = 9,// Reserved slots

[Lldb-commits] [lld] [compiler-rt] [flang] [libc] [libcxx] [llvm] [clang] [lldb] [clang-tools-extra] [AMDGPU] Use alias scope to relax waitcounts for LDS DMA (PR #75974)

2023-12-19 Thread via lldb-commits

github-actions[bot] wrote:




:warning: C/C++ code formatter, clang-format found issues in your code. 
:warning:



You can test this locally with the following command:


``bash
git-clang-format --diff b3d024c6737adb87e83193de88af04ec74ddf3ea 
154ab4f551b5f0bf83e016ebb6fa8516be67fc31 -- 
llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp
``





View the diff from clang-format here.


``diff
diff --git a/llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp 
b/llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp
index f931c94497..63646e8679 100644
--- a/llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp
+++ b/llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp
@@ -302,9 +302,7 @@ public:
 PendingEvents |= WaitEventMaskForInst[VS_CNT];
   }
 
-  ArrayRef getLDSDMAScopes() const {
-return LDSDMAScopes;
-  }
+  ArrayRef getLDSDMAScopes() const { return LDSDMAScopes; }
 
   void print(raw_ostream &);
   void dump() { print(dbgs()); }

``




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


[Lldb-commits] [lld] [compiler-rt] [flang] [libc] [libcxx] [llvm] [clang] [lldb] [clang-tools-extra] [AMDGPU] Use alias info to relax waitcounts for LDS DMA (PR #74537)

2023-12-19 Thread Stanislav Mekhanoshin via lldb-commits

rampitec wrote:

Actually since I am only using alias scope I can avoid all alias analysis 
altogether and only compare alias scope. This does not need an analysis pass, 
calls to mayAlias, and in general simpler code. You can see an alternative PR 
if you like it more: https://github.com/llvm/llvm-project/pull/75974

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


[Lldb-commits] [lld] [compiler-rt] [flang] [libc] [libcxx] [llvm] [clang] [lldb] [clang-tools-extra] [AMDGPU] Use alias scope to relax waitcounts for LDS DMA (PR #75974)

2023-12-19 Thread Stanislav Mekhanoshin via lldb-commits

https://github.com/rampitec created 
https://github.com/llvm/llvm-project/pull/75974

LDA DMA loads increase VMCNT and a load from the LDS stored must
wait on this counter to only read memory after it is written.
Wait count insertion pass does not track memory dependencies, it
tracks register dependencies. To model the LDS dependency a pseudo
register is used in the scoreboard, acting like if LDS DMA writes
it and LDS load reads it.

This patch adds 8 more pseudo registers to use for independent LDS
locations if we can prove they are disjoint using alias scope info.

Fixes: SWDEV-433427

>From 7e382620cdc5999c645ed0746f242595f0294c58 Mon Sep 17 00:00:00 2001
From: Stanislav Mekhanoshin 
Date: Mon, 4 Dec 2023 16:11:53 -0800
Subject: [PATCH 01/11] [AMDGPU] Use alias info to relax waitcounts for LDS DMA

LDA DMA loads increase VMCNT and a load from the LDS stored must
wait on this counter to only read memory after it is written.
Wait count insertion pass does not track memory dependencies, it
tracks register dependencies. To model the LDS dependency a
psuedo register is used in the scoreboard, acting like if LDS DMA
writes it and LDS load reads it.

This patch adds 8 more pseudo registers to use for independent LDS
locations if we can prove they are disjoint using alias analysis.

Fixes: SWDEV-433427
---
 llvm/lib/Target/AMDGPU/SIISelLowering.cpp   |  16 +-
 llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp |  73 +-
 llvm/lib/Target/AMDGPU/SIInstrInfo.cpp  |   4 +-
 llvm/lib/Target/AMDGPU/SIInstrInfo.h|   8 +
 llvm/lib/Target/AMDGPU/lds-dma-waits.ll | 154 
 llvm/test/CodeGen/AMDGPU/llc-pipeline.ll|   2 +
 6 files changed, 241 insertions(+), 16 deletions(-)
 create mode 100644 llvm/lib/Target/AMDGPU/lds-dma-waits.ll

diff --git a/llvm/lib/Target/AMDGPU/SIISelLowering.cpp 
b/llvm/lib/Target/AMDGPU/SIISelLowering.cpp
index a7f4d63229b7ef..2e079404b087fa 100644
--- a/llvm/lib/Target/AMDGPU/SIISelLowering.cpp
+++ b/llvm/lib/Target/AMDGPU/SIISelLowering.cpp
@@ -1128,11 +1128,10 @@ bool SITargetLowering::getTgtMemIntrinsic(IntrinsicInfo 
&Info,
 MachineMemOperand::MOStore |
 MachineMemOperand::MODereferenceable;
 
-  // XXX - Should this be volatile without known ordering?
-  Info.flags |= MachineMemOperand::MOVolatile;
-
   switch (IntrID) {
   default:
+// XXX - Should this be volatile without known ordering?
+Info.flags |= MachineMemOperand::MOVolatile;
 break;
   case Intrinsic::amdgcn_raw_buffer_load_lds:
   case Intrinsic::amdgcn_raw_ptr_buffer_load_lds:
@@ -1140,6 +1139,7 @@ bool SITargetLowering::getTgtMemIntrinsic(IntrinsicInfo 
&Info,
   case Intrinsic::amdgcn_struct_ptr_buffer_load_lds: {
 unsigned Width = 
cast(CI.getArgOperand(2))->getZExtValue();
 Info.memVT = EVT::getIntegerVT(CI.getContext(), Width * 8);
+Info.ptrVal = CI.getArgOperand(1);
 return true;
   }
   }
@@ -1268,8 +1268,8 @@ bool SITargetLowering::getTgtMemIntrinsic(IntrinsicInfo 
&Info,
 Info.opc = ISD::INTRINSIC_VOID;
 unsigned Width = cast(CI.getArgOperand(2))->getZExtValue();
 Info.memVT = EVT::getIntegerVT(CI.getContext(), Width * 8);
-Info.flags |= MachineMemOperand::MOLoad | MachineMemOperand::MOStore |
-  MachineMemOperand::MOVolatile;
+Info.ptrVal = CI.getArgOperand(1);
+Info.flags |= MachineMemOperand::MOLoad | MachineMemOperand::MOStore;
 return true;
   }
   case Intrinsic::amdgcn_ds_bvh_stack_rtn: {
@@ -9084,7 +9084,9 @@ SDValue SITargetLowering::LowerINTRINSIC_VOID(SDValue Op,
 MachinePointerInfo LoadPtrI = LoadMMO->getPointerInfo();
 
 MachinePointerInfo StorePtrI = LoadPtrI;
-StorePtrI.V = nullptr;
+LoadPtrI.V = UndefValue::get(
+PointerType::get(*DAG.getContext(), AMDGPUAS::GLOBAL_ADDRESS));
+LoadPtrI.AddrSpace = AMDGPUAS::GLOBAL_ADDRESS;
 StorePtrI.AddrSpace = AMDGPUAS::LOCAL_ADDRESS;
 
 auto F = LoadMMO->getFlags() &
@@ -9162,6 +9164,8 @@ SDValue SITargetLowering::LowerINTRINSIC_VOID(SDValue Op,
 MachinePointerInfo LoadPtrI = LoadMMO->getPointerInfo();
 LoadPtrI.Offset = Op->getConstantOperandVal(5);
 MachinePointerInfo StorePtrI = LoadPtrI;
+LoadPtrI.V = UndefValue::get(
+PointerType::get(*DAG.getContext(), AMDGPUAS::GLOBAL_ADDRESS));
 LoadPtrI.AddrSpace = AMDGPUAS::GLOBAL_ADDRESS;
 StorePtrI.AddrSpace = AMDGPUAS::LOCAL_ADDRESS;
 auto F = LoadMMO->getFlags() &
diff --git a/llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp 
b/llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp
index ede4841b8a5fd7..50ad22130e939e 100644
--- a/llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp
+++ b/llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp
@@ -31,6 +31,7 @@
 #include "llvm/ADT/MapVector.h"
 #include "llvm/ADT/PostOrderIterator.h"
 #include "llvm/ADT/Sequence.h"
+#include "llvm/Analysis/AliasAnalysis.h"
 #include "llvm/CodeGen/MachineLoopInfo.h"
 #include "llvm/CodeGen/Mac

[Lldb-commits] [lldb] [lldb] DRAFT All ValueObjectSP instances are now valid (non-null) but have an error state (PR #74912)

2023-12-19 Thread via lldb-commits

github-actions[bot] wrote:




:warning: C/C++ code formatter, clang-format found issues in your code. 
:warning:



You can test this locally with the following command:


``bash
git-clang-format --diff c8418c4a19dac494069559918b3e4ea505ddf148 
63b1cca8660e40d612e43496d3ff07c48bafa628 -- 
lldb/include/lldb/Breakpoint/Watchpoint.h lldb/include/lldb/Core/ValueObject.h 
lldb/include/lldb/Core/ValueObjectConstResult.h 
lldb/include/lldb/Core/ValueObjectConstResultCast.h 
lldb/include/lldb/Core/ValueObjectConstResultChild.h 
lldb/include/lldb/Core/ValueObjectConstResultImpl.h 
lldb/include/lldb/Core/ValueObjectList.h 
lldb/include/lldb/Core/ValueObjectRegister.h 
lldb/include/lldb/Core/ValueObjectSyntheticFilter.h 
lldb/include/lldb/Core/ValueObjectUpdater.h 
lldb/include/lldb/DataFormatters/TypeSynthetic.h 
lldb/include/lldb/DataFormatters/ValueObjectPrinter.h 
lldb/include/lldb/DataFormatters/VectorIterator.h 
lldb/include/lldb/Expression/ExpressionVariable.h 
lldb/include/lldb/Expression/UserExpression.h 
lldb/include/lldb/Interpreter/ScriptInterpreter.h 
lldb/include/lldb/Target/LanguageRuntime.h 
lldb/include/lldb/Target/StackFrame.h 
lldb/include/lldb/Target/StackFrameRecognizer.h 
lldb/include/lldb/Target/Target.h lldb/include/lldb/Target/Thread.h 
lldb/include/lldb/Target/ThreadPlan.h 
lldb/include/lldb/Target/ThreadPlanCallFunction.h 
lldb/include/lldb/lldb-forward.h lldb/source/Breakpoint/BreakpointLocation.cpp 
lldb/source/Breakpoint/Watchpoint.cpp 
lldb/source/Commands/CommandObjectDWIMPrint.cpp 
lldb/source/Commands/CommandObjectExpression.cpp 
lldb/source/Commands/CommandObjectFrame.cpp 
lldb/source/Commands/CommandObjectMemory.cpp 
lldb/source/Commands/CommandObjectTarget.cpp 
lldb/source/Commands/CommandObjectThread.cpp 
lldb/source/Commands/CommandObjectType.cpp 
lldb/source/Commands/CommandObjectWatchpoint.cpp 
lldb/source/Core/FormatEntity.cpp lldb/source/Core/IOHandlerCursesGUI.cpp 
lldb/source/Core/ValueObject.cpp lldb/source/Core/ValueObjectConstResult.cpp 
lldb/source/Core/ValueObjectConstResultCast.cpp 
lldb/source/Core/ValueObjectConstResultChild.cpp 
lldb/source/Core/ValueObjectConstResultImpl.cpp 
lldb/source/Core/ValueObjectList.cpp lldb/source/Core/ValueObjectRegister.cpp 
lldb/source/Core/ValueObjectSyntheticFilter.cpp 
lldb/source/Core/ValueObjectUpdater.cpp 
lldb/source/DataFormatters/FormatManager.cpp 
lldb/source/DataFormatters/TypeSynthetic.cpp 
lldb/source/DataFormatters/ValueObjectPrinter.cpp 
lldb/source/DataFormatters/VectorType.cpp 
lldb/source/Expression/ExpressionVariable.cpp lldb/source/Target/StackFrame.cpp 
lldb/source/Target/Target.cpp lldb/source/Target/Thread.cpp
``





View the diff from clang-format here.


``diff
diff --git a/lldb/include/lldb/Core/ValueObjectList.h 
b/lldb/include/lldb/Core/ValueObjectList.h
index 237363d67a..42b7d64d6a 100644
--- a/lldb/include/lldb/Core/ValueObjectList.h
+++ b/lldb/include/lldb/Core/ValueObjectList.h
@@ -53,6 +53,7 @@ public:
   const std::vector> &GetObjects() const {
 return m_value_objects;
   }
+
 protected:
   typedef std::vector> collection;
   // Classes that inherit from ValueObjectList can see and modify these
diff --git a/lldb/include/lldb/DataFormatters/ValueObjectPrinter.h 
b/lldb/include/lldb/DataFormatters/ValueObjectPrinter.h
index fd8323728b..70175e347d 100644
--- a/lldb/include/lldb/DataFormatters/ValueObjectPrinter.h
+++ b/lldb/include/lldb/DataFormatters/ValueObjectPrinter.h
@@ -101,7 +101,8 @@ protected:
 
   void PrintChildrenPostamble(bool print_dotdotdot);
 
-  std::optional GenerateChild(ValueObject *synth_valobj, 
size_t idx);
+  std::optional GenerateChild(ValueObject *synth_valobj,
+   size_t idx);
 
   void PrintChild(lldb::ValueObjectSP child_sp,
   const DumpValueObjectOptions::PointerDepth &curr_ptr_depth);
diff --git a/lldb/include/lldb/Expression/ExpressionVariable.h 
b/lldb/include/lldb/Expression/ExpressionVariable.h
index f81a52032e..83643878c4 100644
--- a/lldb/include/lldb/Expression/ExpressionVariable.h
+++ b/lldb/include/lldb/Expression/ExpressionVariable.h
@@ -33,24 +33,25 @@ public:
 
   virtual ~ExpressionVariable() = default;
 
-std::optional GetByteSize() {
-  if (m_frozen_sp)
-return m_frozen_sp.value()->GetByteSize();
-  else
-return {};
-}
+  std::optional GetByteSize() {
+if (m_frozen_sp)
+  return m_frozen_sp.value()->GetByteSize();
+else
+  return {};
+  }
 
   ConstString GetName() {
-return m_frozen_sp ? m_frozen_sp.value()->GetName() : ConstString(""); }
+return m_frozen_sp ? m_frozen_sp.value()->GetName() : ConstString("");
+  }
 
   std::optional GetValueObject() { return m_frozen_sp; }
 
   uint8_t *GetValueBytes();
 
-void ValueUpdated() {
-  if (m_frozen_sp)
-m_frozen_sp.value()->ValueUpdated();
-}
+  void ValueUpdated() {
+if (m_frozen_sp)
+  m_frozen

[Lldb-commits] [lldb] [lldb][Type] Add TypeQuery::SetLanguages API (PR #75926)

2023-12-19 Thread Greg Clayton via lldb-commits

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


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


[Lldb-commits] [llvm] [libunwind] [libc] [libcxx] [clang] [flang] [lldb] [clang-tools-extra] [compiler-rt] [libc++] Implement ranges::iota (PR #68494)

2023-12-19 Thread James E T Smith via lldb-commits

https://github.com/jamesETsmith updated 
https://github.com/llvm/llvm-project/pull/68494

>From c4a3ccfbad090ad8314aa8ad53092edc8d5432bc Mon Sep 17 00:00:00 2001
From: James Smith 
Date: Thu, 28 Sep 2023 10:11:15 -0400
Subject: [PATCH 01/19] [libc++] Implement ranges::iota and
 ranges::out_value_result

---
 libcxx/include/CMakeLists.txt |   2 +
 libcxx/include/__algorithm/out_value_result.h |  52 +
 libcxx/include/__numeric/ranges_iota.h|  53 +
 libcxx/include/algorithm  |   4 +
 libcxx/include/numeric|   1 +
 libcxx/include/version|   2 +-
 .../out_value_result.pass.cpp | 102 ++
 .../numeric.iota/ranges.iota.pass.cpp |  52 +
 8 files changed, 267 insertions(+), 1 deletion(-)
 create mode 100644 libcxx/include/__algorithm/out_value_result.h
 create mode 100644 libcxx/include/__numeric/ranges_iota.h
 create mode 100644 
libcxx/test/std/algorithms/algorithms.results/out_value_result.pass.cpp
 create mode 100644 
libcxx/test/std/numerics/numeric.ops/numeric.iota/ranges.iota.pass.cpp

diff --git a/libcxx/include/CMakeLists.txt b/libcxx/include/CMakeLists.txt
index 2ec755236dbaee..c6eb03f1d68e98 100644
--- a/libcxx/include/CMakeLists.txt
+++ b/libcxx/include/CMakeLists.txt
@@ -63,6 +63,7 @@ set(files
   __algorithm/next_permutation.h
   __algorithm/none_of.h
   __algorithm/nth_element.h
+  __algorithm/out_value_result.h
   __algorithm/partial_sort.h
   __algorithm/partial_sort_copy.h
   __algorithm/partition.h
@@ -561,6 +562,7 @@ set(files
   __numeric/partial_sum.h
   __numeric/pstl_reduce.h
   __numeric/pstl_transform_reduce.h
+  __numeric/ranges_iota.h
   __numeric/reduce.h
   __numeric/transform_exclusive_scan.h
   __numeric/transform_inclusive_scan.h
diff --git a/libcxx/include/__algorithm/out_value_result.h 
b/libcxx/include/__algorithm/out_value_result.h
new file mode 100644
index 00..8baffec7b9ef4d
--- /dev/null
+++ b/libcxx/include/__algorithm/out_value_result.h
@@ -0,0 +1,52 @@
+// -*- C++ -*-
+//===--===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#ifndef _LIBCPP___ALGORITHM_OUT_VALUE_RESULT_H
+#define _LIBCPP___ALGORITHM_OUT_VALUE_RESULT_H
+
+#include <__concepts/convertible_to.h>
+#include <__config>
+#include <__utility/move.h>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#  pragma GCC system_header
+#endif
+
+_LIBCPP_PUSH_MACROS
+#include <__undef_macros>
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+#if _LIBCPP_STD_VER >= 23
+
+namespace ranges {
+
+template 
+struct out_value_result {
+  _LIBCPP_NO_UNIQUE_ADDRESS _OutIter1 out;
+  _LIBCPP_NO_UNIQUE_ADDRESS _ValType1 value;
+
+  template 
+requires convertible_to && 
convertible_to
+  constexpr operator out_value_result<_OutIter2, _ValType2>() const& { return 
{out, value}; }
+
+  template 
+requires convertible_to<_OutIter1, _OutIter2> && convertible_to<_ValType1, 
_ValType2>
+  constexpr operator out_value_result<_OutIter2, _ValType2>() && { return 
{std::move(out), std::move(value)}; }
+};
+
+} // namespace ranges
+
+#endif // _LIBCPP_STD_VER >= 23
+
+_LIBCPP_END_NAMESPACE_STD
+
+_LIBCPP_POP_MACROS
+
+#endif // _LIBCPP___ALGORITHM_OUT_VALUE_RESULT_H
diff --git a/libcxx/include/__numeric/ranges_iota.h 
b/libcxx/include/__numeric/ranges_iota.h
new file mode 100644
index 00..20311a68c2a348
--- /dev/null
+++ b/libcxx/include/__numeric/ranges_iota.h
@@ -0,0 +1,53 @@
+// -*- C++ -*-
+//===--===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#ifndef _LIBCPP___NUMERIC_RANGES_IOTA_H
+#define _LIBCPP___NUMERIC_RANGES_IOTA_H
+
+#include <__algorithm/out_value_result.h>
+#include <__config>
+#include <__ranges/concepts.h>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#  pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+#if _LIBCPP_STD_VER >= 23
+namespace ranges {
+template 
+using iota_result = ranges::out_value_result<_Out, _Tp>;
+
+struct __iota_fn {
+  template  _Sent, 
weakly_incrementable _Tp>
+requires indirectly_writable<_Out, const _Tp&>
+  constexpr iota_result<_Out, _Tp> operator()(_Out __first, _Sent __last, _Tp 
__value) const {
+while (__first != __last) {
+  *__first = static_cast(__value);
+  ++__first;
+  ++__value;
+}
+return {std::move(__first), std::move(__value)};
+

[Lldb-commits] [flang] [mlir] [lldb] [compiler-rt] [llvm] [lld] [libcxx] [clang] [builtins] Refactor cpu_model support to reduce #if nesting. NFCI (PR #75635)

2023-12-19 Thread Jon Roelofs via lldb-commits

jroelofs wrote:

More follow-ups in 85d5ed81b1df, and 52e7b6f5c520

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


[Lldb-commits] [libcxx] [lldb] [compiler-rt] [clang] [llvm] [lld] [mlir] [flang] [builtins] Refactor cpu_model support to reduce #if nesting. NFCI (PR #75635)

2023-12-19 Thread Jon Roelofs via lldb-commits

jroelofs wrote:

@petrhosek oh, I see what the problem is. I'll add another follow-up shortly. 
Sorry for the noise.

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


[Lldb-commits] [flang] [clang] [lld] [lldb] [libcxx] [mlir] [llvm] [compiler-rt] [builtins] Refactor cpu_model support to reduce #if nesting. NFCI (PR #75635)

2023-12-19 Thread Petr Hosek via lldb-commits

petrhosek wrote:

We're still seeing the following error on our builders:
```
/b/s/w/ir/x/w/llvm_build/./bin/clang --target=aarch64-unknown-linux-gnu 
--sysroot=/b/s/w/ir/x/w/cipd/linux -DHAS_ASM_LSE -DVISIBILITY_HIDDEN  
--target=aarch64-unknown-linux-gnu -O2 -g -DNDEBUG -fno-lto -std=c11 -fPIC 
-fno-builtin -fvisibility=hidden -fomit-frame-pointer -DCOMPILER_RT_HAS_FLOAT16 
-MD -MT CMakeFiles/clang_rt.builtins-aarch64.dir/cpu_model/aarch64.c.o -MF 
CMakeFiles/clang_rt.builtins-aarch64.dir/cpu_model/aarch64.c.o.d -o 
CMakeFiles/clang_rt.builtins-aarch64.dir/cpu_model/aarch64.c.o -c 
/b/s/w/ir/x/w/llvm-llvm-project/compiler-rt/lib/builtins/cpu_model/aarch64.c
In file included from 
/b/s/w/ir/x/w/llvm-llvm-project/compiler-rt/lib/builtins/cpu_model/aarch64.c:43:
/b/s/w/ir/x/w/llvm-llvm-project/compiler-rt/lib/builtins/cpu_model/aarch64/lse_atomics/sysauxv.inc:5:41:
 error: use of undeclared identifier 'HWCAP_ATOMICS'
5 |   __aarch64_have_lse_atomics = (hwcap & HWCAP_ATOMICS) != 0;
  | ^
1 error generated.
```

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


[Lldb-commits] [clang-tools-extra] [libunwind] [lldb] [libc] [llvm] [clang] [compiler-rt] [flang] Reland the reland "[PGO][GlobalValue][LTO]In GlobalValues::getGlobalIdentifier, use semicolon as delim

2023-12-19 Thread Mingming Liu via lldb-commits

https://github.com/minglotus-6 closed 
https://github.com/llvm/llvm-project/pull/75954
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [clang-tools-extra] [llvm] [clang] [flang] [lldb] [IndVars] Add check of loop invariant for trunc instructions (PR #71072)

2023-12-19 Thread Florian Hahn via lldb-commits

fhahn wrote:

Looks like this is causing #75938. Please take a look

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


[Lldb-commits] [compiler-rt] [llvm] [libc] [libcxx] [lldb] [clang] [lld] [clang-tools-extra] [flang] [AMDGPU] Use alias info to relax waitcounts for LDS DMA (PR #74537)

2023-12-19 Thread Stanislav Mekhanoshin via lldb-commits

rampitec wrote:

> > This is still correct, pointer argument cannot alias module global. A 
> > pointer argument to a kernel is an LDS external requested by the host side, 
> > and host cannot see module LDS.
> 
> I.e. that is really the point of the patch: if we are able to definitively 
> identify an LDS object targeted by both load and store we only wait on that 
> store or stores. And the only way to definitively identify the object at this 
> stage is via alias.scope info which we are generating ourselves during module 
> LDS lowering.

I have added a check for the presence of alias scope info just in case we get a 
rogue AA. The testcase with a pointer argument still produces correct code with 
vmcnt(1).

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


[Lldb-commits] [clang] [libc] [lldb] [lld] [llvm] [compiler-rt] [libcxx] [flang] [clang-tools-extra] [AMDGPU] Use alias info to relax waitcounts for LDS DMA (PR #74537)

2023-12-19 Thread Stanislav Mekhanoshin via lldb-commits

https://github.com/rampitec updated 
https://github.com/llvm/llvm-project/pull/74537

>From 7e382620cdc5999c645ed0746f242595f0294c58 Mon Sep 17 00:00:00 2001
From: Stanislav Mekhanoshin 
Date: Mon, 4 Dec 2023 16:11:53 -0800
Subject: [PATCH 01/10] [AMDGPU] Use alias info to relax waitcounts for LDS DMA

LDA DMA loads increase VMCNT and a load from the LDS stored must
wait on this counter to only read memory after it is written.
Wait count insertion pass does not track memory dependencies, it
tracks register dependencies. To model the LDS dependency a
psuedo register is used in the scoreboard, acting like if LDS DMA
writes it and LDS load reads it.

This patch adds 8 more pseudo registers to use for independent LDS
locations if we can prove they are disjoint using alias analysis.

Fixes: SWDEV-433427
---
 llvm/lib/Target/AMDGPU/SIISelLowering.cpp   |  16 +-
 llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp |  73 +-
 llvm/lib/Target/AMDGPU/SIInstrInfo.cpp  |   4 +-
 llvm/lib/Target/AMDGPU/SIInstrInfo.h|   8 +
 llvm/lib/Target/AMDGPU/lds-dma-waits.ll | 154 
 llvm/test/CodeGen/AMDGPU/llc-pipeline.ll|   2 +
 6 files changed, 241 insertions(+), 16 deletions(-)
 create mode 100644 llvm/lib/Target/AMDGPU/lds-dma-waits.ll

diff --git a/llvm/lib/Target/AMDGPU/SIISelLowering.cpp 
b/llvm/lib/Target/AMDGPU/SIISelLowering.cpp
index a7f4d63229b7ef..2e079404b087fa 100644
--- a/llvm/lib/Target/AMDGPU/SIISelLowering.cpp
+++ b/llvm/lib/Target/AMDGPU/SIISelLowering.cpp
@@ -1128,11 +1128,10 @@ bool SITargetLowering::getTgtMemIntrinsic(IntrinsicInfo 
&Info,
 MachineMemOperand::MOStore |
 MachineMemOperand::MODereferenceable;
 
-  // XXX - Should this be volatile without known ordering?
-  Info.flags |= MachineMemOperand::MOVolatile;
-
   switch (IntrID) {
   default:
+// XXX - Should this be volatile without known ordering?
+Info.flags |= MachineMemOperand::MOVolatile;
 break;
   case Intrinsic::amdgcn_raw_buffer_load_lds:
   case Intrinsic::amdgcn_raw_ptr_buffer_load_lds:
@@ -1140,6 +1139,7 @@ bool SITargetLowering::getTgtMemIntrinsic(IntrinsicInfo 
&Info,
   case Intrinsic::amdgcn_struct_ptr_buffer_load_lds: {
 unsigned Width = 
cast(CI.getArgOperand(2))->getZExtValue();
 Info.memVT = EVT::getIntegerVT(CI.getContext(), Width * 8);
+Info.ptrVal = CI.getArgOperand(1);
 return true;
   }
   }
@@ -1268,8 +1268,8 @@ bool SITargetLowering::getTgtMemIntrinsic(IntrinsicInfo 
&Info,
 Info.opc = ISD::INTRINSIC_VOID;
 unsigned Width = cast(CI.getArgOperand(2))->getZExtValue();
 Info.memVT = EVT::getIntegerVT(CI.getContext(), Width * 8);
-Info.flags |= MachineMemOperand::MOLoad | MachineMemOperand::MOStore |
-  MachineMemOperand::MOVolatile;
+Info.ptrVal = CI.getArgOperand(1);
+Info.flags |= MachineMemOperand::MOLoad | MachineMemOperand::MOStore;
 return true;
   }
   case Intrinsic::amdgcn_ds_bvh_stack_rtn: {
@@ -9084,7 +9084,9 @@ SDValue SITargetLowering::LowerINTRINSIC_VOID(SDValue Op,
 MachinePointerInfo LoadPtrI = LoadMMO->getPointerInfo();
 
 MachinePointerInfo StorePtrI = LoadPtrI;
-StorePtrI.V = nullptr;
+LoadPtrI.V = UndefValue::get(
+PointerType::get(*DAG.getContext(), AMDGPUAS::GLOBAL_ADDRESS));
+LoadPtrI.AddrSpace = AMDGPUAS::GLOBAL_ADDRESS;
 StorePtrI.AddrSpace = AMDGPUAS::LOCAL_ADDRESS;
 
 auto F = LoadMMO->getFlags() &
@@ -9162,6 +9164,8 @@ SDValue SITargetLowering::LowerINTRINSIC_VOID(SDValue Op,
 MachinePointerInfo LoadPtrI = LoadMMO->getPointerInfo();
 LoadPtrI.Offset = Op->getConstantOperandVal(5);
 MachinePointerInfo StorePtrI = LoadPtrI;
+LoadPtrI.V = UndefValue::get(
+PointerType::get(*DAG.getContext(), AMDGPUAS::GLOBAL_ADDRESS));
 LoadPtrI.AddrSpace = AMDGPUAS::GLOBAL_ADDRESS;
 StorePtrI.AddrSpace = AMDGPUAS::LOCAL_ADDRESS;
 auto F = LoadMMO->getFlags() &
diff --git a/llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp 
b/llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp
index ede4841b8a5fd7..50ad22130e939e 100644
--- a/llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp
+++ b/llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp
@@ -31,6 +31,7 @@
 #include "llvm/ADT/MapVector.h"
 #include "llvm/ADT/PostOrderIterator.h"
 #include "llvm/ADT/Sequence.h"
+#include "llvm/Analysis/AliasAnalysis.h"
 #include "llvm/CodeGen/MachineLoopInfo.h"
 #include "llvm/CodeGen/MachinePostDominators.h"
 #include "llvm/InitializePasses.h"
@@ -121,8 +122,13 @@ enum RegisterMapping {
   SQ_MAX_PGM_VGPRS = 512, // Maximum programmable VGPRs across all targets.
   AGPR_OFFSET = 256,  // Maximum programmable ArchVGPRs across all targets.
   SQ_MAX_PGM_SGPRS = 256, // Maximum programmable SGPRs across all targets.
-  NUM_EXTRA_VGPRS = 1,// A reserved slot for DS.
-  EXTRA_VGPR_LDS = 0, // An artificial register to track LDS writes.
+  NUM_EXTRA_VGPRS = 9,// Reserved slots

[Lldb-commits] [lldb] [lldb] Improve maintainability and readability for ValueObject methods (PR #75865)

2023-12-19 Thread Pete Lawrence via lldb-commits

https://github.com/PortalPete edited 
https://github.com/llvm/llvm-project/pull/75865
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Improve maintainability and readability for ValueObject methods (PR #75865)

2023-12-19 Thread Pete Lawrence via lldb-commits


@@ -1700,13 +1706,13 @@ ValueObjectSP ValueObject::GetSyntheticChildAtOffset(
 return synthetic_child_sp;
 
   if (!can_create)
-return {};
+return ValueObjectSP();

PortalPete wrote:

This one is more about consistency because the vast majority of the remaining 
code (in this file, anyway) use the `ValueObjectSP()` form.

I also have an ulterior motive in that a lot of the changes that (might) come 
from a later PR will change MANY of these `ValueObjectSP()` instances to `{}` 
because I convert them to empty optionals, aka `std::optional` 
(instead of creating `ValueObjectSP` instances with `nullptr`).

Therefore, when that subsequent PR comes around, I want that changes to reflect 
all applicable changes as possible. If I leave this line as `return {};`, then 
the line won't change in the other PR, which reduces the attention that method 
will get at that time. Not only that, this line would be initializing something 
completely different, an optional instead of a shared pointer, in that future 
PR.

I'd rather bring more attention to things that are functionally changing to 
prevent accidental bugs and/or behavioral changes, specifically because the 
compiler quietly accepts it either way.

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


[Lldb-commits] [lldb] [lldb] Improve maintainability and readability for ValueObject methods (PR #75865)

2023-12-19 Thread Pete Lawrence via lldb-commits

https://github.com/PortalPete edited 
https://github.com/llvm/llvm-project/pull/75865
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Improve maintainability and readability for ValueObject methods (PR #75865)

2023-12-19 Thread Pete Lawrence via lldb-commits


@@ -1777,30 +1783,31 @@ static const char 
*SkipLeadingExpressionPathSeparators(const char *expression) {
 ValueObjectSP
 ValueObject::GetSyntheticExpressionPathChild(const char *expression,
  bool can_create) {
-  ValueObjectSP synthetic_child_sp;
   ConstString name_const_string(expression);
   // Check if we have already created a synthetic array member in this valid
   // object. If we have we will re-use it.
-  synthetic_child_sp = GetSyntheticChild(name_const_string);
-  if (!synthetic_child_sp) {
-// We haven't made a synthetic array member for expression yet, so lets
-// make one and cache it for any future reference.
-synthetic_child_sp = GetValueForExpressionPath(
-expression, nullptr, nullptr,
-GetValueForExpressionPathOptions().SetSyntheticChildrenTraversal(
-GetValueForExpressionPathOptions::SyntheticChildrenTraversal::
-None));
-
-// Cache the value if we got one back...
-if (synthetic_child_sp.get()) {
-  // FIXME: this causes a "real" child to end up with its name changed to
-  // the contents of expression
-  AddSyntheticChild(name_const_string, synthetic_child_sp.get());
-  synthetic_child_sp->SetName(
-  ConstString(SkipLeadingExpressionPathSeparators(expression)));
-}
-  }
-  return synthetic_child_sp;
+  if (auto existing_synthetic_child = GetSyntheticChild(name_const_string))
+return existing_synthetic_child;
+
+  // We haven't made a synthetic array member for expression yet, so lets
+  // make one and cache it for any future reference.
+  auto path_options = GetValueForExpressionPathOptions();
+  auto traversal_none =

PortalPete wrote:

All great points that I'm going to add to my personal coding style guidelines 
going forward!

Back to inline for this little one, but I regret nothing in trying it 
multi-line way because I was hoping someone would provide:
*  A preference against it (because most groups do) and …
* Reasoning behind it that I could use again here and elsewhere (which most 
groups don't)

Kudos for providing both! 🙂

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


[Lldb-commits] [lldb] [lldb] Improve maintainability and readability for ValueObject methods (PR #75865)

2023-12-19 Thread Pete Lawrence via lldb-commits


@@ -1992,71 +1999,67 @@ void ValueObject::GetExpressionPath(Stream &s,
 }
 
 ValueObjectSP ValueObject::GetValueForExpressionPath(
-llvm::StringRef expression, ExpressionPathScanEndReason *reason_to_stop,
-ExpressionPathEndResultType *final_value_type,
+llvm::StringRef expression, ExpressionPathScanEndReason 
*reason_to_stop_ptr,
+ExpressionPathEndResultType *final_value_type_ptr,
 const GetValueForExpressionPathOptions &options,
-ExpressionPathAftermath *final_task_on_target) {
-
-  ExpressionPathScanEndReason dummy_reason_to_stop =
-  ValueObject::eExpressionPathScanEndReasonUnknown;
-  ExpressionPathEndResultType dummy_final_value_type =
-  ValueObject::eExpressionPathEndResultTypeInvalid;
-  ExpressionPathAftermath dummy_final_task_on_target =
-  ValueObject::eExpressionPathAftermathNothing;
-
-  ValueObjectSP ret_val = GetValueForExpressionPath_Impl(
-  expression, reason_to_stop ? reason_to_stop : &dummy_reason_to_stop,
-  final_value_type ? final_value_type : &dummy_final_value_type, options,
-  final_task_on_target ? final_task_on_target
-   : &dummy_final_task_on_target);
-
-  if (!final_task_on_target ||
-  *final_task_on_target == ValueObject::eExpressionPathAftermathNothing)
-return ret_val;
-
-  if (ret_val.get() &&
-  ((final_value_type ? *final_value_type : dummy_final_value_type) ==
-   eExpressionPathEndResultTypePlain)) // I can only deref and takeaddress
-   // of plain objects
-  {
-if ((final_task_on_target ? *final_task_on_target
-  : dummy_final_task_on_target) ==
-ValueObject::eExpressionPathAftermathDereference) {
-  Status error;
-  ValueObjectSP final_value = ret_val->Dereference(error);
-  if (error.Fail() || !final_value.get()) {
-if (reason_to_stop)
-  *reason_to_stop =
-  ValueObject::eExpressionPathScanEndReasonDereferencingFailed;
-if (final_value_type)
-  *final_value_type = ValueObject::eExpressionPathEndResultTypeInvalid;
-return ValueObjectSP();
-  } else {
-if (final_task_on_target)
-  *final_task_on_target = ValueObject::eExpressionPathAftermathNothing;
-return final_value;
-  }
-}
-if (*final_task_on_target ==
-ValueObject::eExpressionPathAftermathTakeAddress) {
-  Status error;
-  ValueObjectSP final_value = ret_val->AddressOf(error);
-  if (error.Fail() || !final_value.get()) {
-if (reason_to_stop)
-  *reason_to_stop =
-  ValueObject::eExpressionPathScanEndReasonTakingAddressFailed;
-if (final_value_type)
-  *final_value_type = ValueObject::eExpressionPathEndResultTypeInvalid;
-return ValueObjectSP();
-  } else {
-if (final_task_on_target)
-  *final_task_on_target = ValueObject::eExpressionPathAftermathNothing;
-return final_value;
-  }
-}
+ExpressionPathAftermath *final_task_on_target_ptr) {
+
+  auto stop_reason_unknown = eExpressionPathScanEndReasonUnknown;
+  auto value_type_invalid = eExpressionPathEndResultTypeInvalid;
+  auto final_task_nothing = eExpressionPathAftermathNothing;
+
+  auto ret_value = GetValueForExpressionPath_Impl(
+  expression,
+  reason_to_stop_ptr ? reason_to_stop_ptr : &stop_reason_unknown,
+  final_value_type_ptr ? final_value_type_ptr : &value_type_invalid,
+  options,
+  final_task_on_target_ptr ? final_task_on_target_ptr
+   : &final_task_nothing);
+
+  // The caller knows nothing happened if `final_task_on_target` doesn't 
change.
+  if (!ret_value)
+return ValueObjectSP();
+
+  if (!final_value_type_ptr)
+return ret_value;
+
+  if ((*final_value_type_ptr) != eExpressionPathEndResultTypePlain)
+return ret_value;
+
+  if (!final_task_on_target_ptr)
+return ret_value;
+
+  ExpressionPathAftermath &final_task_on_target = (*final_task_on_target_ptr);
+  ExpressionPathScanEndReason stop_reason_for_error;
+  Status error;
+  // The method can only dereference and take the address of plain objects.
+  switch (final_task_on_target) {
+  case eExpressionPathAftermathNothing: {
+return ret_value;
+  }
+  case eExpressionPathAftermathDereference: {
+ret_value = ret_value->Dereference(error);
+stop_reason_for_error = eExpressionPathScanEndReasonDereferencingFailed;
+break;
+  }
+  case eExpressionPathAftermathTakeAddress: {
+ret_value = ret_value->AddressOf(error);
+stop_reason_for_error = eExpressionPathScanEndReasonTakingAddressFailed;
+break;
+  }
+  }
+
+  if (ret_value && error.Success()) {
+final_task_on_target = eExpressionPathAftermathNothing;
+return ret_value;

PortalPete wrote:

Yeah, I'm happy to unindent even MOAR. 🙂

https://github.com/llvm/llvm-project/pull/75865
___
lldb-commi

[Lldb-commits] [lldb] [lldb] Improve maintainability and readability for ValueObject methods (PR #75865)

2023-12-19 Thread Pete Lawrence via lldb-commits


@@ -1992,71 +1999,67 @@ void ValueObject::GetExpressionPath(Stream &s,
 }
 
 ValueObjectSP ValueObject::GetValueForExpressionPath(
-llvm::StringRef expression, ExpressionPathScanEndReason *reason_to_stop,
-ExpressionPathEndResultType *final_value_type,
+llvm::StringRef expression, ExpressionPathScanEndReason 
*reason_to_stop_ptr,
+ExpressionPathEndResultType *final_value_type_ptr,
 const GetValueForExpressionPathOptions &options,
-ExpressionPathAftermath *final_task_on_target) {
-
-  ExpressionPathScanEndReason dummy_reason_to_stop =
-  ValueObject::eExpressionPathScanEndReasonUnknown;
-  ExpressionPathEndResultType dummy_final_value_type =
-  ValueObject::eExpressionPathEndResultTypeInvalid;
-  ExpressionPathAftermath dummy_final_task_on_target =
-  ValueObject::eExpressionPathAftermathNothing;
-
-  ValueObjectSP ret_val = GetValueForExpressionPath_Impl(
-  expression, reason_to_stop ? reason_to_stop : &dummy_reason_to_stop,
-  final_value_type ? final_value_type : &dummy_final_value_type, options,
-  final_task_on_target ? final_task_on_target
-   : &dummy_final_task_on_target);
-
-  if (!final_task_on_target ||
-  *final_task_on_target == ValueObject::eExpressionPathAftermathNothing)
-return ret_val;
-
-  if (ret_val.get() &&
-  ((final_value_type ? *final_value_type : dummy_final_value_type) ==
-   eExpressionPathEndResultTypePlain)) // I can only deref and takeaddress
-   // of plain objects
-  {
-if ((final_task_on_target ? *final_task_on_target
-  : dummy_final_task_on_target) ==
-ValueObject::eExpressionPathAftermathDereference) {
-  Status error;
-  ValueObjectSP final_value = ret_val->Dereference(error);
-  if (error.Fail() || !final_value.get()) {
-if (reason_to_stop)
-  *reason_to_stop =
-  ValueObject::eExpressionPathScanEndReasonDereferencingFailed;
-if (final_value_type)
-  *final_value_type = ValueObject::eExpressionPathEndResultTypeInvalid;
-return ValueObjectSP();
-  } else {
-if (final_task_on_target)
-  *final_task_on_target = ValueObject::eExpressionPathAftermathNothing;
-return final_value;
-  }
-}
-if (*final_task_on_target ==
-ValueObject::eExpressionPathAftermathTakeAddress) {
-  Status error;
-  ValueObjectSP final_value = ret_val->AddressOf(error);
-  if (error.Fail() || !final_value.get()) {
-if (reason_to_stop)
-  *reason_to_stop =
-  ValueObject::eExpressionPathScanEndReasonTakingAddressFailed;
-if (final_value_type)
-  *final_value_type = ValueObject::eExpressionPathEndResultTypeInvalid;
-return ValueObjectSP();
-  } else {
-if (final_task_on_target)
-  *final_task_on_target = ValueObject::eExpressionPathAftermathNothing;
-return final_value;
-  }
-}
+ExpressionPathAftermath *final_task_on_target_ptr) {
+
+  auto stop_reason_unknown = eExpressionPathScanEndReasonUnknown;
+  auto value_type_invalid = eExpressionPathEndResultTypeInvalid;
+  auto final_task_nothing = eExpressionPathAftermathNothing;
+
+  auto ret_value = GetValueForExpressionPath_Impl(
+  expression,
+  reason_to_stop_ptr ? reason_to_stop_ptr : &stop_reason_unknown,
+  final_value_type_ptr ? final_value_type_ptr : &value_type_invalid,
+  options,
+  final_task_on_target_ptr ? final_task_on_target_ptr
+   : &final_task_nothing);
+
+  // The caller knows nothing happened if `final_task_on_target` doesn't 
change.
+  if (!ret_value)
+return ValueObjectSP();
+
+  if (!final_value_type_ptr)
+return ret_value;
+
+  if ((*final_value_type_ptr) != eExpressionPathEndResultTypePlain)
+return ret_value;
+
+  if (!final_task_on_target_ptr)
+return ret_value;

PortalPete wrote:

I also did that for readability because that original combo-`if`-statement was 
a bit much for my head to parse out.

However, I appreciate your point, @bulbazord , because it helped me realize 
that my changes alter the behavior of the method by not checking the effective 
return value from `GetValueForExpressionPath_Impl(...)` if the method passes  
`dummy_final_task_on_target` instead of the `final_task_on_target` parameter 
(when it's is `null`).

I rewrote all of that with several ...`_proxy` local variables to keep the 
behavior consistent but in a more readable form (at least to me).

I just pushed up the changes, so please double-check my work. 

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


[Lldb-commits] [lldb] [lldb] Improve maintainability and readability for ValueObject methods (PR #75865)

2023-12-19 Thread Pete Lawrence via lldb-commits

https://github.com/PortalPete updated 
https://github.com/llvm/llvm-project/pull/75865

>From b26dbee59abf1168a395b7852f05fb12771dc6e4 Mon Sep 17 00:00:00 2001
From: Pete Lawrence 
Date: Thu, 7 Dec 2023 12:14:01 -1000
Subject: [PATCH] [lldb] Improve maintainability and readability for
 ValueObject methods

As I worked through changes to another PR 
(https://github.com/llvm/llvm-project/pull/74912), I couldn't help but rewrite 
a few methods for readability, maintainability, and possibly some behavior 
correctness too.

1. Exiting early instead of nested `if`-statements, which:
- Reduces indentation levels for all subsequent lines
- Treats missing pre-conditions similar to an error
- Clearly indicates that the full length of the method is the "happy 
path".
2. Explicitly return empty Value Object shared pointers for those error (like) 
situations, which
- Reduces the time it takes a maintainer to figure out what the method 
actually returns based on those conditions.

3. Converting a mix of `if` and `if`-`else`-statements around an enum into one 
`switch` statement, which:
- Consolidates the former branching logic
- Lets the compiler warn you of a (future) missing enum case
- This one may actually change behavior slightly, because what was an 
early test for one enum case, now happens later on in the `switch`.

4. Consolidating near-identical, "copy-pasta" logic into one place, which:
- Separates the common code to the diverging paths.
- Highlights the differences between the code paths.

rdar://119833526
---
 lldb/source/Core/ValueObject.cpp | 330 +++
 1 file changed, 164 insertions(+), 166 deletions(-)

diff --git a/lldb/source/Core/ValueObject.cpp b/lldb/source/Core/ValueObject.cpp
index b13bffa0ca809b..7328139e520af7 100644
--- a/lldb/source/Core/ValueObject.cpp
+++ b/lldb/source/Core/ValueObject.cpp
@@ -1623,62 +1623,64 @@ bool ValueObject::IsUninitializedReference() {
 
 ValueObjectSP ValueObject::GetSyntheticArrayMember(size_t index,
bool can_create) {
-  ValueObjectSP synthetic_child_sp;
-  if (IsPointerType() || IsArrayType()) {
-std::string index_str = llvm::formatv("[{0}]", index);
-ConstString index_const_str(index_str);
-// Check if we have already created a synthetic array member in this valid
-// object. If we have we will re-use it.
-synthetic_child_sp = GetSyntheticChild(index_const_str);
-if (!synthetic_child_sp) {
-  ValueObject *synthetic_child;
-  // We haven't made a synthetic array member for INDEX yet, so lets make
-  // one and cache it for any future reference.
-  synthetic_child = CreateChildAtIndex(0, true, index);
-
-  // Cache the value if we got one back...
-  if (synthetic_child) {
-AddSyntheticChild(index_const_str, synthetic_child);
-synthetic_child_sp = synthetic_child->GetSP();
-synthetic_child_sp->SetName(ConstString(index_str));
-synthetic_child_sp->m_flags.m_is_array_item_for_pointer = true;
-  }
-}
-  }
+  if (!IsPointerType() && !IsArrayType())
+return ValueObjectSP();
+
+  std::string index_str = llvm::formatv("[{0}]", index);
+  ConstString index_const_str(index_str);
+  // Check if we have already created a synthetic array member in this valid
+  // object. If we have we will re-use it.
+  if (auto existing_synthetic_child = GetSyntheticChild(index_const_str))
+return existing_synthetic_child;
+
+  // We haven't made a synthetic array member for INDEX yet, so lets make
+  // one and cache it for any future reference.
+  ValueObject *synthetic_child = CreateChildAtIndex(0, true, index);
+
+  if (!synthetic_child)
+return ValueObjectSP();
+
+  // Cache the synthetic child's value because it's valid.
+  AddSyntheticChild(index_const_str, synthetic_child);
+  auto synthetic_child_sp = synthetic_child->GetSP();
+  synthetic_child_sp->SetName(ConstString(index_str));
+  synthetic_child_sp->m_flags.m_is_array_item_for_pointer = true;
   return synthetic_child_sp;
 }
 
 ValueObjectSP ValueObject::GetSyntheticBitFieldChild(uint32_t from, uint32_t 
to,
  bool can_create) {
-  ValueObjectSP synthetic_child_sp;
-  if (IsScalarType()) {
-std::string index_str = llvm::formatv("[{0}-{1}]", from, to);
-ConstString index_const_str(index_str);
-// Check if we have already created a synthetic array member in this valid
-// object. If we have we will re-use it.
-synthetic_child_sp = GetSyntheticChild(index_const_str);
-if (!synthetic_child_sp) {
-  uint32_t bit_field_size = to - from + 1;
-  uint32_t bit_field_offset = from;
-  if (GetDataExtractor().GetByteOrder() == eByteOrderBig)
-bit_field_offset =
-GetByteSize().value_or(0) * 8 - bit_field_size - bit_field_offset;
-  // We haven't made a synthetic array member for INDEX 

[Lldb-commits] [clang] [compiler-rt] [mlir] [llvm] [libcxx] [lldb] [lld] [flang] [builtins] Refactor cpu_model support to reduce #if nesting. NFCI (PR #75635)

2023-12-19 Thread Jon Roelofs via lldb-commits

jroelofs wrote:

* c88e74c26d5c - (31 minutes ago) fixup! fixup! [builtins] Refactor cpu_model 
support to reduce #if nesting. NFCI - Jon Roelofs
* a5a17e8fadd4 - (39 minutes ago) fixup! [builtins] Refactor cpu_model support 
to reduce #if nesting. NFCI - Jon Roelofs
* 256b214b6b0f - (66 minutes ago) [builtins][arm64] Implement 
__init_cpu_features_resolver on Apple platforms (#75636) - Jon Roelofs
* 9237cfa65b6c - (68 minutes ago) [builtins] Refactor cpu_model support to 
reduce #if nesting. NFCI - Jon Roelofs
* b72e1609146e - (61 minutes ago) Revert "[builtins] Refactor cpu_model support 
to reduce #if nesting. NFCI" - Jon Roelofs
* b8b40e2fb988 - (61 minutes ago) Revert "[builtins][arm64] Implement 
__init_cpu_features_resolver on Apple platforms (#75636)" - Jon Roelofs
* 17aa52017103 - (66 minutes ago) [builtins][arm64] Implement 
__init_cpu_features_resolver on Apple platforms (#75636) - Jon Roelofs
* 025d048b1cac - (68 minutes ago) [builtins] Refactor cpu_model support to 
reduce #if nesting. NFCI - Jon Roelofs

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


[Lldb-commits] [libcxx] [lldb] [llvm] [clang] [compiler-rt] [flang] [mlir] [lld] [builtins] Refactor cpu_model support to reduce #if nesting. NFCI (PR #75635)

2023-12-19 Thread Jon Roelofs via lldb-commits

jroelofs wrote:

There were a few follow-ups to address that. Sorry.

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


[Lldb-commits] [lldb] [mlir] [compiler-rt] [lld] [libcxx] [flang] [llvm] [clang] [builtins] Refactor cpu_model support to reduce #if nesting. NFCI (PR #75635)

2023-12-19 Thread Vitaly Buka via lldb-commits

vitalybuka wrote:

Breaks https://lab.llvm.org/buildbot/#/builders/269/builds/2975

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


[Lldb-commits] [lldb] [DRAFT] Add support for inline DWARF source files. (PR #75880)

2023-12-19 Thread Alex Langford via lldb-commits


@@ -38,7 +65,10 @@ class FileSpecList {
   FileSpecList(FileSpecList &&rhs) = default;
 
   /// Initialize this object from a vector of FileSpecs
-  FileSpecList(std::vector &&rhs) : m_files(std::move(rhs)) {}
+  FileSpecList(std::vector &&rhs) {
+for (auto &fs : rhs)
+  m_files.emplace_back(fs);

bulbazord wrote:

FileSpec may not be worth move-constructing, but move-constructing a vector 
would be worth it right? Maybe I'm missing something here though.

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


[Lldb-commits] [clang] [clang-tools-extra] [compiler-rt] [llvm] [libcxx] [lldb] [lld] [libc] [flang] [AMDGPU] Use alias info to relax waitcounts for LDS DMA (PR #74537)

2023-12-19 Thread Stanislav Mekhanoshin via lldb-commits

rampitec wrote:

> This is still correct, pointer argument cannot alias module global. A pointer 
> argument to a kernel is an LDS external requested by the host side, and host 
> cannot see module LDS.

I.e. that is really the point of the patch: if we are able to definitively 
identify an LDS object targeted by both load and store we only wait on that 
store or stores. And the only way to definitively identify the object at this 
stage is via alias.scope info which we are generating ourselves during module 
LDS lowering.

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


[Lldb-commits] [clang] [clang-tools-extra] [compiler-rt] [llvm] [libcxx] [lldb] [lld] [libc] [flang] [AMDGPU] Use alias info to relax waitcounts for LDS DMA (PR #74537)

2023-12-19 Thread Stanislav Mekhanoshin via lldb-commits

rampitec wrote:

> Test case:
> 
> ```
> @lds.0 = internal addrspace(3) global [64 x float] poison, align 16
> @lds.1 = internal addrspace(3) global [64 x float] poison, align 16
> 
> declare void @llvm.amdgcn.raw.buffer.load.lds(<4 x i32> %rsrc, ptr 
> addrspace(3) nocapture, i32 %size, i32 %voffset, i32 %soffset, i32 %offset, 
> i32 %aux)
> 
> define amdgpu_kernel void @f(<4 x i32> %rsrc, i32 %i1, i32 %i2, ptr 
> addrspace(1) %out, ptr addrspace(3) %ptr) {
> main_body:
>   call void @llvm.amdgcn.raw.buffer.load.lds(<4 x i32> %rsrc, ptr 
> addrspace(3) @lds.0, i32 4, i32 0, i32 0, i32 0, i32 0)
>   call void @llvm.amdgcn.raw.buffer.load.lds(<4 x i32> %rsrc, ptr 
> addrspace(3) %ptr, i32 4, i32 0, i32 0, i32 0, i32 0)
>   %gep.0 = getelementptr float, ptr addrspace(3) @lds.0, i32 %i1
>   %gep.1 = getelementptr float, ptr addrspace(3) @lds.1, i32 %i2
>   %val.0 = load volatile float, ptr addrspace(3) %gep.0, align 4
>   %val.1 = load volatile float, ptr addrspace(3) %gep.1, align 4
>   %out.gep.1 = getelementptr float, ptr addrspace(1) %out, i32 1
>   store float %val.0, ptr addrspace(1) %out
>   store float %val.1, ptr addrspace(1) %out.gep.1
>   ret void
> }
> ```
> 
> Generates:
> 
> ```
>   s_load_dwordx8 s[4:11], s[0:1], 0x24
>   s_load_dword s2, s[0:1], 0x44
>   s_mov_b32 m0, 0
>   v_mov_b32_e32 v2, 0
>   s_waitcnt lgkmcnt(0)
>   buffer_load_dword off, s[4:7], 0 lds
>   s_mov_b32 m0, s2
>   s_lshl_b32 s0, s8, 2
>   buffer_load_dword off, s[4:7], 0 lds
>   s_lshl_b32 s1, s9, 2
>   v_mov_b32_e32 v0, s0
>   v_mov_b32_e32 v1, s1
>   s_waitcnt vmcnt(1)
>   ds_read_b32 v0, v0
>   s_waitcnt vmcnt(0)
>   ds_read_b32 v1, v1 offset:256
>   s_waitcnt lgkmcnt(0)
>   global_store_dwordx2 v2, v[0:1], s[10:11]
>   s_endpgm
> ```
> 
> The `s_waitcnt vmcnt(1)` seems incorrect, because the second 
> buffer-load-to-lds might clobber `@lds.0`.

This is still correct, pointer argument cannot alias module global. A pointer 
argument to a kernel is an LDS external requested by the host side, and host 
cannot see module LDS.

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


[Lldb-commits] [lldb] [lldb][Type] Add TypeQuery::SetLanguages API (PR #75926)

2023-12-19 Thread Alex Langford via lldb-commits

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


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


[Lldb-commits] [lldb] [lldb] Improve maintainability and readability for ValueObject methods (PR #75865)

2023-12-19 Thread Alex Langford via lldb-commits


@@ -1777,30 +1783,31 @@ static const char 
*SkipLeadingExpressionPathSeparators(const char *expression) {
 ValueObjectSP
 ValueObject::GetSyntheticExpressionPathChild(const char *expression,
  bool can_create) {
-  ValueObjectSP synthetic_child_sp;
   ConstString name_const_string(expression);
   // Check if we have already created a synthetic array member in this valid
   // object. If we have we will re-use it.
-  synthetic_child_sp = GetSyntheticChild(name_const_string);
-  if (!synthetic_child_sp) {
-// We haven't made a synthetic array member for expression yet, so lets
-// make one and cache it for any future reference.
-synthetic_child_sp = GetValueForExpressionPath(
-expression, nullptr, nullptr,
-GetValueForExpressionPathOptions().SetSyntheticChildrenTraversal(
-GetValueForExpressionPathOptions::SyntheticChildrenTraversal::
-None));
-
-// Cache the value if we got one back...
-if (synthetic_child_sp.get()) {
-  // FIXME: this causes a "real" child to end up with its name changed to
-  // the contents of expression
-  AddSyntheticChild(name_const_string, synthetic_child_sp.get());
-  synthetic_child_sp->SetName(
-  ConstString(SkipLeadingExpressionPathSeparators(expression)));
-}
-  }
-  return synthetic_child_sp;
+  if (auto existing_synthetic_child = GetSyntheticChild(name_const_string))
+return existing_synthetic_child;
+
+  // We haven't made a synthetic array member for expression yet, so lets
+  // make one and cache it for any future reference.
+  auto path_options = GetValueForExpressionPathOptions();
+  auto traversal_none =

bulbazord wrote:

(This is my opinion, let me know if you disagree)
I initially suggested this because putting something in its own variable helps 
with readability when:
- You're going to use this value over and over, putting it in its own variable 
helps with readability and refactorability.
- You're trying to take something confusing and make something about it 
clearer. I usually do this in two scenarios:
  1. Computing complex expressions. Pulling it out into its own variable means 
you get to give the complex expression a "meaning". It allows you to build a 
mental model of what the code is trying to do, not how it's doing it.
  2. Making the type of something explicit. For example, if the type of 
something feels ambiguous through reading it (though the compiler does resolve 
a type for the expression), putting it into its own variable can help improve 
readability. This one is less of a concern with good code editing tooling (like 
most IDEs provide), but still to me since I read a lot of code without an IDE.

I don't hold this opinion very strongly though. What do you think?

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


[Lldb-commits] [lldb] [lldb][DWARF] Search for symbols in all external modules (PR #75927)

2023-12-19 Thread Greg Clayton via lldb-commits


@@ -175,7 +175,7 @@ TypeSP DWARFASTParserClang::ParseTypeFromClangModule(const 
SymbolContext &sc,
 *sc.comp_unit, results.GetSearchedSymbolFiles(), [&](Module &module) {
   module.FindTypes(query, results);
   pcm_type_sp = results.GetTypeMap().FirstType();
-  return !pcm_type_sp;
+  return pcm_type_sp != nullptr;

clayborg wrote:

might be nicer to do:
```
return (bool)pcm_type_sp;
```

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


[Lldb-commits] [lldb] [lldb][DWARF] Search for symbols in all external modules (PR #75927)

2023-12-19 Thread Greg Clayton via lldb-commits

https://github.com/clayborg edited 
https://github.com/llvm/llvm-project/pull/75927
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb][DWARF] Search for symbols in all external modules (PR #75927)

2023-12-19 Thread Greg Clayton via lldb-commits

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


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


[Lldb-commits] [libc] [lldb] [clang-tools-extra] [compiler-rt] [flang] [llvm] [clang] [libunwind] Reland the reland "[PGO][GlobalValue][LTO]In GlobalValues::getGlobalIdentifier, use semicolon as delim

2023-12-19 Thread Mingming Liu via lldb-commits

minglotus-6 wrote:

I'll go ahead and push it since the diff is test only.

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


[Lldb-commits] [lldb] [lldb] Improve maintainability and readability for ValueObject methods (PR #75865)

2023-12-19 Thread Jonas Devlieghere via lldb-commits


@@ -1700,13 +1706,13 @@ ValueObjectSP ValueObject::GetSyntheticChildAtOffset(
 return synthetic_child_sp;
 
   if (!can_create)
-return {};
+return ValueObjectSP();

JDevlieghere wrote:

I'm possibly biased as the author of the [modernize-return-braced-init-list 
clang tidy 
check](https://clang.llvm.org/extra/clang-tidy/checks/modernize/return-braced-init-list.html)
 but I'm curious why you think this is more readable? 

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


[Lldb-commits] [lldb] [lldb] Improve maintainability and readability for ValueObject methods (PR #75865)

2023-12-19 Thread Pete Lawrence via lldb-commits


@@ -1777,30 +1783,31 @@ static const char 
*SkipLeadingExpressionPathSeparators(const char *expression) {
 ValueObjectSP
 ValueObject::GetSyntheticExpressionPathChild(const char *expression,
  bool can_create) {
-  ValueObjectSP synthetic_child_sp;
   ConstString name_const_string(expression);
   // Check if we have already created a synthetic array member in this valid
   // object. If we have we will re-use it.
-  synthetic_child_sp = GetSyntheticChild(name_const_string);
-  if (!synthetic_child_sp) {
-// We haven't made a synthetic array member for expression yet, so lets
-// make one and cache it for any future reference.
-synthetic_child_sp = GetValueForExpressionPath(
-expression, nullptr, nullptr,
-GetValueForExpressionPathOptions().SetSyntheticChildrenTraversal(
-GetValueForExpressionPathOptions::SyntheticChildrenTraversal::
-None));
-
-// Cache the value if we got one back...
-if (synthetic_child_sp.get()) {
-  // FIXME: this causes a "real" child to end up with its name changed to
-  // the contents of expression
-  AddSyntheticChild(name_const_string, synthetic_child_sp.get());
-  synthetic_child_sp->SetName(
-  ConstString(SkipLeadingExpressionPathSeparators(expression)));
-}
-  }
-  return synthetic_child_sp;
+  if (auto existing_synthetic_child = GetSyntheticChild(name_const_string))
+return existing_synthetic_child;
+
+  // We haven't made a synthetic array member for expression yet, so lets
+  // make one and cache it for any future reference.
+  auto path_options = GetValueForExpressionPathOptions();
+  auto traversal_none =

PortalPete wrote:

I intentionally wrote this as two line for readability, but I can make it 
inline, especially if there's a (strong) style rule for it.

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


[Lldb-commits] [lldb] [clang-tools-extra] [libcxx] [flang] [llvm] [mlir] [clang] [lld] [compiler-rt] [builtins][arm64] Implement __init_cpu_features_resolver on Apple platforms (PR #75636)

2023-12-19 Thread Jon Roelofs via lldb-commits

https://github.com/jroelofs closed 
https://github.com/llvm/llvm-project/pull/75636
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [clang-tools-extra] [libcxx] [flang] [llvm] [mlir] [clang] [lld] [compiler-rt] [builtins][arm64] Implement __init_cpu_features_resolver on Apple platforms (PR #75636)

2023-12-19 Thread Jon Roelofs via lldb-commits

https://github.com/jroelofs edited 
https://github.com/llvm/llvm-project/pull/75636
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lld] [compiler-rt] [llvm] [lldb] [flang] [mlir] [libcxx] [clang] [builtins] Refactor cpu_model support to reduce #if nesting. NFCI (PR #75635)

2023-12-19 Thread Jon Roelofs via lldb-commits

https://github.com/jroelofs closed 
https://github.com/llvm/llvm-project/pull/75635
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [DRAFT] Add support for inline DWARF source files. (PR #75880)

2023-12-19 Thread Adrian Prantl via lldb-commits

https://github.com/adrian-prantl updated 
https://github.com/llvm/llvm-project/pull/75880

>From 437b7803c8011745c7e57faf74f15210cbbf1f09 Mon Sep 17 00:00:00 2001
From: Adrian Prantl 
Date: Mon, 18 Dec 2023 15:59:00 -0800
Subject: [PATCH] Add support for inline DWARF source files.

LLVM supports DWARF 5 linetable extension to store source files inline
in DWARF. This is particularly useful for compiler-generated source
code. This implementation tries to materialize them as temporary files
lazily, so SBAPI clients don't need to be aware of them.
---
 lldb/include/lldb/Utility/FileSpecList.h  | 45 +++---
 lldb/source/Core/ModuleList.cpp   |  8 ++--
 .../Clang/ClangUserExpression.cpp | 12 ++---
 .../Clang/CppModuleConfiguration.cpp  |  6 +--
 .../SymbolFile/DWARF/SymbolFileDWARF.cpp  | 47 +++
 lldb/source/Utility/FileSpecList.cpp  | 21 +
 .../inline-sourcefile/Makefile| 11 +
 .../TestInlineSourceFiles.py  | 17 +++
 .../inline-sourcefile/inline.ll   | 39 +++
 .../functionalities/inline-sourcefile/main.c  |  7 +++
 10 files changed, 186 insertions(+), 27 deletions(-)
 create mode 100644 lldb/test/API/functionalities/inline-sourcefile/Makefile
 create mode 100644 
lldb/test/API/functionalities/inline-sourcefile/TestInlineSourceFiles.py
 create mode 100644 lldb/test/API/functionalities/inline-sourcefile/inline.ll
 create mode 100644 lldb/test/API/functionalities/inline-sourcefile/main.c

diff --git a/lldb/include/lldb/Utility/FileSpecList.h 
b/lldb/include/lldb/Utility/FileSpecList.h
index 77587aa917916b..8eda721b607fd6 100644
--- a/lldb/include/lldb/Utility/FileSpecList.h
+++ b/lldb/include/lldb/Utility/FileSpecList.h
@@ -17,13 +17,41 @@
 namespace lldb_private {
 class Stream;
 
+/// Represents a source file whose contents is known (for example
+/// because it can be reconstructed from debug info), but that
+/// hasn't been written to a local disk yet.
+struct LazyFileSpec {
+  virtual ~LazyFileSpec() {}
+  virtual const FileSpec &Materialize() = 0;
+};
+
+/// Wraps either a FileSpec that represents a local file or a
+/// LazyFileSpec that could be materialized into a local file.
+class FileSpecHolder {
+  FileSpec m_file_spec;
+  std::shared_ptr m_lazy;
+
+public:
+  FileSpecHolder(const FileSpec &spec, std::shared_ptr lazy = {})
+  : m_file_spec(spec), m_lazy(lazy) {}
+  FileSpecHolder(const FileSpecHolder &other) = default;
+  FileSpecHolder(FileSpecHolder &&other) = default;
+  FileSpecHolder &operator=(const FileSpecHolder &other) = default;
+  const FileSpec &GetSpecOnly() const { return m_file_spec; };
+  const FileSpec &Materialize() const {
+if (m_lazy)
+  return m_lazy->Materialize();
+return m_file_spec;
+  }
+};
+
 /// \class FileSpecList FileSpecList.h "lldb/Utility/FileSpecList.h"
 /// A file collection class.
 ///
 /// A class that contains a mutable list of FileSpec objects.
 class FileSpecList {
 public:
-  typedef std::vector collection;
+  typedef std::vector collection;
   typedef collection::const_iterator const_iterator;
 
   /// Default constructor.
@@ -38,7 +66,10 @@ class FileSpecList {
   FileSpecList(FileSpecList &&rhs) = default;
 
   /// Initialize this object from a vector of FileSpecs
-  FileSpecList(std::vector &&rhs) : m_files(std::move(rhs)) {}
+  FileSpecList(std::vector &&rhs) {
+for (auto &fs : rhs)
+  m_files.emplace_back(fs);
+  }
 
   /// Destructor.
   ~FileSpecList();
@@ -83,9 +114,11 @@ class FileSpecList {
   /// \param[in] args
   /// Arguments to create the FileSpec
   template  void EmplaceBack(Args &&...args) {
-m_files.emplace_back(std::forward(args)...);
+m_files.emplace_back(FileSpec(std::forward(args)...));
   }
 
+  void Append(FileSpecHolder &&fsh) { m_files.push_back(std::move(fsh)); }
+
   /// Clears the file list.
   void Clear();
 
@@ -175,10 +208,10 @@ class FileSpecList {
 
   bool Insert(size_t idx, const FileSpec &file) {
 if (idx < m_files.size()) {
-  m_files.insert(m_files.begin() + idx, file);
+  m_files.insert(m_files.begin() + idx, FileSpecHolder(file));
   return true;
 } else if (idx == m_files.size()) {
-  m_files.push_back(file);
+  m_files.push_back(FileSpecHolder(file));
   return true;
 }
 return false;
@@ -186,7 +219,7 @@ class FileSpecList {
 
   bool Replace(size_t idx, const FileSpec &file) {
 if (idx < m_files.size()) {
-  m_files[idx] = file;
+  m_files[idx] = FileSpecHolder(file);
   return true;
 }
 return false;
diff --git a/lldb/source/Core/ModuleList.cpp b/lldb/source/Core/ModuleList.cpp
index aa89c93c8d0521..3b6c3ea899caf7 100644
--- a/lldb/source/Core/ModuleList.cpp
+++ b/lldb/source/Core/ModuleList.cpp
@@ -164,11 +164,13 @@ void ModuleListProperties::UpdateSymlinkMappings() {
   llvm::sys::ScopedWriter lock(m_symlink_paths_mutex);
   const bool notify = false;
   m_symlink_paths.C

[Lldb-commits] [lldb] [DRAFT] Add support for inline DWARF source files. (PR #75880)

2023-12-19 Thread Adrian Prantl via lldb-commits


@@ -38,7 +65,10 @@ class FileSpecList {
   FileSpecList(FileSpecList &&rhs) = default;
 
   /// Initialize this object from a vector of FileSpecs
-  FileSpecList(std::vector &&rhs) : m_files(std::move(rhs)) {}
+  FileSpecList(std::vector &&rhs) {
+for (auto &fs : rhs)
+  m_files.emplace_back(fs);

adrian-prantl wrote:

> Would adding a move constructor to FileSpec address your concern?

No, there's nothing worth move-constructing in FileSpec.

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


[Lldb-commits] [llvm] [lldb] [compiler-rt] [mlir] [libcxx] [clang] [flang] [lld] [builtins] Refactor cpu_model support to reduce #if nesting. NFCI (PR #75635)

2023-12-19 Thread Jon Roelofs via lldb-commits

https://github.com/jroelofs updated 
https://github.com/llvm/llvm-project/pull/75635

>From 336d1629f38a8681038f026c599a256761b522dc Mon Sep 17 00:00:00 2001
From: Jon Roelofs 
Date: Fri, 15 Dec 2023 11:13:30 -0700
Subject: [PATCH 1/6] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20in?=
 =?UTF-8?q?itial=20version?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Created using spr 1.3.4
---
 compiler-rt/lib/builtins/CMakeLists.txt   |   4 +-
 compiler-rt/lib/builtins/cpu_model/aarch64.c  | 142 +
 .../cpu_model/aarch64/fmv/android.inc |  35 +
 .../cpu_model/aarch64/fmv/freebsd.inc |  27 +
 .../builtins/cpu_model/aarch64/fmv/fucsia.inc |  19 +
 .../builtins/cpu_model/aarch64/fmv/mrs.inc| 375 +++
 .../cpu_model/aarch64/fmv/sysauxv.inc |  17 +
 .../cpu_model/aarch64/fmv/unimplemented.inc   |  11 +
 .../cpu_model/aarch64/lse_atomics/android.inc |  28 +
 .../cpu_model/aarch64/lse_atomics/freebsd.inc |   5 +
 .../cpu_model/aarch64/lse_atomics/fucsia.inc  |  12 +
 .../cpu_model/aarch64/lse_atomics/sysauxv.inc |   6 +
 .../lib/builtins/cpu_model/cpu_model.h|  41 ++
 .../builtins/{cpu_model.c => cpu_model/x86.c} | 600 +-
 14 files changed, 729 insertions(+), 593 deletions(-)
 create mode 100644 compiler-rt/lib/builtins/cpu_model/aarch64.c
 create mode 100644 compiler-rt/lib/builtins/cpu_model/aarch64/fmv/android.inc
 create mode 100644 compiler-rt/lib/builtins/cpu_model/aarch64/fmv/freebsd.inc
 create mode 100644 compiler-rt/lib/builtins/cpu_model/aarch64/fmv/fucsia.inc
 create mode 100644 compiler-rt/lib/builtins/cpu_model/aarch64/fmv/mrs.inc
 create mode 100644 compiler-rt/lib/builtins/cpu_model/aarch64/fmv/sysauxv.inc
 create mode 100644 
compiler-rt/lib/builtins/cpu_model/aarch64/fmv/unimplemented.inc
 create mode 100644 
compiler-rt/lib/builtins/cpu_model/aarch64/lse_atomics/android.inc
 create mode 100644 
compiler-rt/lib/builtins/cpu_model/aarch64/lse_atomics/freebsd.inc
 create mode 100644 
compiler-rt/lib/builtins/cpu_model/aarch64/lse_atomics/fucsia.inc
 create mode 100644 
compiler-rt/lib/builtins/cpu_model/aarch64/lse_atomics/sysauxv.inc
 create mode 100644 compiler-rt/lib/builtins/cpu_model/cpu_model.h
 rename compiler-rt/lib/builtins/{cpu_model.c => cpu_model/x86.c} (60%)

diff --git a/compiler-rt/lib/builtins/CMakeLists.txt 
b/compiler-rt/lib/builtins/CMakeLists.txt
index ea72c595a9b807..e5b52db175d960 100644
--- a/compiler-rt/lib/builtins/CMakeLists.txt
+++ b/compiler-rt/lib/builtins/CMakeLists.txt
@@ -271,7 +271,7 @@ endif()
 
 # These files are used on 32-bit and 64-bit x86.
 set(x86_ARCH_SOURCES
-  cpu_model.c
+  cpu_model/x86.c
   )
 
 if (NOT MSVC)
@@ -556,7 +556,7 @@ endif()
 set(aarch64_SOURCES
   ${GENERIC_TF_SOURCES}
   ${GENERIC_SOURCES}
-  cpu_model.c
+  cpu_model/aarch64.c
   aarch64/fp_mode.c
 )
 
diff --git a/compiler-rt/lib/builtins/cpu_model/aarch64.c 
b/compiler-rt/lib/builtins/cpu_model/aarch64.c
new file mode 100644
index 00..98b0c4433d01a1
--- /dev/null
+++ b/compiler-rt/lib/builtins/cpu_model/aarch64.c
@@ -0,0 +1,142 @@
+//===-- cpu_model_aarch64.c - Support for __cpu_model builtin  *- C 
-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+//
+//  This file is based on LLVM's lib/Support/Host.cpp.
+//  It implements __aarch64_have_lse_atomics, __aarch64_cpu_features for 
AArch64.
+//
+//===--===//
+
+#include "cpu_model.h"
+
+#if !defined(__aarch64__)
+#  error This file is intended only for aarch64-based targets
+#endif
+
+
+#if __has_include()
+#include 
+#else
+typedef struct __ifunc_arg_t {
+  unsigned long _size;
+  unsigned long _hwcap;
+  unsigned long _hwcap2;
+} __ifunc_arg_t;
+#endif // __has_include()
+
+
+// LSE support detection for out-of-line atomics
+// using HWCAP and Auxiliary vector
+_Bool __aarch64_have_lse_atomics
+__attribute__((visibility("hidden"), nocommon)) = false;
+
+#if defined(__FreeBSD__)
+#  include "lse_atomics/freebsd.inc"
+#elif defined(__Fucsia__)
+#  include "lse_atomics/fucsia.inc"
+#elif defined(__ANDROID__)
+#  include "lse_atomics/android.inc"
+#elif __has_include()
+#  include "lse_atomics/sysauxv.inc"
+#else
+// When unimplemented, we leave __aarch64_have_lse_atomics initialized to 
false.
+#endif
+
+
+#if !defined(DISABLE_AARCH64_FMV)
+// CPUFeatures must correspond to the same AArch64 features in
+// AArch64TargetParser.h
+enum CPUFeatures {
+  FEAT_RNG,
+  FEAT_FLAGM,
+  FEAT_FLAGM2,
+  FEAT_FP16FML,
+  FEAT_DOTPROD,
+  FEAT_SM4,
+  FEAT_RDM,
+  FEAT_LSE,
+  FEAT_FP,
+  FEAT_SIMD,
+  FEAT_CRC,
+  FEAT_SHA1,
+  FEAT_SHA2,
+  FEAT_SHA3,
+  FEAT_AES,
+  FEAT_PMULL,
+  FEAT_FP16,
+  FEAT_DIT

[Lldb-commits] [flang] [libc] [lldb] [libunwind] [llvm] [clang-tools-extra] [compiler-rt] [clang] [mlir] [lld] [libcxx] [IRPGO][ValueProfile] Instrument virtual table address that could be used to do

2023-12-19 Thread Mingming Liu via lldb-commits

minglotus-6 wrote:

> After this patch, follow up with a patch documenting raw and index format. 
> This has long being requested by many in the community.

Sure, I'm working on an `rst` doc and would like to focus on the PGO profile 
format (while compiler-rt infrastructure supports other use cases, like 
coverage instrumentation, etc), for example, how profile-data control structure 
references counters and value profiles.

I just updated this pull request (fix clang-format after using the same 
clang-format as bot, etc). @amharc and I discussed how to work around possible 
profile version skews without waiting for version compatibility full-fledged 
solution, and he suggested we could first teach profile reader to understand 
new sections without bumping the version and let it soak everywhere (e.g, for a 
few weeks), and increase the version number as a second change. I'm planning to 
make some progress on this aspect.

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


[Lldb-commits] [llvm] [lldb] [flang] [clang-tools-extra] [compiler-rt] [libunwind] [libc] [clang] Reland the reland "[PGO][GlobalValue][LTO]In GlobalValues::getGlobalIdentifier, use semicolon as delim

2023-12-19 Thread Mingming Liu via lldb-commits

minglotus-6 wrote:

The diff of this reland compared with the 1st reland is clearer in this commit 
(https://github.com/llvm/llvm-project/pull/75954/commits/cca510e569e9325ec089974e006eb2a8e2d0a2a7)

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


[Lldb-commits] [llvm] [lldb] [flang] [clang-tools-extra] [compiler-rt] [libunwind] [libc] [clang] Reland the reland "[PGO][GlobalValue][LTO]In GlobalValues::getGlobalIdentifier, use semicolon as delim

2023-12-19 Thread Mingming Liu via lldb-commits

https://github.com/minglotus-6 updated 
https://github.com/llvm/llvm-project/pull/75954

>From 4936920fbbe5e70a47be35b057200de3b07a087f Mon Sep 17 00:00:00 2001
From: mingmingl 
Date: Mon, 18 Dec 2023 20:21:40 -0800
Subject: [PATCH 1/2] Reapply "Reland "[PGO][GlobalValue][LTO]In
 GlobalValues::getGlobalIdentifier, use semicolon as delimiter for
 local-linkage varibles. "" (#75888)

This reverts commit 6ce23ea0ab6370c944f5e426a20217f93f41aa15.
---
 compiler-rt/test/profile/CMakeLists.txt   |   2 +-
 ...trprof-thinlto-indirect-call-promotion.cpp | 115 ++
 llvm/include/llvm/IR/GlobalValue.h|   4 +
 llvm/include/llvm/ProfileData/InstrProf.h |  26 ++--
 llvm/lib/IR/Globals.cpp   |  12 +-
 llvm/lib/ProfileData/InstrProf.cpp|  36 --
 llvm/lib/ProfileData/InstrProfReader.cpp  |   9 +-
 .../thinlto-function-summary-originalnames.ll |  10 +-
 llvm/test/ThinLTO/X86/memprof-basic.ll|  26 ++--
 .../X86/memprof-duplicate-context-ids.ll  |  10 +-
 .../ThinLTO/X86/memprof-funcassigncloning.ll  |   6 +-
 llvm/test/ThinLTO/X86/memprof-indirectcall.ll |  32 ++---
 llvm/test/ThinLTO/X86/memprof-inlined.ll  |  14 +--
 .../Inputs/thinlto_indirect_call_promotion.ll |  16 ---
 .../thinlto_indirect_call_promotion.profraw   | Bin 0 -> 528 bytes
 ..._thinlto_indirect_call_promotion_inputs.sh |  62 ++
 .../thinlto_indirect_call_promotion.ll| 105 +++-
 llvm/unittests/ProfileData/InstrProfTest.cpp  |   4 +-
 18 files changed, 362 insertions(+), 127 deletions(-)
 create mode 100644 
compiler-rt/test/profile/instrprof-thinlto-indirect-call-promotion.cpp
 delete mode 100644 
llvm/test/Transforms/PGOProfile/Inputs/thinlto_indirect_call_promotion.ll
 create mode 100644 
llvm/test/Transforms/PGOProfile/Inputs/thinlto_indirect_call_promotion.profraw
 create mode 100755 
llvm/test/Transforms/PGOProfile/Inputs/update_thinlto_indirect_call_promotion_inputs.sh

diff --git a/compiler-rt/test/profile/CMakeLists.txt 
b/compiler-rt/test/profile/CMakeLists.txt
index 975e4c42f4b640..eebe0469efebe0 100644
--- a/compiler-rt/test/profile/CMakeLists.txt
+++ b/compiler-rt/test/profile/CMakeLists.txt
@@ -6,7 +6,7 @@ set(PROFILE_TESTSUITES)
 set(PROFILE_TEST_DEPS ${SANITIZER_COMMON_LIT_TEST_DEPS} compiler-rt-headers)
 list(APPEND PROFILE_TEST_DEPS profile)
 if(NOT COMPILER_RT_STANDALONE_BUILD)
-  list(APPEND PROFILE_TEST_DEPS llvm-profdata llvm-cov)
+  list(APPEND PROFILE_TEST_DEPS llvm-cov llvm-dis llvm-lto llvm-profdata opt)
   if(NOT APPLE AND COMPILER_RT_HAS_LLD AND "lld" IN_LIST LLVM_ENABLE_PROJECTS)
 list(APPEND PROFILE_TEST_DEPS lld)
   endif()
diff --git 
a/compiler-rt/test/profile/instrprof-thinlto-indirect-call-promotion.cpp 
b/compiler-rt/test/profile/instrprof-thinlto-indirect-call-promotion.cpp
new file mode 100644
index 00..82ca1cd7d0a564
--- /dev/null
+++ b/compiler-rt/test/profile/instrprof-thinlto-indirect-call-promotion.cpp
@@ -0,0 +1,115 @@
+// This is a regression test for ThinLTO indirect-call-promotion when candidate
+// callees need to be imported from another IR module.  In the C++ test case,
+// `main` calls `global_func` which is defined in another module. `global_func`
+// has two indirect callees, one has external linkage and one has local 
linkage.
+// All three functions should be imported into the IR module of main.
+
+// What the test does:
+// - Generate raw profiles from executables and convert it to indexed profiles.
+//   During the conversion, a profiled callee address in raw profiles will be
+//   converted to function hash in indexed profiles.
+// - Run IRPGO profile use and ThinTLO prelink pipeline and get LLVM bitcodes
+//   for both cpp files in the C++ test case.
+// - Generate ThinLTO summary file with LLVM bitcodes, and run 
`function-import` pass.
+// - Run `pgo-icall-prom` pass for the IR module which needs to import callees.
+
+// Use lld as linker for more robust test. We need to REQUIRE LLVMgold.so for
+// LTO if default linker is GNU ld or gold anyway.
+// REQUIRES: lld-available
+
+// Test should fail where linkage-name and mangled-name diverges, see issue 
https://github.com/llvm/llvm-project/issues/74565).
+// Currently, this name divergence happens on Mach-O object file format, or on
+// many (but not all) 32-bit Windows systems.
+//
+// XFAIL: system-darwin
+//
+// Mark 32-bit Windows as UNSUPPORTED for now as opposed to XFAIL. This test
+// should fail on many (but not all) 32-bit Windows systems and succeed on the
+// rest. The flexibility in triple string parsing makes it tricky to capture
+// both sets accurately. i[3-9]86 specifies arch as Triple::ArchType::x86, 
(win32|windows)
+// specifies OS as Triple::OS::Win32
+//
+// UNSUPPORTED: target={{i.86.*windows.*}}
+
+// RUN: rm -rf %t && split-file %s %t && cd %t
+
+// Do setup work for all below tests.
+// Generate raw profiles from real programs and convert it into indexed 
profiles.
+// Use clangxx_pgogen for IR 

[Lldb-commits] [llvm] [lldb] [compiler-rt] [libunwind] [mlir] [libcxx] [clang] [libc] [flang] [clang-tools-extra] [lld] [IRPGO][ValueProfile] Instrument virtual table address that could be used to do

2023-12-19 Thread David Li via lldb-commits

https://github.com/david-xl approved this pull request.

After this patch,  follow up with a patch documenting raw and index format. 
This has long being requested by many in the community.

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


[Lldb-commits] [lldb] [clang] [llvm] [AArch64] Support for 9.5-A PAuthLR (PR #75947)

2023-12-19 Thread Tomas Matheson via lldb-commits

https://github.com/tmatheson-arm updated 
https://github.com/llvm/llvm-project/pull/75947

>From d3201659d87260acaf1d20a96705e290caf21693 Mon Sep 17 00:00:00 2001
From: Tomas Matheson 
Date: Thu, 2 Feb 2023 13:19:05 +
Subject: [PATCH 1/3] [AArch64] add missing test case for v9.4-A

---
 clang/test/Preprocessor/aarch64-target-features.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/clang/test/Preprocessor/aarch64-target-features.c 
b/clang/test/Preprocessor/aarch64-target-features.c
index db89aa7b608ad5..b3da54162da04b 100644
--- a/clang/test/Preprocessor/aarch64-target-features.c
+++ b/clang/test/Preprocessor/aarch64-target-features.c
@@ -600,6 +600,7 @@
 // RUN: %clang -target aarch64-none-elf -march=armv9.1-a -x c -E -dM %s -o - | 
FileCheck 
--check-prefixes=CHECK-V81-OR-LATER,CHECK-V83-OR-LATER,CHECK-V85-OR-LATER %s
 // RUN: %clang -target aarch64-none-elf -march=armv9.2-a -x c -E -dM %s -o - | 
FileCheck 
--check-prefixes=CHECK-V81-OR-LATER,CHECK-V83-OR-LATER,CHECK-V85-OR-LATER %s
 // RUN: %clang -target aarch64-none-elf -march=armv9.3-a -x c -E -dM %s -o - | 
FileCheck 
--check-prefixes=CHECK-V81-OR-LATER,CHECK-V83-OR-LATER,CHECK-V85-OR-LATER %s
+// RUN: %clang -target aarch64-none-elf -march=armv9.4-a -x c -E -dM %s -o - | 
FileCheck 
--check-prefixes=CHECK-V81-OR-LATER,CHECK-V83-OR-LATER,CHECK-V85-OR-LATER %s
 // RUN: %clang -target aarch64-none-elf -march=armv9.5-a -x c -E -dM %s -o - | 
FileCheck 
--check-prefixes=CHECK-V81-OR-LATER,CHECK-V83-OR-LATER,CHECK-V85-OR-LATER %s
 // CHECK-V81-OR-LATER: __ARM_FEATURE_ATOMICS 1
 // CHECK-V85-OR-LATER: __ARM_FEATURE_BTI 1

>From 1d4208d53830e0ef8dadad9be12e7ef2b53c6190 Mon Sep 17 00:00:00 2001
From: Oliver Stannard 
Date: Wed, 1 Feb 2023 18:16:07 +
Subject: [PATCH 2/3] [AArch64] Add FEAT_PAuthLR assembler support

Add assembly/disassembly support for the new PAuthLR instructions
introduced in Armv9.5-A:

- AUTIASPPC/AUTIBSPPC
- PACIASPPC/PACIBSPPC
- PACNBIASPPC/PACNBIBSPPC
- RETAASPPC/RETABSPPC
- PACM

Documentation for these instructions can be found here:
https://developer.arm.com/documentation/ddi0602/2023-09/Base-Instructions/
---
 llvm/lib/Target/AArch64/AArch64.td|   7 +-
 .../lib/Target/AArch64/AArch64InstrFormats.td |  74 +
 llvm/lib/Target/AArch64/AArch64InstrInfo.td   |  39 +
 llvm/lib/Target/AArch64/AArch64SchedA64FX.td  |   2 +-
 .../Target/AArch64/AArch64SchedNeoverseN2.td  |   2 +-
 .../AArch64/AsmParser/AArch64AsmParser.cpp|  28 
 .../Disassembler/AArch64Disassembler.cpp  |  18 +++
 .../MCTargetDesc/AArch64AsmBackend.cpp|  14 ++
 .../MCTargetDesc/AArch64ELFObjectWriter.cpp   |   4 +
 .../AArch64/MCTargetDesc/AArch64FixupKinds.h  |   5 +
 .../MCTargetDesc/AArch64MCCodeEmitter.cpp |  28 
 .../MC/AArch64/armv9.5a-pauthlr-diagnostics.s |  57 +++
 llvm/test/MC/AArch64/armv9.5a-pauthlr-reloc.s |  12 ++
 llvm/test/MC/AArch64/armv9.5a-pauthlr.s   | 151 ++
 .../Disassembler/AArch64/armv9.5a-pauthlr.txt |  78 +
 15 files changed, 516 insertions(+), 3 deletions(-)
 create mode 100644 llvm/test/MC/AArch64/armv9.5a-pauthlr-diagnostics.s
 create mode 100644 llvm/test/MC/AArch64/armv9.5a-pauthlr-reloc.s
 create mode 100644 llvm/test/MC/AArch64/armv9.5a-pauthlr.s
 create mode 100644 llvm/test/MC/Disassembler/AArch64/armv9.5a-pauthlr.txt

diff --git a/llvm/lib/Target/AArch64/AArch64.td 
b/llvm/lib/Target/AArch64/AArch64.td
index c600bcaab2b3ea..95e171109b4eb0 100644
--- a/llvm/lib/Target/AArch64/AArch64.td
+++ b/llvm/lib/Target/AArch64/AArch64.td
@@ -622,6 +622,11 @@ def FeatureLdpAlignedOnly : 
SubtargetFeature<"ldp-aligned-only", "HasLdpAlignedO
 def FeatureStpAlignedOnly : SubtargetFeature<"stp-aligned-only", 
"HasStpAlignedOnly",
 "true", "In order to emit stp, first check if the store will be aligned to 
2 * element_size">;
 
+// AArch64 2023 Architecture Extensions (v9.5-A)
+
+def FeaturePAuthLR : SubtargetFeature<"pauth-lr", "HasPAuthLR",
+"true", "Enable Armv9.5-A PAC enhancements (FEAT_PAuth_LR)">;
+
 
//===--===//
 // Architectures.
 //
@@ -807,7 +812,7 @@ def SMEUnsupported : AArch64Unsupported {
   SME2Unsupported.F);
 }
 
-let F = [HasPAuth] in
+let F = [HasPAuth, HasPAuthLR] in
 def PAUnsupported : AArch64Unsupported;
 
 include "AArch64SchedA53.td"
diff --git a/llvm/lib/Target/AArch64/AArch64InstrFormats.td 
b/llvm/lib/Target/AArch64/AArch64InstrFormats.td
index 68e87f491a09e4..92bf9f4ec2a21b 100644
--- a/llvm/lib/Target/AArch64/AArch64InstrFormats.td
+++ b/llvm/lib/Target/AArch64/AArch64InstrFormats.td
@@ -2368,6 +2368,80 @@ class ClearAuth data, string asm>
   let Inst{4-0} = Rd;
 }
 
+// v9.5-A FEAT_PAuth_LR
+
+class SignAuthFixedRegs opcode2, bits<6> opcode, string asm>
+  : I<(outs), (ins), asm, "", "", []>,
+Sched<[WriteI, ReadI]> {
+  let Inst{31} = 0b1; // sf
+  let Inst{30} = 0b1;
+  let Inst{29} = 0b0; // S
+  let Inst{28-21} = 0b1101011

[Lldb-commits] [lldb] Remove unused FileSPec::IsResolved() functionality. (PR #75840)

2023-12-19 Thread Adrian Prantl via lldb-commits

https://github.com/adrian-prantl closed 
https://github.com/llvm/llvm-project/pull/75840
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] 45657e8 - Remove unused FileSPec::IsResolved() functionality. (#75840)

2023-12-19 Thread via lldb-commits

Author: Adrian Prantl
Date: 2023-12-19T08:49:12-08:00
New Revision: 45657e81a111021dab5f1daa9482afae5d95569c

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

LOG: Remove unused FileSPec::IsResolved() functionality. (#75840)

This API seems to be completely unused. Should we just remove it?

Added: 


Modified: 
lldb/include/lldb/Utility/FileSpec.h
lldb/source/Host/common/FileSystem.cpp

Removed: 




diff  --git a/lldb/include/lldb/Utility/FileSpec.h 
b/lldb/include/lldb/Utility/FileSpec.h
index ccd25a81c11f36..e4276e8398b464 100644
--- a/lldb/include/lldb/Utility/FileSpec.h
+++ b/lldb/include/lldb/Utility/FileSpec.h
@@ -386,21 +386,6 @@ class FileSpec {
   /// The triple which is used to set the Path style.
   void SetFile(llvm::StringRef path, const llvm::Triple &triple);
 
-  bool IsResolved() const { return m_is_resolved; }
-
-  /// Set if the file path has been resolved or not.
-  ///
-  /// If you know a file path is already resolved and avoided passing a \b
-  /// true parameter for any functions that take a "bool resolve_path"
-  /// parameter, you can set the value manually using this call to make sure
-  /// we don't try and resolve it later, or try and resolve a path that has
-  /// already been resolved.
-  ///
-  /// \param[in] is_resolved
-  /// A boolean value that will replace the current value that
-  /// indicates if the paths in this object have been resolved.
-  void SetIsResolved(bool is_resolved) { m_is_resolved = is_resolved; }
-
   FileSpec CopyByAppendingPathComponent(llvm::StringRef component) const;
   FileSpec CopyByRemovingLastPathComponent() const;
 
@@ -440,7 +425,6 @@ class FileSpec {
   /// state in this object.
   void PathWasModified() {
 m_checksum = Checksum();
-m_is_resolved = false;
 m_absolute = Absolute::Calculate;
   }
 
@@ -459,9 +443,6 @@ class FileSpec {
   /// The optional MD5 checksum of the file.
   Checksum m_checksum;
 
-  /// True if this path has been resolved.
-  mutable bool m_is_resolved = false;
-
   /// Cache whether this path is absolute.
   mutable Absolute m_absolute = Absolute::Calculate;
 

diff  --git a/lldb/source/Host/common/FileSystem.cpp 
b/lldb/source/Host/common/FileSystem.cpp
index 52227a9f63a526..5153a0a9ec5134 100644
--- a/lldb/source/Host/common/FileSystem.cpp
+++ b/lldb/source/Host/common/FileSystem.cpp
@@ -259,7 +259,6 @@ void FileSystem::Resolve(FileSpec &file_spec) {
 file_spec.SetDirectory(path);
   else
 file_spec.SetPath(path);
-  file_spec.SetIsResolved(true);
 }
 
 template 



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


[Lldb-commits] [lldb] [DRAFT] Add support for inline DWARF source files. (PR #75880)

2023-12-19 Thread Adrian Prantl via lldb-commits


@@ -235,6 +236,51 @@ ParseSupportFilesFromPrologue(const lldb::ModuleSP &module,
   for (size_t idx = first_file_idx; idx <= last_file_idx; ++idx) {
 std::string remapped_file;
 if (auto file_path = GetFileByIndex(prologue, idx, compile_dir, style)) {
+  auto entry = prologue.getFileNameEntry(idx);
+  auto source = entry.Source.getAsCString();
+  if (!source)
+consumeError(source.takeError());

adrian-prantl wrote:

`entry.Source.getAsCString()` only returns something if this is the inline 
source DWARF extension. If this is empty we're left with just a file path, like 
before.

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


[Lldb-commits] [lldb] [DRAFT] Add support for inline DWARF source files. (PR #75880)

2023-12-19 Thread Adrian Prantl via lldb-commits


@@ -38,7 +65,10 @@ class FileSpecList {
   FileSpecList(FileSpecList &&rhs) = default;
 
   /// Initialize this object from a vector of FileSpecs
-  FileSpecList(std::vector &&rhs) : m_files(std::move(rhs)) {}
+  FileSpecList(std::vector &&rhs) {
+for (auto &fs : rhs)
+  m_files.emplace_back(fs);

adrian-prantl wrote:

Do you have a suggestion for how to fix this? Would adding a move constructor 
to FileSpec address your concern?

Note that FileSpecList is a value type that gets copied a lot, which informs 
many of the odd design choices in this patch.

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


[Lldb-commits] [lldb] [DRAFT] Add support for inline DWARF source files. (PR #75880)

2023-12-19 Thread Adrian Prantl via lldb-commits


@@ -17,13 +17,40 @@
 namespace lldb_private {
 class Stream;
 
+/// Represents a source file whose contents is known (for example
+/// because it can be reconstructed from debug info), but that
+/// hasn't been written to a local disk yet.
+struct LazyFileSpec {
+  virtual ~LazyFileSpec() {}
+  virtual const FileSpec &Materialize() = 0;
+};
+
+/// Wraps either a FileSpec that represents a local file or a
+/// LazyFileSpec that could be materialized into a local file.
+class FileSpecHolder {
+  FileSpec m_file_spec;
+  std::shared_ptr m_lazy;

adrian-prantl wrote:

For the functions that want GetSpecOnly() (e.g., setting a breakpoint on the 
original filename) we still need it.

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


[Lldb-commits] [lldb] [lldb][Type] Add TypeQuery::SetLanguages API (PR #75926)

2023-12-19 Thread Adrian Prantl via lldb-commits

https://github.com/adrian-prantl approved this pull request.


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


[Lldb-commits] [mlir] [llvm] [libcxx] [lld] [compiler-rt] [flang] [lldb] [clang] [builtins] Refactor cpu_model support to reduce #if nesting. NFCI (PR #75635)

2023-12-19 Thread Jon Roelofs via lldb-commits

https://github.com/jroelofs updated 
https://github.com/llvm/llvm-project/pull/75635

>From 336d1629f38a8681038f026c599a256761b522dc Mon Sep 17 00:00:00 2001
From: Jon Roelofs 
Date: Fri, 15 Dec 2023 11:13:30 -0700
Subject: [PATCH 1/5] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20in?=
 =?UTF-8?q?itial=20version?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Created using spr 1.3.4
---
 compiler-rt/lib/builtins/CMakeLists.txt   |   4 +-
 compiler-rt/lib/builtins/cpu_model/aarch64.c  | 142 +
 .../cpu_model/aarch64/fmv/android.inc |  35 +
 .../cpu_model/aarch64/fmv/freebsd.inc |  27 +
 .../builtins/cpu_model/aarch64/fmv/fucsia.inc |  19 +
 .../builtins/cpu_model/aarch64/fmv/mrs.inc| 375 +++
 .../cpu_model/aarch64/fmv/sysauxv.inc |  17 +
 .../cpu_model/aarch64/fmv/unimplemented.inc   |  11 +
 .../cpu_model/aarch64/lse_atomics/android.inc |  28 +
 .../cpu_model/aarch64/lse_atomics/freebsd.inc |   5 +
 .../cpu_model/aarch64/lse_atomics/fucsia.inc  |  12 +
 .../cpu_model/aarch64/lse_atomics/sysauxv.inc |   6 +
 .../lib/builtins/cpu_model/cpu_model.h|  41 ++
 .../builtins/{cpu_model.c => cpu_model/x86.c} | 600 +-
 14 files changed, 729 insertions(+), 593 deletions(-)
 create mode 100644 compiler-rt/lib/builtins/cpu_model/aarch64.c
 create mode 100644 compiler-rt/lib/builtins/cpu_model/aarch64/fmv/android.inc
 create mode 100644 compiler-rt/lib/builtins/cpu_model/aarch64/fmv/freebsd.inc
 create mode 100644 compiler-rt/lib/builtins/cpu_model/aarch64/fmv/fucsia.inc
 create mode 100644 compiler-rt/lib/builtins/cpu_model/aarch64/fmv/mrs.inc
 create mode 100644 compiler-rt/lib/builtins/cpu_model/aarch64/fmv/sysauxv.inc
 create mode 100644 
compiler-rt/lib/builtins/cpu_model/aarch64/fmv/unimplemented.inc
 create mode 100644 
compiler-rt/lib/builtins/cpu_model/aarch64/lse_atomics/android.inc
 create mode 100644 
compiler-rt/lib/builtins/cpu_model/aarch64/lse_atomics/freebsd.inc
 create mode 100644 
compiler-rt/lib/builtins/cpu_model/aarch64/lse_atomics/fucsia.inc
 create mode 100644 
compiler-rt/lib/builtins/cpu_model/aarch64/lse_atomics/sysauxv.inc
 create mode 100644 compiler-rt/lib/builtins/cpu_model/cpu_model.h
 rename compiler-rt/lib/builtins/{cpu_model.c => cpu_model/x86.c} (60%)

diff --git a/compiler-rt/lib/builtins/CMakeLists.txt 
b/compiler-rt/lib/builtins/CMakeLists.txt
index ea72c595a9b807..e5b52db175d960 100644
--- a/compiler-rt/lib/builtins/CMakeLists.txt
+++ b/compiler-rt/lib/builtins/CMakeLists.txt
@@ -271,7 +271,7 @@ endif()
 
 # These files are used on 32-bit and 64-bit x86.
 set(x86_ARCH_SOURCES
-  cpu_model.c
+  cpu_model/x86.c
   )
 
 if (NOT MSVC)
@@ -556,7 +556,7 @@ endif()
 set(aarch64_SOURCES
   ${GENERIC_TF_SOURCES}
   ${GENERIC_SOURCES}
-  cpu_model.c
+  cpu_model/aarch64.c
   aarch64/fp_mode.c
 )
 
diff --git a/compiler-rt/lib/builtins/cpu_model/aarch64.c 
b/compiler-rt/lib/builtins/cpu_model/aarch64.c
new file mode 100644
index 00..98b0c4433d01a1
--- /dev/null
+++ b/compiler-rt/lib/builtins/cpu_model/aarch64.c
@@ -0,0 +1,142 @@
+//===-- cpu_model_aarch64.c - Support for __cpu_model builtin  *- C 
-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+//
+//  This file is based on LLVM's lib/Support/Host.cpp.
+//  It implements __aarch64_have_lse_atomics, __aarch64_cpu_features for 
AArch64.
+//
+//===--===//
+
+#include "cpu_model.h"
+
+#if !defined(__aarch64__)
+#  error This file is intended only for aarch64-based targets
+#endif
+
+
+#if __has_include()
+#include 
+#else
+typedef struct __ifunc_arg_t {
+  unsigned long _size;
+  unsigned long _hwcap;
+  unsigned long _hwcap2;
+} __ifunc_arg_t;
+#endif // __has_include()
+
+
+// LSE support detection for out-of-line atomics
+// using HWCAP and Auxiliary vector
+_Bool __aarch64_have_lse_atomics
+__attribute__((visibility("hidden"), nocommon)) = false;
+
+#if defined(__FreeBSD__)
+#  include "lse_atomics/freebsd.inc"
+#elif defined(__Fucsia__)
+#  include "lse_atomics/fucsia.inc"
+#elif defined(__ANDROID__)
+#  include "lse_atomics/android.inc"
+#elif __has_include()
+#  include "lse_atomics/sysauxv.inc"
+#else
+// When unimplemented, we leave __aarch64_have_lse_atomics initialized to 
false.
+#endif
+
+
+#if !defined(DISABLE_AARCH64_FMV)
+// CPUFeatures must correspond to the same AArch64 features in
+// AArch64TargetParser.h
+enum CPUFeatures {
+  FEAT_RNG,
+  FEAT_FLAGM,
+  FEAT_FLAGM2,
+  FEAT_FP16FML,
+  FEAT_DOTPROD,
+  FEAT_SM4,
+  FEAT_RDM,
+  FEAT_LSE,
+  FEAT_FP,
+  FEAT_SIMD,
+  FEAT_CRC,
+  FEAT_SHA1,
+  FEAT_SHA2,
+  FEAT_SHA3,
+  FEAT_AES,
+  FEAT_PMULL,
+  FEAT_FP16,
+  FEAT_DIT

[Lldb-commits] [libcxx] [compiler-rt] [libunwind] [llvm] [clang] [libc] [flang] [clang-tools-extra] [lldb] [libc++] Implement ranges::iota (PR #68494)

2023-12-19 Thread James E T Smith via lldb-commits

https://github.com/jamesETsmith updated 
https://github.com/llvm/llvm-project/pull/68494

>From c4a3ccfbad090ad8314aa8ad53092edc8d5432bc Mon Sep 17 00:00:00 2001
From: James Smith 
Date: Thu, 28 Sep 2023 10:11:15 -0400
Subject: [PATCH 01/18] [libc++] Implement ranges::iota and
 ranges::out_value_result

---
 libcxx/include/CMakeLists.txt |   2 +
 libcxx/include/__algorithm/out_value_result.h |  52 +
 libcxx/include/__numeric/ranges_iota.h|  53 +
 libcxx/include/algorithm  |   4 +
 libcxx/include/numeric|   1 +
 libcxx/include/version|   2 +-
 .../out_value_result.pass.cpp | 102 ++
 .../numeric.iota/ranges.iota.pass.cpp |  52 +
 8 files changed, 267 insertions(+), 1 deletion(-)
 create mode 100644 libcxx/include/__algorithm/out_value_result.h
 create mode 100644 libcxx/include/__numeric/ranges_iota.h
 create mode 100644 
libcxx/test/std/algorithms/algorithms.results/out_value_result.pass.cpp
 create mode 100644 
libcxx/test/std/numerics/numeric.ops/numeric.iota/ranges.iota.pass.cpp

diff --git a/libcxx/include/CMakeLists.txt b/libcxx/include/CMakeLists.txt
index 2ec755236dbaee..c6eb03f1d68e98 100644
--- a/libcxx/include/CMakeLists.txt
+++ b/libcxx/include/CMakeLists.txt
@@ -63,6 +63,7 @@ set(files
   __algorithm/next_permutation.h
   __algorithm/none_of.h
   __algorithm/nth_element.h
+  __algorithm/out_value_result.h
   __algorithm/partial_sort.h
   __algorithm/partial_sort_copy.h
   __algorithm/partition.h
@@ -561,6 +562,7 @@ set(files
   __numeric/partial_sum.h
   __numeric/pstl_reduce.h
   __numeric/pstl_transform_reduce.h
+  __numeric/ranges_iota.h
   __numeric/reduce.h
   __numeric/transform_exclusive_scan.h
   __numeric/transform_inclusive_scan.h
diff --git a/libcxx/include/__algorithm/out_value_result.h 
b/libcxx/include/__algorithm/out_value_result.h
new file mode 100644
index 00..8baffec7b9ef4d
--- /dev/null
+++ b/libcxx/include/__algorithm/out_value_result.h
@@ -0,0 +1,52 @@
+// -*- C++ -*-
+//===--===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#ifndef _LIBCPP___ALGORITHM_OUT_VALUE_RESULT_H
+#define _LIBCPP___ALGORITHM_OUT_VALUE_RESULT_H
+
+#include <__concepts/convertible_to.h>
+#include <__config>
+#include <__utility/move.h>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#  pragma GCC system_header
+#endif
+
+_LIBCPP_PUSH_MACROS
+#include <__undef_macros>
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+#if _LIBCPP_STD_VER >= 23
+
+namespace ranges {
+
+template 
+struct out_value_result {
+  _LIBCPP_NO_UNIQUE_ADDRESS _OutIter1 out;
+  _LIBCPP_NO_UNIQUE_ADDRESS _ValType1 value;
+
+  template 
+requires convertible_to && 
convertible_to
+  constexpr operator out_value_result<_OutIter2, _ValType2>() const& { return 
{out, value}; }
+
+  template 
+requires convertible_to<_OutIter1, _OutIter2> && convertible_to<_ValType1, 
_ValType2>
+  constexpr operator out_value_result<_OutIter2, _ValType2>() && { return 
{std::move(out), std::move(value)}; }
+};
+
+} // namespace ranges
+
+#endif // _LIBCPP_STD_VER >= 23
+
+_LIBCPP_END_NAMESPACE_STD
+
+_LIBCPP_POP_MACROS
+
+#endif // _LIBCPP___ALGORITHM_OUT_VALUE_RESULT_H
diff --git a/libcxx/include/__numeric/ranges_iota.h 
b/libcxx/include/__numeric/ranges_iota.h
new file mode 100644
index 00..20311a68c2a348
--- /dev/null
+++ b/libcxx/include/__numeric/ranges_iota.h
@@ -0,0 +1,53 @@
+// -*- C++ -*-
+//===--===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#ifndef _LIBCPP___NUMERIC_RANGES_IOTA_H
+#define _LIBCPP___NUMERIC_RANGES_IOTA_H
+
+#include <__algorithm/out_value_result.h>
+#include <__config>
+#include <__ranges/concepts.h>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#  pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+#if _LIBCPP_STD_VER >= 23
+namespace ranges {
+template 
+using iota_result = ranges::out_value_result<_Out, _Tp>;
+
+struct __iota_fn {
+  template  _Sent, 
weakly_incrementable _Tp>
+requires indirectly_writable<_Out, const _Tp&>
+  constexpr iota_result<_Out, _Tp> operator()(_Out __first, _Sent __last, _Tp 
__value) const {
+while (__first != __last) {
+  *__first = static_cast(__value);
+  ++__first;
+  ++__value;
+}
+return {std::move(__first), std::move(__value)};
+

[Lldb-commits] [lldb] 970152b - [lldb] Add issue link for TestUniqueTypes4.py Windows skip

2023-12-19 Thread David Spickett via lldb-commits

Author: David Spickett
Date: 2023-12-19T14:25:23Z
New Revision: 970152bec1ca2e9a924fb8dc92d098bd110b4dae

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

LOG: [lldb] Add issue link for TestUniqueTypes4.py Windows skip

The changes to this test uncovered a pre-existing issue that I've
documented in the linked issue.

Added: 


Modified: 
lldb/test/API/lang/cpp/unique-types4/TestUniqueTypes4.py

Removed: 




diff  --git a/lldb/test/API/lang/cpp/unique-types4/TestUniqueTypes4.py 
b/lldb/test/API/lang/cpp/unique-types4/TestUniqueTypes4.py
index 876e4fe9eedab3..30d49ebe09662a 100644
--- a/lldb/test/API/lang/cpp/unique-types4/TestUniqueTypes4.py
+++ b/lldb/test/API/lang/cpp/unique-types4/TestUniqueTypes4.py
@@ -31,13 +31,13 @@ def do_test(self, debug_flags):
 self.expect_expr("ns::FooDouble::value", result_type="double", 
result_value="0")
 self.expect_expr("ns::FooInt::value", result_type="int", 
result_value="0")
 
-@skipIfWindows  # Skip on windows until we can track down why this stopped 
working
+@skipIfWindows # https://github.com/llvm/llvm-project/issues/75936
 @skipIf(compiler=no_match("clang"))
 @skipIf(compiler_version=["<", "15.0"])
 def test_simple_template_names(self):
 self.do_test(dict(CFLAGS_EXTRAS="-gsimple-template-names"))
 
-@skipIfWindows  # Skip on windows until we can track down why this stopped 
working
+@skipIfWindows # https://github.com/llvm/llvm-project/issues/75936
 @skipIf(compiler=no_match("clang"))
 @skipIf(compiler_version=["<", "15.0"])
 def test_no_simple_template_names(self):



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


[Lldb-commits] [lldb] Trying to fix windows buildbots after #74786 (PR #75566)

2023-12-19 Thread David Spickett via lldb-commits

DavidSpickett wrote:

The PDB was not the issue, it's always worked that way and the DWARF is still 
in the main executable.

I've opened https://github.com/llvm/llvm-project/issues/75936 for 
`TestUniqueTypes4.py` because I think this commit did not break the test that 
already existed, but in changing what the test looked for, uncovered a problem 
that was already there.

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


[Lldb-commits] [lldb] [lldb][DWARF] Search for symbols in all external modules (PR #75927)

2023-12-19 Thread Michael Buch via lldb-commits

Michael137 wrote:

> I would have thought 
> `lldb/test/API/lang/cpp/gmodules/templates/TestGModules.py` would have failed 
> then as it has >1 module.
> 
> Do you know what "external module" means in this context, as opposed to just 
> module? The code searches "the clang Module" first, then the external modules.

Looks like external module are `DW_TAG_compile_unit`s that have a 
`DW_AT_GNU_dwo_name` breadcrumb pointing to some module (described here: 
https://lldb.llvm.org/resources/extensions.html)

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


[Lldb-commits] [lldb] [lldb][DWARF] Search for symbols in all external modules (PR #75927)

2023-12-19 Thread David Spickett via lldb-commits

DavidSpickett wrote:

I would have thought 
`lldb/test/API/lang/cpp/gmodules/templates/TestGModules.py` would have failed 
then as it has >1 module.

Do you know what "external module" means in this context, as opposed to just 
module? The code searches "the clang Module" first, then the external modules. 

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


[Lldb-commits] [lldb] [lldb][DWARF] Search for symbols in all external modules (PR #75927)

2023-12-19 Thread Michael Buch via lldb-commits

Michael137 wrote:

> Would the whole test suite have to be built with modules enabled?

Hmmm we used to have a debug-info category for `gmodules` which ran each test 
with `-gmodules`. But in the vast majority of cases that wasn't actually adding 
any useful coverage. There's a handful of `gmodules` tests in 
`lldb/test/API/lang/cpp/gmodules`, but looks like they don't cover this 
codepath.

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


[Lldb-commits] [lldb] [lldb][DWARF] Search for symbols in all external modules (PR #75927)

2023-12-19 Thread Michael Buch via lldb-commits

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

LGTM

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


[Lldb-commits] [libcxx] [libc] [clang] [lldb] [libcxxabi] [libunwind] [lld] [compiler-rt] [llvm] [clang-tools-extra] [flang] [mlir] [asan] Install `pthread_atfork` (PR #75290)

2023-12-19 Thread Rainer Orth via lldb-commits

rorth wrote:

It took me a bit to notice this snippet in `sanitizer_solaris.cpp`:
```
DECLARE__REAL_AND_INTERNAL(int, fork, void) {
  // TODO(glider): this may call user's pthread_atfork() handlers which is bad.
  return _REAL(fork)();
}
```
which didn't show up in searches for `internal_fork`.

>From what I could learn from `libc` disassembly and the OpenSolaris sources, 
>the only way to avoid the handlers on Solaris is to invoke the syscall 
>directly.  This is highly unportable, however: syscalls are an implemention 
>detail that can (and **does**) change.  There's reasonable hope that this 
>won't happen for the remaining livetime of Solaris 11.4, though.

I'll give such a patch a try...

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


[Lldb-commits] [lldb] [lldb][DWARF] Search for symbols in all external modules (PR #75927)

2023-12-19 Thread David Spickett via lldb-commits

DavidSpickett wrote:

`lldb/include/lldb/Symbol/CompileUnit.h`

```
  /// \param[in] lambda
  /// The lambda that should be applied to every function. The lambda can
  /// return true if the iteration should be aborted earlier.
  ///
  /// \return
  /// If the lambda early-exited, this function returns true to
  /// propagate the early exit.
  virtual bool ForEachExternalModule(
  llvm::DenseSet &visited_symbol_files,
  llvm::function_ref lambda);
```
I would have guessed true means continue.

Also, changing this didn't break any tests. So it would be nice to cover this 
but I don't know how. Would the whole test suite have to be built with modules 
enabled?

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


[Lldb-commits] [lldb] [lldb][DWARF] Search for symbols in all external modules (PR #75927)

2023-12-19 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: David Spickett (DavidSpickett)


Changes

The way this code was updated in dd9587795811ba21e6ca6ad52b4531e17e6babd6 meant 
that if the first module did not have the symbol, the iteration stopped as 
returning true means stop. So only if every module had the symbol would we find 
it, in the last module.

Invert the condition to break when we find the first instance, which is what 
the previous code did.

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


1 Files Affected:

- (modified) lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp 
(+1-1) 


``diff
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
index 334876620249fc..a07fa760b1b401 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -175,7 +175,7 @@ TypeSP DWARFASTParserClang::ParseTypeFromClangModule(const 
SymbolContext &sc,
 *sc.comp_unit, results.GetSearchedSymbolFiles(), [&](Module &module) {
   module.FindTypes(query, results);
   pcm_type_sp = results.GetTypeMap().FirstType();
-  return !pcm_type_sp;
+  return pcm_type_sp != nullptr;
 });
   }
 

``




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


[Lldb-commits] [lldb] [lldb][DWARF] Search for symbols in all external modules (PR #75927)

2023-12-19 Thread David Spickett via lldb-commits

https://github.com/DavidSpickett edited 
https://github.com/llvm/llvm-project/pull/75927
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb][DWARF] Searchfor symbols in all external modules (PR #75927)

2023-12-19 Thread David Spickett via lldb-commits

https://github.com/DavidSpickett created 
https://github.com/llvm/llvm-project/pull/75927

The way this code was updated in dd9587795811ba21e6ca6ad52b4531e17e6babd6 meant 
that if the first module did not have the symbol, the iteration stopped as 
returning true means stop. So only if every module had the symbol would we find 
it, in the last module.

Invert the condition to break when we find the first instance, which is what 
the previous code did.

>From 2ad3331abd42fee243a9077eeb1117b0bbbdb64c Mon Sep 17 00:00:00 2001
From: David Spickett 
Date: Tue, 19 Dec 2023 12:46:54 +
Subject: [PATCH] [lldb][DWARF] Searchfor symbols in all external modules

The way this code was updated in dd9587795811ba21e6ca6ad52b4531e17e6babd6
meant that if the first module did not have the symbol, the iteration stopped
as returning true means stop. So only if every module had the symbol would we 
find it,
in the last module.

Invert the condition to break when we find the first instance,
which is what the previous code did.
---
 lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
index 334876620249fc..a07fa760b1b401 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -175,7 +175,7 @@ TypeSP DWARFASTParserClang::ParseTypeFromClangModule(const 
SymbolContext &sc,
 *sc.comp_unit, results.GetSearchedSymbolFiles(), [&](Module &module) {
   module.FindTypes(query, results);
   pcm_type_sp = results.GetTypeMap().FirstType();
-  return !pcm_type_sp;
+  return pcm_type_sp != nullptr;
 });
   }
 

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


[Lldb-commits] [lldb] [lldb] Fix a quirk in SBValue::GetDescription (PR #75793)

2023-12-19 Thread Pavel Labath via lldb-commits

labath wrote:

Fixed by https://github.com/llvm/llvm-project/pull/75908.

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


[Lldb-commits] [lldb] [lldb][Type] Add TypeQuery::SetLanguages API (PR #75926)

2023-12-19 Thread Michael Buch via lldb-commits

Michael137 wrote:

Trying to add tests for this in `SymbolFileDWARFTests`

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


[Lldb-commits] [lldb] [lldb][Type] Add TypeQuery::SetLanguages API (PR #75926)

2023-12-19 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Michael Buch (Michael137)


Changes

This is required for users of `TypeQuery` that limit the set of languages of 
the query using APIs such as `GetSupportedLanguagesForTypes` or 
`GetSupportedLanguagesForExpressions`.

Example usage: https://github.com/apple/llvm-project/pull/7885

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


2 Files Affected:

- (modified) lldb/include/lldb/Symbol/Type.h (+4) 
- (modified) lldb/source/Symbol/Type.cpp (+4) 


``diff
diff --git a/lldb/include/lldb/Symbol/Type.h b/lldb/include/lldb/Symbol/Type.h
index 307be6c55e0161..acd1a769f13cd6 100644
--- a/lldb/include/lldb/Symbol/Type.h
+++ b/lldb/include/lldb/Symbol/Type.h
@@ -247,6 +247,10 @@ class TypeQuery {
   /// match.
   void AddLanguage(lldb::LanguageType language);
 
+  /// Set the list of languages that should produce a match to only the ones
+  /// specified in \ref languages.
+  void SetLanguages(LanguageSet languages);
+
   /// Check if the language matches any languages that have been added to this
   /// match object.
   ///
diff --git a/lldb/source/Symbol/Type.cpp b/lldb/source/Symbol/Type.cpp
index 293fe1b78f4a54..6069d066eaf66b 100644
--- a/lldb/source/Symbol/Type.cpp
+++ b/lldb/source/Symbol/Type.cpp
@@ -145,6 +145,10 @@ void TypeQuery::AddLanguage(LanguageType language) {
   m_languages->Insert(language);
 }
 
+void TypeQuery::SetLanguages(LanguageSet languages) {
+  m_languages = std::move(languages);
+}
+
 bool TypeQuery::ContextMatches(
 llvm::ArrayRef context_chain) const {
   if (GetExactMatch() || context_chain.size() == m_context.size())

``




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


[Lldb-commits] [lldb] [lldb][Type] Add TypeQuery::SetLanguages API (PR #75926)

2023-12-19 Thread Michael Buch via lldb-commits

https://github.com/Michael137 created 
https://github.com/llvm/llvm-project/pull/75926

This is required for users of `TypeQuery` that limit the set of languages of 
the query using APIs such as `GetSupportedLanguagesForTypes` or 
`GetSupportedLanguagesForExpressions`.

Example usage: https://github.com/apple/llvm-project/pull/7885

>From c322019bda30595d4ac551b519cace24937dccde Mon Sep 17 00:00:00 2001
From: Michael Buch 
Date: Tue, 19 Dec 2023 12:29:17 +
Subject: [PATCH] [lldb][Type] Add TypeQuery::SetLanguages API

This is required for users of `TypeQuery` that limit
the set of languages of the query using APIs such as
`GetSupportedLanguagesForTypes` or
`GetSupportedLanguagesForExpressions`.
---
 lldb/include/lldb/Symbol/Type.h | 4 
 lldb/source/Symbol/Type.cpp | 4 
 2 files changed, 8 insertions(+)

diff --git a/lldb/include/lldb/Symbol/Type.h b/lldb/include/lldb/Symbol/Type.h
index 307be6c55e0161..acd1a769f13cd6 100644
--- a/lldb/include/lldb/Symbol/Type.h
+++ b/lldb/include/lldb/Symbol/Type.h
@@ -247,6 +247,10 @@ class TypeQuery {
   /// match.
   void AddLanguage(lldb::LanguageType language);
 
+  /// Set the list of languages that should produce a match to only the ones
+  /// specified in \ref languages.
+  void SetLanguages(LanguageSet languages);
+
   /// Check if the language matches any languages that have been added to this
   /// match object.
   ///
diff --git a/lldb/source/Symbol/Type.cpp b/lldb/source/Symbol/Type.cpp
index 293fe1b78f4a54..6069d066eaf66b 100644
--- a/lldb/source/Symbol/Type.cpp
+++ b/lldb/source/Symbol/Type.cpp
@@ -145,6 +145,10 @@ void TypeQuery::AddLanguage(LanguageType language) {
   m_languages->Insert(language);
 }
 
+void TypeQuery::SetLanguages(LanguageSet languages) {
+  m_languages = std::move(languages);
+}
+
 bool TypeQuery::ContextMatches(
 llvm::ArrayRef context_chain) const {
   if (GetExactMatch() || context_chain.size() == m_context.size())

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


  1   2   >