[Lldb-commits] [pstl] [lldb] [llvm] [openmp] [clang-tools-extra] [libcxx] [lld] [mlir] [clang] [ELF] Don't resolve relocations referencing SHN_ABS to tombstone in non-SHF_ALLOC sections (PR #79238)

2024-01-24 Thread Fangrui Song via lldb-commits

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


[Lldb-commits] [lld] [clang] [llvm] [mlir] [pstl] [libcxx] [openmp] [lldb] [clang-tools-extra] [ELF] Don't resolve relocations referencing SHN_ABS to tombstone in non-SHF_ALLOC sections (PR #79238)

2024-01-24 Thread Fangrui Song via lldb-commits

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

>From 97b500a7061041b5478b6b1b1094e76140e3d9c3 Mon Sep 17 00:00:00 2001
From: Fangrui Song 
Date: Tue, 23 Jan 2024 17:53:31 -0800
Subject: [PATCH] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20initia?=
 =?UTF-8?q?l=20version?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Created using spr 1.3.4
---
 lld/ELF/InputSection.cpp  | 13 ++---
 lld/test/ELF/dead-reloc-in-nonalloc.s |  2 +-
 2 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/lld/ELF/InputSection.cpp b/lld/ELF/InputSection.cpp
index c728dd6c6306aa..0e0b9783bd88a0 100644
--- a/lld/ELF/InputSection.cpp
+++ b/lld/ELF/InputSection.cpp
@@ -961,12 +961,11 @@ void InputSection::relocateNonAlloc(uint8_t *buf, 
ArrayRef rels) {
   // vector. The computed value is st_value plus a non-negative offset.
   // Negative values are invalid, so -1 can be used as the tombstone value.
   //
-  // If the referenced symbol is discarded (made Undefined), or the
-  // section defining the referenced symbol is garbage collected,
-  // sym.getOutputSection() is nullptr. `ds->folded` catches the ICF folded
-  // case. However, resolving a relocation in .debug_line to -1 would stop
-  // debugger users from setting breakpoints on the folded-in function, so
-  // exclude .debug_line.
+  // If the referenced symbol is relative to a discarded section (due to
+  // --gc-sections, COMDAT, etc), it has been converted to a Undefined.
+  // `ds->folded` catches the ICF folded case. However, resolving a
+  // relocation in .debug_line to -1 would stop debugger users from setting
+  // breakpoints on the folded-in function, so exclude .debug_line.
   //
   // For pre-DWARF-v5 .debug_loc and .debug_ranges, -1 is a reserved value
   // (base address selection entry), use 1 (which is used by GNU ld for
@@ -974,7 +973,7 @@ void InputSection::relocateNonAlloc(uint8_t *buf, 
ArrayRef rels) {
   //
   // TODO To reduce disruption, we use 0 instead of -1 as the tombstone
   // value. Enable -1 in a future release.
-  if (!sym.getOutputSection() || (ds && ds->folded && !isDebugLine)) {
+  if (!ds || (ds->folded && !isDebugLine)) {
 // If -z dead-reloc-in-nonalloc= is specified, respect it.
 uint64_t value = SignExtend64(*tombstone);
 // For a 32-bit local TU reference in .debug_names, X86_64::relocate
diff --git a/lld/test/ELF/dead-reloc-in-nonalloc.s 
b/lld/test/ELF/dead-reloc-in-nonalloc.s
index 145604eb883a9a..b675fc50fc2ea2 100644
--- a/lld/test/ELF/dead-reloc-in-nonalloc.s
+++ b/lld/test/ELF/dead-reloc-in-nonalloc.s
@@ -17,7 +17,7 @@
 # AA:  Contents of section .debug_info:
 # AA-NEXT:   [[ADDR]]   
 # AA:  Contents of section .not_debug:
-# AA-NEXT:       .
+# AA-NEXT:    2a00   .
 
 ## Specifying zero can get a behavior similar to GNU ld.
 # RUN: ld.lld --icf=all -z dead-reloc-in-nonalloc=.debug_info=0 %t.o %tabs.o 
-o %tzero

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


[Lldb-commits] [compiler-rt] [lld] [clang] [llvm] [libc] [libcxx] [lldb] [flang] [clang-tools-extra] [Clang][C++23] Implement P2448R2: Relaxing some constexpr restrictions (PR #77753)

2024-01-24 Thread Mariya Podchishchaeva via lldb-commits

Fznamznon wrote:

> CheckConstexprFunctionDefinition will return false for a destructor if 
> defaultedDestructorIsConstexpr returns false (unless we want to emit a 
> diagnostic)`

I see. So defaulted special members now *actually* constexpr. I've made that 
change. I confused everything with functions and only disabled diagnostic for 
these. Now it should work correctly.

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


[Lldb-commits] [flang] [libc] [lldb] [compiler-rt] [llvm] [clang-tools-extra] [libcxx] [lld] [clang] [Clang][C++23] Implement P2448R2: Relaxing some constexpr restrictions (PR #77753)

2024-01-24 Thread Mariya Podchishchaeva via lldb-commits


@@ -356,14 +356,7 @@ C++23 implementation status
 
   Relaxing some constexpr restrictions
   https://wg21.link/P2448R2";>P2448R2
-  
-Clang 17 (Partial)
- We do not support outside of defaulted special memeber functions the 
change that constexpr functions no
-  longer have to be constexpr compatible but rather support a less 
restricted requirements for constexpr
-  functions. Which include allowing non-literal types as return values 
and parameters, allow calling of
-  non-constexpr functions and constructors.
-
-  
+  Clang 18

Fznamznon wrote:

I suppose, I should put clang 19 here, right?

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


[Lldb-commits] [flang] [libc] [lldb] [compiler-rt] [llvm] [clang-tools-extra] [libcxx] [lld] [clang] [Clang][C++23] Implement P2448R2: Relaxing some constexpr restrictions (PR #77753)

2024-01-24 Thread Mariya Podchishchaeva via lldb-commits


@@ -9108,7 +9123,8 @@ bool Sema::CheckExplicitlyDefaultedComparison(Scope *S, 
FunctionDecl *FD,
   //   declaration, it is implicitly considered to be constexpr.
   // FIXME: Only applying this to the first declaration seems problematic, as
   // simple reorderings can affect the meaning of the program.
-  if (First && !FD->isConstexpr() && Info.Constexpr)
+  if ((First && !FD->isConstexpr() && Info.Constexpr) ||
+  getLangOpts().CPlusPlus23)

Fznamznon wrote:

This change perhaps needs a test.

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


[Lldb-commits] [llvm] [pstl] [clang] [mlir] [libcxx] [clang-tools-extra] [lld] [openmp] [lldb] [ELF] Don't resolve relocations referencing SHN_ABS to tombstone in non-SHF_ALLOC sections (PR #79238)

2024-01-24 Thread Bevin Hansson via lldb-commits

https://github.com/bevin-hansson commented:

This looks good to me, but someone else should probably chime in as well to 
approve.

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


[Lldb-commits] [lldb] [flang] [clang-tools-extra] [libcxx] [clang] [lld] [llvm] [compiler-rt] [libc] [AMDGPU][GFX12] VOP encoding and codegen - add support for v_cvt fp8/… (PR #78414)

2024-01-24 Thread Mariusz Sikora via lldb-commits
Mirko =?utf-8?q?Brkušanin?= ,
Mirko =?utf-8?q?Brkušanin?= ,Mirko Brkusanin
 ,Mariusz Sikora 
Message-ID:
In-Reply-To: 



@@ -8770,6 +8781,22 @@ void AMDGPUAsmParser::cvtVOP3DPP(MCInst &Inst, const 
OperandVector &Operands,
   }
 }
 
+int VdstInIdx = AMDGPU::getNamedOperandIdx(Opc, AMDGPU::OpName::vdst_in);
+if (VdstInIdx == static_cast(Inst.getNumOperands())) {
+  Inst.addOperand(Inst.getOperand(0));
+}
+
+bool IsVOP3CvtSrDpp = Opc == AMDGPU::V_CVT_SR_BF8_F32_e64_dpp8_gfx12 ||
+  Opc == AMDGPU::V_CVT_SR_FP8_F32_e64_dpp8_gfx12 ||
+  Opc == AMDGPU::V_CVT_SR_BF8_F32_e64_dpp_gfx12 ||
+  Opc == AMDGPU::V_CVT_SR_FP8_F32_e64_dpp_gfx12;

mariusz-sikora-at-amd wrote:

Thanks, I will prepare different PRs to cover this and what Joe pointed out.

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


[Lldb-commits] [libcxx] [mlir] [openmp] [pstl] [clang-tools-extra] [llvm] [lld] [lldb] [clang] [ELF] Don't resolve relocations referencing SHN_ABS to tombstone in non-SHF_ALLOC sections (PR #79238)

2024-01-24 Thread Peter Smith via lldb-commits

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

Code changes LGTM too. I can't think of a case when a C/C++ compiler would 
directly generate a reference to an SHN_ABS symbol as I don't think there is a 
way of expressing such a symbol in C/C++ and debug generation concentrates on 
describing entities in the same module. I've asked a colleague that knows more 
about debug generation than I do. If I get an answer I'll post another comment.

There is a typo in the description (SHN_ANS) -> (SHN_ABS)

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


[Lldb-commits] [clang-tools-extra] [flang] [compiler-rt] [lld] [llvm] [libcxx] [clang] [lldb] [libc] [Clang][C++23] Implement P2448R2: Relaxing some constexpr restrictions (PR #77753)

2024-01-24 Thread via lldb-commits


@@ -356,14 +356,7 @@ C++23 implementation status
 
   Relaxing some constexpr restrictions
   https://wg21.link/P2448R2";>P2448R2
-  
-Clang 17 (Partial)
- We do not support outside of defaulted special memeber functions the 
change that constexpr functions no
-  longer have to be constexpr compatible but rather support a less 
restricted requirements for constexpr
-  functions. Which include allowing non-literal types as return values 
and parameters, allow calling of
-  non-constexpr functions and constructors.
-
-  
+  Clang 18

cor3ntin wrote:

@AaronBallman WDYT?

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


[Lldb-commits] [clang-tools-extra] [flang] [compiler-rt] [lld] [llvm] [libcxx] [clang] [lldb] [libc] [Clang][C++23] Implement P2448R2: Relaxing some constexpr restrictions (PR #77753)

2024-01-24 Thread via lldb-commits


@@ -9108,7 +9123,8 @@ bool Sema::CheckExplicitlyDefaultedComparison(Scope *S, 
FunctionDecl *FD,
   //   declaration, it is implicitly considered to be constexpr.
   // FIXME: Only applying this to the first declaration seems problematic, as
   // simple reorderings can affect the meaning of the program.
-  if (First && !FD->isConstexpr() && Info.Constexpr)
+  if ((First && !FD->isConstexpr() && Info.Constexpr) ||
+  getLangOpts().CPlusPlus23)

cor3ntin wrote:

isn't `Info.Constexpr` always true in c++ mode?
I'm trying to think of a meaningful test.

Haybe calling a comparison function of a class with a non-literal member from a 
consteval function?




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


[Lldb-commits] [clang] [libc] [compiler-rt] [libcxx] [lldb] [pstl] [flang] [clang-tools-extra] [mlir] [openmp] [lld] [llvm] [AMDGPU][GFX12] VOP encoding and codegen - add support for v_cvt fp8/… (PR #

2024-01-24 Thread Mariusz Sikora via lldb-commits
Mirko =?utf-8?q?Brkušanin?= ,
Mirko =?utf-8?q?Brkušanin?= ,Mirko Brkusanin
 ,Mariusz Sikora 
Message-ID:
In-Reply-To: 


https://github.com/mariusz-sikora-at-amd closed 
https://github.com/llvm/llvm-project/pull/78414
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [libc] [lld] [flang] [clang] [libcxx] [compiler-rt] [llvm] [clang-tools-extra] [lldb] [Clang][C++23] Implement P2448R2: Relaxing some constexpr restrictions (PR #77753)

2024-01-24 Thread Mariya Podchishchaeva via lldb-commits


@@ -9108,7 +9123,8 @@ bool Sema::CheckExplicitlyDefaultedComparison(Scope *S, 
FunctionDecl *FD,
   //   declaration, it is implicitly considered to be constexpr.
   // FIXME: Only applying this to the first declaration seems problematic, as
   // simple reorderings can affect the meaning of the program.
-  if (First && !FD->isConstexpr() && Info.Constexpr)
+  if ((First && !FD->isConstexpr() && Info.Constexpr) ||
+  getLangOpts().CPlusPlus23)

Fznamznon wrote:

> isn't Info.Constexpr always true in c++ mode?

Hmm, then we probably don't need this change at all?

> Haybe calling a comparison function of a class with a non-literal member from 
> a consteval function?

Should the call to such function be allowed? I suppose not due to-literal 
member. The problem is, there result is same with our without this change. I 
meant to apply this:

> CheckExplicitlyDefaultedComparison should alwways set the constexpr flag in 
> c++23 mode per 
> https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2448r2.html#pnum_39

Did I misunderstand?

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


[Lldb-commits] [libcxx] [lld] [clang] [lldb] [clang-tools-extra] [flang] [libc] [compiler-rt] [llvm] [Clang][C++23] Implement P2448R2: Relaxing some constexpr restrictions (PR #77753)

2024-01-24 Thread via lldb-commits


@@ -9108,7 +9123,8 @@ bool Sema::CheckExplicitlyDefaultedComparison(Scope *S, 
FunctionDecl *FD,
   //   declaration, it is implicitly considered to be constexpr.
   // FIXME: Only applying this to the first declaration seems problematic, as
   // simple reorderings can affect the meaning of the program.
-  if (First && !FD->isConstexpr() && Info.Constexpr)
+  if ((First && !FD->isConstexpr() && Info.Constexpr) ||
+  getLangOpts().CPlusPlus23)

cor3ntin wrote:

> isn't Info.Constexpr always true in c++ mode?

**C++23**, sorry 

> Should the call to such function be allowed? I suppose not due to-literal 
> member. The problem is, there result is same with or without this change. I 
> meant to apply this

Hum right, i was thinking we could have a `if(false)` in the comparison 
function, but that's for defaulted function so it doesn't work.

The error message should be different though, right? something like "the call 
to operator== is not a constant expression" ?




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


[Lldb-commits] [lldb] [clang] [clang-tools-extra] [c++20] P1907R1: Support for generalized non-type template arguments of scalar type. (PR #78041)

2024-01-24 Thread via lldb-commits

bgra8 wrote:

@bolshakov-a this is causing a regression in the way partial template 
specializations work.

For the following reproducer the partial template specialization is not used by 
the compiler when it is expected it should be used:

```
const char kt[] = "dummy";

template 
class SomeTempl {
 public:
  explicit SomeTempl(T t) {
  }
  // The generic impl always returns 66.
  int exit_code() const { return 66; }
 private:
};

template 
class SomeTempl {
 public:
  explicit SomeTempl(int s) : exit_code_(s) {
  }
  int exit_code() const { return exit_code_; }
 private:
  int exit_code_;
};

int main() {
  SomeTempl dummy(0);
  // This should return 0.
  return dummy.exit_code();
}
```

Compile with: `clang -o /tmp/repro -x c++ /tmp/repro.cc `

It will return 0 (expected value when the specialization is used) before this 
patch and 66 (the generic impl is used) at this patch.

Could you please look into it? Reverting would be nice if a fix is necessary.

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


[Lldb-commits] [lldb] [clang] [clang-tools-extra] [c++20] P1907R1: Support for generalized non-type template arguments of scalar type. (PR #78041)

2024-01-24 Thread Andrey Ali Khan Bolshakov via lldb-commits

bolshakov-a wrote:

Thanks! I'll probably take a look in my spare time. Feel free to revert this.

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


[Lldb-commits] [lldb] [clang] [clang-tools-extra] Revert "[c++20] P1907R1: Support for generalized non-type template arguments of scalar type." (PR #79302)

2024-01-24 Thread Erich Keane via lldb-commits

https://github.com/erichkeane created 
https://github.com/llvm/llvm-project/pull/79302

Reverts llvm/llvm-project#78041

Based on this comment: 
https://github.com/llvm/llvm-project/pull/78041#issuecomment-1908243345

and the author's nonavailability to get to it quickly, we're reverting (and 
will have to revert from the release branch).  Hopefully this can be reapplied 
for 19.

>From 7d1982f62bfc9ec897d8dc8837100c6c2f2de156 Mon Sep 17 00:00:00 2001
From: Erich Keane 
Date: Wed, 24 Jan 2024 07:11:33 -0800
Subject: [PATCH] Revert "[c++20] P1907R1: Support for generalized non-type
 template arguments of scalar type."

---
 clang-tools-extra/clangd/DumpAST.cpp  |   1 -
 clang-tools-extra/clangd/FindTarget.cpp   |   1 -
 clang/include/clang/AST/ODRHash.h |   3 -
 clang/include/clang/AST/PropertiesBase.td |  14 --
 clang/include/clang/AST/RecursiveASTVisitor.h |   2 -
 .../clang/AST/TemplateArgumentVisitor.h   |   2 -
 clang/include/clang/AST/TemplateBase.h|  86 +++
 .../clang/Basic/DiagnosticSemaKinds.td|   5 +
 clang/include/clang/Sema/Sema.h   |   4 +-
 clang/lib/AST/ASTContext.cpp  |   5 -
 clang/lib/AST/ASTImporter.cpp |  13 --
 clang/lib/AST/ASTStructuralEquivalence.cpp|   3 -
 clang/lib/AST/Decl.cpp|   4 -
 clang/lib/AST/ItaniumMangle.cpp   |  36 +--
 clang/lib/AST/MicrosoftMangle.cpp |  78 ++-
 clang/lib/AST/ODRHash.cpp |  67 --
 clang/lib/AST/StmtProfile.cpp |   6 -
 clang/lib/AST/TemplateBase.cpp| 113 +
 clang/lib/AST/TypeLoc.cpp |   1 -
 clang/lib/CodeGen/CGDebugInfo.cpp |  10 -
 clang/lib/CodeGen/CGExpr.cpp  |  12 +-
 clang/lib/Index/USRGeneration.cpp |  10 -
 clang/lib/Sema/SemaLookup.cpp |   1 -
 clang/lib/Sema/SemaOverload.cpp   |  10 +-
 clang/lib/Sema/SemaTemplate.cpp   | 218 +++---
 clang/lib/Sema/SemaTemplateDeduction.cpp  |  64 ++---
 clang/lib/Sema/SemaTemplateInstantiate.cpp|  14 +-
 clang/lib/Sema/SemaTemplateVariadic.cpp   |   2 -
 clang/lib/Sema/TreeTransform.h|  12 +-
 clang/lib/Serialization/ASTReader.cpp |   1 -
 clang/lib/Serialization/ASTWriter.cpp |   1 -
 clang/test/CXX/drs/dr18xx.cpp |   4 +-
 .../CXX/temp/temp.arg/temp.arg.nontype/p1.cpp |   4 +-
 clang/test/CodeGenCXX/mangle-ms-templates.cpp |  48 
 clang/test/CodeGenCXX/mangle-template.cpp |  40 +---
 clang/test/CodeGenCXX/template-arguments.cpp  | 113 -
 .../Index/USR/structural-value-tpl-arg.cpp|  23 --
 clang/test/Modules/odr_hash.cpp   | 193 +---
 clang/test/SemaCXX/warn-bool-conversion.cpp   |   2 -
 .../SemaTemplate/temp_arg_nontype_cxx1z.cpp   |  40 ++--
 .../SemaTemplate/temp_arg_nontype_cxx20.cpp   |  40 ++--
 clang/tools/libclang/CIndex.cpp   |   5 -
 clang/tools/libclang/CXCursor.cpp |   3 -
 clang/www/cxx_status.html |  18 +-
 lldb/include/lldb/lldb-enumerations.h |   1 -
 .../TypeSystem/Clang/TypeSystemClang.cpp  |   3 -
 46 files changed, 230 insertions(+), 1106 deletions(-)
 delete mode 100644 clang/test/CodeGenCXX/template-arguments.cpp
 delete mode 100644 clang/test/Index/USR/structural-value-tpl-arg.cpp

diff --git a/clang-tools-extra/clangd/DumpAST.cpp 
b/clang-tools-extra/clangd/DumpAST.cpp
index 9a525efb938e8d5..b0cec65c39fa31d 100644
--- a/clang-tools-extra/clangd/DumpAST.cpp
+++ b/clang-tools-extra/clangd/DumpAST.cpp
@@ -143,7 +143,6 @@ class DumpVisitor : public RecursiveASTVisitor 
{
   TEMPLATE_ARGUMENT_KIND(Declaration);
   TEMPLATE_ARGUMENT_KIND(Template);
   TEMPLATE_ARGUMENT_KIND(TemplateExpansion);
-  TEMPLATE_ARGUMENT_KIND(StructuralValue);
 #undef TEMPLATE_ARGUMENT_KIND
 }
 llvm_unreachable("Unhandled ArgKind enum");
diff --git a/clang-tools-extra/clangd/FindTarget.cpp 
b/clang-tools-extra/clangd/FindTarget.cpp
index e702c6b3537a098..3d73e77b16aff4e 100644
--- a/clang-tools-extra/clangd/FindTarget.cpp
+++ b/clang-tools-extra/clangd/FindTarget.cpp
@@ -1039,7 +1039,6 @@ class ExplicitReferenceCollector
 case TemplateArgument::Pack:
 case TemplateArgument::Type:
 case TemplateArgument::Expression:
-case TemplateArgument::StructuralValue:
   break; // Handled by VisitType and VisitExpression.
 };
 return RecursiveASTVisitor::TraverseTemplateArgumentLoc(A);
diff --git a/clang/include/clang/AST/ODRHash.h 
b/clang/include/clang/AST/ODRHash.h
index a1caa6d39a87c3c..cedf644520fc320 100644
--- a/clang/include/clang/AST/ODRHash.h
+++ b/clang/include/clang/AST/ODRHash.h
@@ -25,7 +25,6 @@
 
 namespace clang {
 
-class APValue;
 class Decl;
 class IdentifierInfo;
 class NestedNameSpecifier;
@@ -102,8 +101,6 @@ class ODRHash {
   // Save booleans until the end to lower the si

[Lldb-commits] [lldb] [clang] [clang-tools-extra] Revert "[c++20] P1907R1: Support for generalized non-type template arguments of scalar type." (PR #79302)

2024-01-24 Thread Erich Keane via lldb-commits

erichkeane wrote:

Waiting on CI bots, then I'll submit this revert, then request this for 
cherry-pick to the 18 branch.

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


[Lldb-commits] [lldb] [clang] [clang-tools-extra] Revert "[c++20] P1907R1: Support for generalized non-type template arguments of scalar type." (PR #79302)

2024-01-24 Thread Erich Keane via lldb-commits

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


[Lldb-commits] [lldb] [clang] [clang-tools-extra] Revert "[c++20] P1907R1: Support for generalized non-type template arguments of scalar type." (PR #79302)

2024-01-24 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 aaa93ce7323332d8290b8f563d4d71689c1094c5 
7d1982f62bfc9ec897d8dc8837100c6c2f2de156 -- 
clang-tools-extra/clangd/DumpAST.cpp clang-tools-extra/clangd/FindTarget.cpp 
clang/include/clang/AST/ODRHash.h clang/include/clang/AST/RecursiveASTVisitor.h 
clang/include/clang/AST/TemplateArgumentVisitor.h 
clang/include/clang/AST/TemplateBase.h clang/include/clang/Sema/Sema.h 
clang/lib/AST/ASTContext.cpp clang/lib/AST/ASTImporter.cpp 
clang/lib/AST/ASTStructuralEquivalence.cpp clang/lib/AST/Decl.cpp 
clang/lib/AST/ItaniumMangle.cpp clang/lib/AST/MicrosoftMangle.cpp 
clang/lib/AST/ODRHash.cpp clang/lib/AST/StmtProfile.cpp 
clang/lib/AST/TemplateBase.cpp clang/lib/AST/TypeLoc.cpp 
clang/lib/CodeGen/CGDebugInfo.cpp clang/lib/CodeGen/CGExpr.cpp 
clang/lib/Index/USRGeneration.cpp clang/lib/Sema/SemaLookup.cpp 
clang/lib/Sema/SemaOverload.cpp clang/lib/Sema/SemaTemplate.cpp 
clang/lib/Sema/SemaTemplateDeduction.cpp 
clang/lib/Sema/SemaTemplateInstantiate.cpp 
clang/lib/Sema/SemaTemplateVariadic.cpp clang/lib/Sema/TreeTransform.h 
clang/lib/Serialization/ASTReader.cpp clang/lib/Serialization/ASTWriter.cpp 
clang/test/CXX/drs/dr18xx.cpp 
clang/test/CXX/temp/temp.arg/temp.arg.nontype/p1.cpp 
clang/test/CodeGenCXX/mangle-ms-templates.cpp 
clang/test/CodeGenCXX/mangle-template.cpp clang/test/Modules/odr_hash.cpp 
clang/test/SemaCXX/warn-bool-conversion.cpp 
clang/test/SemaTemplate/temp_arg_nontype_cxx1z.cpp 
clang/test/SemaTemplate/temp_arg_nontype_cxx20.cpp 
clang/tools/libclang/CIndex.cpp clang/tools/libclang/CXCursor.cpp 
lldb/include/lldb/lldb-enumerations.h 
lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
``





View the diff from clang-format here.


``diff
diff --git a/clang/include/clang/AST/TemplateBase.h 
b/clang/include/clang/AST/TemplateBase.h
index b7cd71f17c..d5e348eb50 100644
--- a/clang/include/clang/AST/TemplateBase.h
+++ b/clang/include/clang/AST/TemplateBase.h
@@ -297,7 +297,7 @@ public:
   /// Retrieve the type for a type template argument.
   QualType getAsType() const {
 assert(getKind() == Type && "Unexpected kind");
-return QualType::getFromOpaquePtr(reinterpret_cast(TypeOrValue.V));
+return QualType::getFromOpaquePtr(reinterpret_cast(TypeOrValue.V));
   }
 
   /// Retrieve the declaration for a declaration non-type
@@ -315,7 +315,7 @@ public:
   /// Retrieve the type for null non-type template argument.
   QualType getNullPtrType() const {
 assert(getKind() == NullPtr && "Unexpected kind");
-return QualType::getFromOpaquePtr(reinterpret_cast(TypeOrValue.V));
+return QualType::getFromOpaquePtr(reinterpret_cast(TypeOrValue.V));
   }
 
   /// Retrieve the template name for a template name argument.
@@ -541,13 +541,9 @@ public:
   /// - Fetches the full source range of the argument.
   SourceRange getSourceRange() const LLVM_READONLY;
 
-  const TemplateArgument &getArgument() const {
-return Argument;
-  }
+  const TemplateArgument &getArgument() const { return Argument; }
 
-  TemplateArgumentLocInfo getLocInfo() const {
-return LocInfo;
-  }
+  TemplateArgumentLocInfo getLocInfo() const { return LocInfo; }
 
   TypeSourceInfo *getTypeSourceInfo() const {
 if (Argument.getKind() != TemplateArgument::Type)
@@ -606,8 +602,7 @@ class TemplateArgumentListInfo {
 public:
   TemplateArgumentListInfo() = default;
 
-  TemplateArgumentListInfo(SourceLocation LAngleLoc,
-   SourceLocation RAngleLoc)
+  TemplateArgumentListInfo(SourceLocation LAngleLoc, SourceLocation RAngleLoc)
   : LAngleLoc(LAngleLoc), RAngleLoc(RAngleLoc) {}
 
   // This can leak if used in an AST node, use ASTTemplateArgumentListInfo
@@ -626,21 +621,15 @@ public:
 return Arguments.data();
   }
 
-  llvm::ArrayRef arguments() const {
-return Arguments;
-  }
+  llvm::ArrayRef arguments() const { return Arguments; }
 
   const TemplateArgumentLoc &operator[](unsigned I) const {
 return Arguments[I];
   }
 
-  TemplateArgumentLoc &operator[](unsigned I) {
-return Arguments[I];
-  }
+  TemplateArgumentLoc &operator[](unsigned I) { return Arguments[I]; }
 
-  void addArgument(const TemplateArgumentLoc &Loc) {
-Arguments.push_back(Loc);
-  }
+  void addArgument(const TemplateArgumentLoc &Loc) { Arguments.push_back(Loc); 
}
 };
 
 /// Represents an explicit template argument list in C++, e.g.,
diff --git a/clang/lib/AST/ODRHash.cpp b/clang/lib/AST/ODRHash.cpp
index c5aa91a81d..2ed26754db 100644
--- a/clang/lib/AST/ODRHash.cpp
+++ b/clang/lib/AST/ODRHash.cpp
@@ -1293,6 +1293,4 @@ void ODRHash::AddQualType(QualType T) {
   AddType(split.Ty);
 }
 
-void ODRHash::AddBoolean(bool Value) {
-  Bools.push_back(Value);
-}
+void ODRHash::AddBoolean(bool Value) { Bools.push_back(Value); }
diff --git a/clang/lib/Sema/SemaTemplate.cpp b/clang/lib

[Lldb-commits] [clang-tools-extra] [lldb] [clang] Revert "[c++20] P1907R1: Support for generalized non-type template arguments of scalar type." (PR #79302)

2024-01-24 Thread via lldb-commits

llvmbot wrote:



@llvm/pr-subscribers-debuginfo
@llvm/pr-subscribers-clang-tools-extra

@llvm/pr-subscribers-clang-codegen

Author: Erich Keane (erichkeane)


Changes

Reverts llvm/llvm-project#78041

Based on this comment: 
https://github.com/llvm/llvm-project/pull/78041#issuecomment-1908243345

and the author's nonavailability to get to it quickly, we're reverting (and 
will have to revert from the release branch).  Hopefully this can be reapplied 
for 19.

---

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


46 Files Affected:

- (modified) clang-tools-extra/clangd/DumpAST.cpp (-1) 
- (modified) clang-tools-extra/clangd/FindTarget.cpp (-1) 
- (modified) clang/include/clang/AST/ODRHash.h (-3) 
- (modified) clang/include/clang/AST/PropertiesBase.td (-14) 
- (modified) clang/include/clang/AST/RecursiveASTVisitor.h (-2) 
- (modified) clang/include/clang/AST/TemplateArgumentVisitor.h (-2) 
- (modified) clang/include/clang/AST/TemplateBase.h (+31-55) 
- (modified) clang/include/clang/Basic/DiagnosticSemaKinds.td (+5) 
- (modified) clang/include/clang/Sema/Sema.h (+2-2) 
- (modified) clang/lib/AST/ASTContext.cpp (-5) 
- (modified) clang/lib/AST/ASTImporter.cpp (-13) 
- (modified) clang/lib/AST/ASTStructuralEquivalence.cpp (-3) 
- (modified) clang/lib/AST/Decl.cpp (-4) 
- (modified) clang/lib/AST/ItaniumMangle.cpp (+2-34) 
- (modified) clang/lib/AST/MicrosoftMangle.cpp (+16-62) 
- (modified) clang/lib/AST/ODRHash.cpp (-67) 
- (modified) clang/lib/AST/StmtProfile.cpp (-6) 
- (modified) clang/lib/AST/TemplateBase.cpp (+3-110) 
- (modified) clang/lib/AST/TypeLoc.cpp (-1) 
- (modified) clang/lib/CodeGen/CGDebugInfo.cpp (-10) 
- (modified) clang/lib/CodeGen/CGExpr.cpp (+3-9) 
- (modified) clang/lib/Index/USRGeneration.cpp (-10) 
- (modified) clang/lib/Sema/SemaLookup.cpp (-1) 
- (modified) clang/lib/Sema/SemaOverload.cpp (+1-9) 
- (modified) clang/lib/Sema/SemaTemplate.cpp (+88-130) 
- (modified) clang/lib/Sema/SemaTemplateDeduction.cpp (+18-46) 
- (modified) clang/lib/Sema/SemaTemplateInstantiate.cpp (+8-6) 
- (modified) clang/lib/Sema/SemaTemplateVariadic.cpp (-2) 
- (modified) clang/lib/Sema/TreeTransform.h (+2-10) 
- (modified) clang/lib/Serialization/ASTReader.cpp (-1) 
- (modified) clang/lib/Serialization/ASTWriter.cpp (-1) 
- (modified) clang/test/CXX/drs/dr18xx.cpp (+2-2) 
- (modified) clang/test/CXX/temp/temp.arg/temp.arg.nontype/p1.cpp (+1-3) 
- (modified) clang/test/CodeGenCXX/mangle-ms-templates.cpp (-48) 
- (modified) clang/test/CodeGenCXX/mangle-template.cpp (+1-39) 
- (removed) clang/test/CodeGenCXX/template-arguments.cpp (-113) 
- (removed) clang/test/Index/USR/structural-value-tpl-arg.cpp (-23) 
- (modified) clang/test/Modules/odr_hash.cpp (+3-190) 
- (modified) clang/test/SemaCXX/warn-bool-conversion.cpp (-2) 
- (modified) clang/test/SemaTemplate/temp_arg_nontype_cxx1z.cpp (+21-19) 
- (modified) clang/test/SemaTemplate/temp_arg_nontype_cxx20.cpp (+18-22) 
- (modified) clang/tools/libclang/CIndex.cpp (-5) 
- (modified) clang/tools/libclang/CXCursor.cpp (-3) 
- (modified) clang/www/cxx_status.html (+5-13) 
- (modified) lldb/include/lldb/lldb-enumerations.h (-1) 
- (modified) lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp (-3) 


``diff
diff --git a/clang-tools-extra/clangd/DumpAST.cpp 
b/clang-tools-extra/clangd/DumpAST.cpp
index 9a525efb938e8d5..b0cec65c39fa31d 100644
--- a/clang-tools-extra/clangd/DumpAST.cpp
+++ b/clang-tools-extra/clangd/DumpAST.cpp
@@ -143,7 +143,6 @@ class DumpVisitor : public RecursiveASTVisitor 
{
   TEMPLATE_ARGUMENT_KIND(Declaration);
   TEMPLATE_ARGUMENT_KIND(Template);
   TEMPLATE_ARGUMENT_KIND(TemplateExpansion);
-  TEMPLATE_ARGUMENT_KIND(StructuralValue);
 #undef TEMPLATE_ARGUMENT_KIND
 }
 llvm_unreachable("Unhandled ArgKind enum");
diff --git a/clang-tools-extra/clangd/FindTarget.cpp 
b/clang-tools-extra/clangd/FindTarget.cpp
index e702c6b3537a098..3d73e77b16aff4e 100644
--- a/clang-tools-extra/clangd/FindTarget.cpp
+++ b/clang-tools-extra/clangd/FindTarget.cpp
@@ -1039,7 +1039,6 @@ class ExplicitReferenceCollector
 case TemplateArgument::Pack:
 case TemplateArgument::Type:
 case TemplateArgument::Expression:
-case TemplateArgument::StructuralValue:
   break; // Handled by VisitType and VisitExpression.
 };
 return RecursiveASTVisitor::TraverseTemplateArgumentLoc(A);
diff --git a/clang/include/clang/AST/ODRHash.h 
b/clang/include/clang/AST/ODRHash.h
index a1caa6d39a87c3c..cedf644520fc320 100644
--- a/clang/include/clang/AST/ODRHash.h
+++ b/clang/include/clang/AST/ODRHash.h
@@ -25,7 +25,6 @@
 
 namespace clang {
 
-class APValue;
 class Decl;
 class IdentifierInfo;
 class NestedNameSpecifier;
@@ -102,8 +101,6 @@ class ODRHash {
   // Save booleans until the end to lower the size of data to process.
   void AddBoolean(bool value);
 
-  void AddStructuralValue(const APValue &);
-
   static bool isSubDeclToBeProcessed(const Decl *

[Lldb-commits] [llvm] [lldb] DEBUGINFOD based DWP acquisition for LLDB (PR #70996)

2024-01-24 Thread Michał Górny via lldb-commits

mgorny wrote:

I'm sorry for the complexity. I've finally gotten around to figuring it out, 
and it turns out it's a problem with CMake files: #79305 fixes it for me.

https://github.com/llvm/llvm-project/pull/70996
___
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] [lldb] Revert "[c++20] P1907R1: Support for generalized non-type template arguments of scalar type." (PR #79302)

2024-01-24 Thread via lldb-commits

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


https://github.com/llvm/llvm-project/pull/79302
___
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] [lldb] Revert "[c++20] P1907R1: Support for generalized non-type template arguments of scalar type." (PR #79302)

2024-01-24 Thread via lldb-commits

cor3ntin wrote:

This is rather unfortunate, I hope we can figure that out quickly

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


[Lldb-commits] [lld] [libcxx] [flang] [clang] [libc] [compiler-rt] [lldb] [llvm] [clang-tools-extra] [Clang][C++23] Implement P2448R2: Relaxing some constexpr restrictions (PR #77753)

2024-01-24 Thread Mariya Podchishchaeva via lldb-commits


@@ -9108,7 +9123,8 @@ bool Sema::CheckExplicitlyDefaultedComparison(Scope *S, 
FunctionDecl *FD,
   //   declaration, it is implicitly considered to be constexpr.
   // FIXME: Only applying this to the first declaration seems problematic, as
   // simple reorderings can affect the meaning of the program.
-  if (First && !FD->isConstexpr() && Info.Constexpr)
+  if ((First && !FD->isConstexpr() && Info.Constexpr) ||
+  getLangOpts().CPlusPlus23)

Fznamznon wrote:

> isn't Info.Constexpr always true in c++ mode?
C++23, sorry

Not sure it is always true even for C++23, I think it is true when the operator 
produces constexpr. Otherwise we would have never emitted 
warn_cxx23_compat_defaulted_comparison_constexpr_mismatch a bit earlier than my 
change, and we do.

> The error message should be different though, right? something like "the call 
> to operator== is not a constant expression" ?

In both cases it says "non-literal type 'ComparisonNonConstexpr' cannot be used 
in a constant expression".

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


[Lldb-commits] [lld] [libcxx] [flang] [clang] [libc] [compiler-rt] [lldb] [llvm] [clang-tools-extra] [Clang][C++23] Implement P2448R2: Relaxing some constexpr restrictions (PR #77753)

2024-01-24 Thread Mariya Podchishchaeva via lldb-commits


@@ -356,14 +356,7 @@ C++23 implementation status
 
   Relaxing some constexpr restrictions
   https://wg21.link/P2448R2";>P2448R2
-  
-Clang 17 (Partial)
- We do not support outside of defaulted special memeber functions the 
change that constexpr functions no
-  longer have to be constexpr compatible but rather support a less 
restricted requirements for constexpr
-  functions. Which include allowing non-literal types as return values 
and parameters, allow calling of
-  non-constexpr functions and constructors.
-
-  
+  Clang 18

Fznamznon wrote:

Discussed on the call, this is not that important to cherry pick to 18, so I'll 
change this to 19.

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


[Lldb-commits] [lld] [libcxx] [flang] [clang] [libc] [compiler-rt] [lldb] [llvm] [clang-tools-extra] [Clang][C++23] Implement P2448R2: Relaxing some constexpr restrictions (PR #77753)

2024-01-24 Thread Mariya Podchishchaeva via lldb-commits

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


[Lldb-commits] [lld] [clang] [compiler-rt] [flang] [lldb] [libcxx] [llvm] [libc] [clang-tools-extra] [Clang][C++23] Implement P2448R2: Relaxing some constexpr restrictions (PR #77753)

2024-01-24 Thread Mariya Podchishchaeva via lldb-commits

Fznamznon wrote:

> Line 551 in 
> [99cae9a](https://github.com/llvm/llvm-project/commit/99cae9a44fca4cfbd6ee82f196051cbdf6571fa1)
 will set DefaultedDestructorIsConstexpr regardless of language mode, which it 
should not.

@cor3ntin , I wonder, since we want to claim it as an extension in earlier 
language modes, should I actually add an option for this extension and set 
these flags to this option value, not even language mode? Or is that not worth 
it?



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


[Lldb-commits] [pstl] [libcxx] [lldb] [llvm] [compiler-rt] [libunwind] [mlir] [clang-tools-extra] [libc] [flang] [clang] [lld] [openmp] [ELF] Don't resolve relocations referencing SHN_ABS to tombstone

2024-01-24 Thread Fangrui Song via lldb-commits

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


[Lldb-commits] [libc] [lld] [clang] [libunwind] [compiler-rt] [flang] [lldb] [openmp] [libcxx] [mlir] [llvm] [pstl] [clang-tools-extra] [ELF] Don't resolve relocations referencing SHN_ABS to tombstone

2024-01-24 Thread Fangrui Song via lldb-commits

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

>From 97b500a7061041b5478b6b1b1094e76140e3d9c3 Mon Sep 17 00:00:00 2001
From: Fangrui Song 
Date: Tue, 23 Jan 2024 17:53:31 -0800
Subject: [PATCH] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20initia?=
 =?UTF-8?q?l=20version?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Created using spr 1.3.4
---
 lld/ELF/InputSection.cpp  | 13 ++---
 lld/test/ELF/dead-reloc-in-nonalloc.s |  2 +-
 2 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/lld/ELF/InputSection.cpp b/lld/ELF/InputSection.cpp
index c728dd6c6306aa0..0e0b9783bd88a0f 100644
--- a/lld/ELF/InputSection.cpp
+++ b/lld/ELF/InputSection.cpp
@@ -961,12 +961,11 @@ void InputSection::relocateNonAlloc(uint8_t *buf, 
ArrayRef rels) {
   // vector. The computed value is st_value plus a non-negative offset.
   // Negative values are invalid, so -1 can be used as the tombstone value.
   //
-  // If the referenced symbol is discarded (made Undefined), or the
-  // section defining the referenced symbol is garbage collected,
-  // sym.getOutputSection() is nullptr. `ds->folded` catches the ICF folded
-  // case. However, resolving a relocation in .debug_line to -1 would stop
-  // debugger users from setting breakpoints on the folded-in function, so
-  // exclude .debug_line.
+  // If the referenced symbol is relative to a discarded section (due to
+  // --gc-sections, COMDAT, etc), it has been converted to a Undefined.
+  // `ds->folded` catches the ICF folded case. However, resolving a
+  // relocation in .debug_line to -1 would stop debugger users from setting
+  // breakpoints on the folded-in function, so exclude .debug_line.
   //
   // For pre-DWARF-v5 .debug_loc and .debug_ranges, -1 is a reserved value
   // (base address selection entry), use 1 (which is used by GNU ld for
@@ -974,7 +973,7 @@ void InputSection::relocateNonAlloc(uint8_t *buf, 
ArrayRef rels) {
   //
   // TODO To reduce disruption, we use 0 instead of -1 as the tombstone
   // value. Enable -1 in a future release.
-  if (!sym.getOutputSection() || (ds && ds->folded && !isDebugLine)) {
+  if (!ds || (ds->folded && !isDebugLine)) {
 // If -z dead-reloc-in-nonalloc= is specified, respect it.
 uint64_t value = SignExtend64(*tombstone);
 // For a 32-bit local TU reference in .debug_names, X86_64::relocate
diff --git a/lld/test/ELF/dead-reloc-in-nonalloc.s 
b/lld/test/ELF/dead-reloc-in-nonalloc.s
index 145604eb883a9af..b675fc50fc2ea2f 100644
--- a/lld/test/ELF/dead-reloc-in-nonalloc.s
+++ b/lld/test/ELF/dead-reloc-in-nonalloc.s
@@ -17,7 +17,7 @@
 # AA:  Contents of section .debug_info:
 # AA-NEXT:   [[ADDR]]   
 # AA:  Contents of section .not_debug:
-# AA-NEXT:       .
+# AA-NEXT:    2a00   .
 
 ## Specifying zero can get a behavior similar to GNU ld.
 # RUN: ld.lld --icf=all -z dead-reloc-in-nonalloc=.debug_info=0 %t.o %tabs.o 
-o %tzero

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


[Lldb-commits] [libc] [lld] [clang] [libunwind] [compiler-rt] [flang] [lldb] [openmp] [libcxx] [mlir] [llvm] [pstl] [clang-tools-extra] [ELF] Don't resolve relocations referencing SHN_ABS to tombstone

2024-01-24 Thread Fangrui Song via lldb-commits

MaskRay wrote:

Fixed a typo and added an example

> ```
> // clang -g
> __attribute__((weak)) int symbol;
> int *foo() { return &symbol; }
> 
> 0x0023:   DW_TAG_variable [2]   (0x000c)
> ...
> DW_AT_location [DW_FORM_exprloc](DW_OP_addrx 0x0)
> ```
>   
> 
> .debug_addr references `symbol`, which can be redefined by a symbol
> assignment or --defsym to become a SHN_ABS symbol.



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


[Lldb-commits] [libc] [lld] [clang] [libunwind] [compiler-rt] [flang] [lldb] [openmp] [libcxx] [mlir] [llvm] [pstl] [clang-tools-extra] [ELF] Don't resolve relocations referencing SHN_ABS to tombstone

2024-01-24 Thread Fangrui Song via lldb-commits

https://github.com/MaskRay closed 
https://github.com/llvm/llvm-project/pull/79238
___
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] [lldb] [c++20] P1907R1: Support for generalized non-type template arguments of scalar type. (PR #78041)

2024-01-24 Thread David Blaikie via lldb-commits


@@ -5401,6 +5409,8 @@ std::string CGDebugInfo::GetName(const Decl *D, bool 
Qualified) const {
 // feasible some day.
 return TA.getAsIntegral().getBitWidth() <= 64 &&
IsReconstitutableType(TA.getIntegralType());
+  case TemplateArgument::StructuralValue:
+return false;

dwblaikie wrote:

Sorry for the delays in the debug info review for this - it is on my list :/ 

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


[Lldb-commits] [lldb] [llvm] [libc] [compiler-rt] [libcxx] [flang] [clang-tools-extra] [clang] [lld] [Clang][C++23] Implement P2448R2: Relaxing some constexpr restrictions (PR #77753)

2024-01-24 Thread via lldb-commits

cor3ntin wrote:

> @cor3ntin , I wonder, since we want to claim it as an extension in earlier 
> language modes, should I actually add an option for this extension and set 
> these flags to this option value, not even language mode? Or is that not 
> worth it?

As long as there is an extension warning I think we don't need a flag (Werror 
and -pedantic are enough flexibility).
So I guess we should set the `DefaultedDestructorIsConstexpr` to false and only 
use it for warning? I think that makes sense. I haven't thought of that, sorry.

All of that complicated machinery is now there just for warning, haha (but the 
warnings are useful)

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


[Lldb-commits] [lldb] [pstl] [llvm] [mlir] [libc] [compiler-rt] [libcxx] [openmp] [clang-tools-extra] [clang] [lld] [Driver] Test ignored target-specific options for AMDGPU/NVPTX (PR #79222)

2024-01-24 Thread Artem Belevich via lldb-commits


@@ -0,0 +1,5 @@
+/// Some target-specific options are ignored for GPU, so %clang exits with 
code 0.
+// DEFINE: %{check} = %clang -### -c -mcmodel=medium

Artem-B wrote:

> Also, what exactly are we checking here? With `-###` CC1 sub-compilations do 
> not run and, I think, that's where unsupported options were triggering 
> warning/errors.

We're still only running the top-level driver. Weren't errors reported by cc1 
compilation?



https://github.com/llvm/llvm-project/pull/79222
___
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] [clang] [c++20] P1907R1: Support for generalized non-type template arguments of scalar type. (PR #78041)

2024-01-24 Thread Andrey Ali Khan Bolshakov via lldb-commits

bolshakov-a wrote:

I suspect the reason is in the array-to-pointer conversion in `StructuralValue` 
argument. Maybe this will help someone to invent a fix quickly...

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


[Lldb-commits] [lldb] [pstl] [llvm] [mlir] [libc] [compiler-rt] [libcxx] [openmp] [clang-tools-extra] [clang] [lld] [Driver] Test ignored target-specific options for AMDGPU/NVPTX (PR #79222)

2024-01-24 Thread Joseph Huber via lldb-commits


@@ -0,0 +1,5 @@
+/// Some target-specific options are ignored for GPU, so %clang exits with 
code 0.
+// DEFINE: %{check} = %clang -### -c -mcmodel=medium

jhuber6 wrote:

Probably depends on the option we're testing. We could do both.

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


[Lldb-commits] [libcxx] [pstl] [lld] [llvm] [lldb] [clang] [libc] [compiler-rt] [mlir] [clang-tools-extra] [openmp] [Driver] Test ignored target-specific options for AMDGPU/NVPTX (PR #79222)

2024-01-24 Thread Artem Belevich via lldb-commits


@@ -0,0 +1,5 @@
+/// Some target-specific options are ignored for GPU, so %clang exits with 
code 0.
+// DEFINE: %{check} = %clang -### -c -mcmodel=medium

Artem-B wrote:

In this particular case, the changes we test (and the error messages) were 
originating in the driver, so we're OK with `-###`.

That said, we do have other options that we do need to suppress/ignore and some 
of that does happen on cc1 level. 

We'll eventually need to add the tests for those here and then enable actual 
compilation, but it should not hold this patch back.



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


[Lldb-commits] [libcxx] [pstl] [lld] [llvm] [lldb] [clang] [libc] [compiler-rt] [mlir] [clang-tools-extra] [openmp] [Driver] Test ignored target-specific options for AMDGPU/NVPTX (PR #79222)

2024-01-24 Thread Artem Belevich via lldb-commits

https://github.com/Artem-B approved this pull request.


https://github.com/llvm/llvm-project/pull/79222
___
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)

2024-01-24 Thread via lldb-commits

jimingham wrote:

The reason that we use ValueObjectSP() returns rather than {} in a lot of this 
code is because the `return {}` construct came along with C++11, which was not 
available when most of this code was written.  I don't think anyone would mind 
switching over to {}.  I usually like to make it easy to see the types of 
things while reading, which `return {}` slightly obscures.  But it's usually 
pretty easy to figure out the return type of the function you are in, so in 
this case I don't know that the explicit type helps all that much.

Jim


> On Dec 19, 2023, at 11:40 AM, Pete Lawrence ***@***.***> wrote:
> 
> 
> @PortalPete commented on this pull request.
> 
> In lldb/source/Core/ValueObject.cpp 
> :
> 
> > @@ -1700,13 +1706,13 @@ ValueObjectSP 
> > ValueObject::GetSyntheticChildAtOffset(
>  return synthetic_child_sp;
>  
>if (!can_create)
> -return {};
> +return ValueObjectSP();
> 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.
> 
> —
> Reply to this email directly, view it on GitHub 
> , or 
> unsubscribe 
> .
> You are receiving this because you are on a team that was mentioned.
> 



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] [lld] [mlir] [flang] [clang-tools-extra] [libunwind] [clang] [openmp] [libcxx] [compiler-rt] [llvm] [libc] [pstl] [ELF] Don't resolve relocations referencing SHN_ABS to tombstone

2024-01-24 Thread Alexander Yermolovich via lldb-commits

ayermolo wrote:

Hmm, interesting. Thanks for the fix.

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


[Lldb-commits] [lld] [libc] [openmp] [lldb] [compiler-rt] [clang] [libcxx] [llvm] [clang-tools-extra] [mlir] [pstl] [Driver] Test ignored target-specific options for AMDGPU/NVPTX (PR #79222)

2024-01-24 Thread Fangrui Song via lldb-commits


@@ -0,0 +1,5 @@
+/// Some target-specific options are ignored for GPU, so %clang exits with 
code 0.
+// DEFINE: %{check} = %clang -### -c -mcmodel=medium

MaskRay wrote:

In general the error reporting is done in the driver and cc1 allows and ignores 
options that may be specific to other targets.

> That said, we do have other options that we do need to suppress/ignore and 
> some of that does happen on cc1 level.

Perhaps we should figure out them and check whether they should be moved to the 
driver

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


[Lldb-commits] [lld] [libc] [openmp] [lldb] [compiler-rt] [clang] [libcxx] [llvm] [clang-tools-extra] [mlir] [pstl] [Driver] Test ignored target-specific options for AMDGPU/NVPTX (PR #79222)

2024-01-24 Thread Fangrui Song via lldb-commits

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


[Lldb-commits] [lld] [flang] [libc] [libcxx] [clang-tools-extra] [llvm] [lldb] [clang] [compiler-rt] Make clang report invalid target versions for all environment types. (PR #78655)

2024-01-24 Thread via lldb-commits

https://github.com/ZijunZhaoCCK updated 
https://github.com/llvm/llvm-project/pull/78655

>From f440f44e7e270d4636ad39f4e4223c904e496d3a Mon Sep 17 00:00:00 2001
From: zijunzhao 
Date: Fri, 19 Jan 2024 00:47:05 +
Subject: [PATCH 1/2] Make clang report invalid target versions for all
 environment.

Followup for https://github.com/llvm/llvm-project/pull/75373

1. Make this feature not just available for android, but everyone.
2. Correct some target triples/
3. Add opencl to the environment type list.
---
 clang/lib/Driver/Driver.cpp  | 19 ++-
 clang/test/CodeGen/fp128_complex.c   |  2 +-
 clang/test/Driver/mips-features.c|  4 ++--
 clang/test/Frontend/fixed_point_bit_widths.c |  4 ++--
 llvm/include/llvm/TargetParser/Triple.h  |  2 +-
 llvm/lib/TargetParser/Triple.cpp | 14 ++
 6 files changed, 30 insertions(+), 15 deletions(-)

diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
index 1889ea28079df10..2d6986d145483b8 100644
--- a/clang/lib/Driver/Driver.cpp
+++ b/clang/lib/Driver/Driver.cpp
@@ -1430,15 +1430,16 @@ Compilation *Driver::BuildCompilation(ArrayRef ArgList) {
   const ToolChain &TC = getToolChain(
   *UArgs, computeTargetTriple(*this, TargetTriple, *UArgs));
 
-  if (TC.getTriple().isAndroid()) {
-llvm::Triple Triple = TC.getTriple();
-StringRef TripleVersionName = Triple.getEnvironmentVersionString();
-
-if (Triple.getEnvironmentVersion().empty() && TripleVersionName != "") {
-  Diags.Report(diag::err_drv_triple_version_invalid)
-  << TripleVersionName << TC.getTripleString();
-  ContainsError = true;
-}
+  // Check if the environment version is valid.
+  llvm::Triple Triple = TC.getTriple();
+  StringRef TripleVersionName = Triple.getEnvironmentVersionString();
+  StringRef TripleObjectFormat = 
Triple.getObjectFormatTypeName(Triple.getObjectFormat());
+
+  if (Triple.getEnvironmentVersion().empty() && TripleVersionName != ""
+&& TripleVersionName != TripleObjectFormat) {
+Diags.Report(diag::err_drv_triple_version_invalid)
+<< TripleVersionName << TC.getTripleString();
+ContainsError = true;
   }
 
   // Report warning when arm64EC option is overridden by specified target
diff --git a/clang/test/CodeGen/fp128_complex.c 
b/clang/test/CodeGen/fp128_complex.c
index 48659d224168416..0e87cbe8ce81219 100644
--- a/clang/test/CodeGen/fp128_complex.c
+++ b/clang/test/CodeGen/fp128_complex.c
@@ -1,4 +1,4 @@
-// RUN: %clang -target aarch64-linux-gnuabi %s -S -emit-llvm -o - | FileCheck 
%s
+// RUN: %clang -target aarch64-linux-gnueabi %s -S -emit-llvm -o - | FileCheck 
%s
 
 _Complex long double a, b, c, d;
 void test_fp128_compound_assign(void) {
diff --git a/clang/test/Driver/mips-features.c 
b/clang/test/Driver/mips-features.c
index fad6009ffb89bab..18edcd05ea85c9f 100644
--- a/clang/test/Driver/mips-features.c
+++ b/clang/test/Driver/mips-features.c
@@ -400,12 +400,12 @@
 // LONG-CALLS-DEF-NOT: "long-calls"
 //
 // -mbranch-likely
-// RUN: %clang -target -mips-mti-linux-gnu -### -c %s -mbranch-likely 2>&1 \
+// RUN: %clang -target mips-mti-linux-gnu -### -c %s -mbranch-likely 2>&1 \
 // RUN:   | FileCheck --check-prefix=BRANCH-LIKELY %s
 // BRANCH-LIKELY: argument unused during compilation: '-mbranch-likely'
 //
 // -mno-branch-likely
-// RUN: %clang -target -mips-mti-linux-gnu -### -c %s -mno-branch-likely 2>&1 \
+// RUN: %clang -target mips-mti-linux-gnu -### -c %s -mno-branch-likely 2>&1 \
 // RUN:   | FileCheck --check-prefix=NO-BRANCH-LIKELY %s
 // NO-BRANCH-LIKELY: argument unused during compilation: '-mno-branch-likely'
 
diff --git a/clang/test/Frontend/fixed_point_bit_widths.c 
b/clang/test/Frontend/fixed_point_bit_widths.c
index ac8db49ed516aef..e56f787e824f24a 100644
--- a/clang/test/Frontend/fixed_point_bit_widths.c
+++ b/clang/test/Frontend/fixed_point_bit_widths.c
@@ -1,7 +1,7 @@
 // RUN: %clang -x c -ffixed-point -S -emit-llvm -o - %s | FileCheck %s
-// RUN: %clang -x c -ffixed-point -S -emit-llvm -o - 
--target=x86_64-scei-ps4-ubuntu-fast %s | FileCheck %s
+// RUN: %clang -x c -ffixed-point -S -emit-llvm -o - --target=x86_64-scei-ps4 
%s | FileCheck %s
 // RUN: %clang -x c -ffixed-point -S -emit-llvm -o - --target=ppc64 %s | 
FileCheck %s
-// RUN: %clang -x c -ffixed-point -S -emit-llvm -o - 
--target=x86_64-scei-ps4-windows10pro-fast %s | FileCheck %s
+// RUN: %clang -x c -ffixed-point -S -emit-llvm -o - --target=x86_64-scei-ps4 
%s | FileCheck %s
 
 /* Primary signed _Accum */
 
diff --git a/llvm/include/llvm/TargetParser/Triple.h 
b/llvm/include/llvm/TargetParser/Triple.h
index 95014a546f72453..525ea6df3643ca6 100644
--- a/llvm/include/llvm/TargetParser/Triple.h
+++ b/llvm/include/llvm/TargetParser/Triple.h
@@ -273,7 +273,7 @@ class Triple {
 Callable,
 Mesh,
 Amplification,
-
+OpenCL,
 OpenHOS,
 
 LastEnvironmentType = OpenHOS
diff --git a/llvm/lib/TargetParser/Triple.cpp b/llvm/lib/TargetParser/Tripl

[Lldb-commits] [lldb] [clang] [clang-tools-extra] [lld] [libc] [compiler-rt] [llvm] [libcxx] [flang] Make clang report invalid target versions for all environment types. (PR #78655)

2024-01-24 Thread via lldb-commits

https://github.com/ZijunZhaoCCK updated 
https://github.com/llvm/llvm-project/pull/78655

>From f440f44e7e270d4636ad39f4e4223c904e496d3a Mon Sep 17 00:00:00 2001
From: zijunzhao 
Date: Fri, 19 Jan 2024 00:47:05 +
Subject: [PATCH 1/3] Make clang report invalid target versions for all
 environment.

Followup for https://github.com/llvm/llvm-project/pull/75373

1. Make this feature not just available for android, but everyone.
2. Correct some target triples/
3. Add opencl to the environment type list.
---
 clang/lib/Driver/Driver.cpp  | 19 ++-
 clang/test/CodeGen/fp128_complex.c   |  2 +-
 clang/test/Driver/mips-features.c|  4 ++--
 clang/test/Frontend/fixed_point_bit_widths.c |  4 ++--
 llvm/include/llvm/TargetParser/Triple.h  |  2 +-
 llvm/lib/TargetParser/Triple.cpp | 14 ++
 6 files changed, 30 insertions(+), 15 deletions(-)

diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
index 1889ea28079df10..2d6986d145483b8 100644
--- a/clang/lib/Driver/Driver.cpp
+++ b/clang/lib/Driver/Driver.cpp
@@ -1430,15 +1430,16 @@ Compilation *Driver::BuildCompilation(ArrayRef ArgList) {
   const ToolChain &TC = getToolChain(
   *UArgs, computeTargetTriple(*this, TargetTriple, *UArgs));
 
-  if (TC.getTriple().isAndroid()) {
-llvm::Triple Triple = TC.getTriple();
-StringRef TripleVersionName = Triple.getEnvironmentVersionString();
-
-if (Triple.getEnvironmentVersion().empty() && TripleVersionName != "") {
-  Diags.Report(diag::err_drv_triple_version_invalid)
-  << TripleVersionName << TC.getTripleString();
-  ContainsError = true;
-}
+  // Check if the environment version is valid.
+  llvm::Triple Triple = TC.getTriple();
+  StringRef TripleVersionName = Triple.getEnvironmentVersionString();
+  StringRef TripleObjectFormat = 
Triple.getObjectFormatTypeName(Triple.getObjectFormat());
+
+  if (Triple.getEnvironmentVersion().empty() && TripleVersionName != ""
+&& TripleVersionName != TripleObjectFormat) {
+Diags.Report(diag::err_drv_triple_version_invalid)
+<< TripleVersionName << TC.getTripleString();
+ContainsError = true;
   }
 
   // Report warning when arm64EC option is overridden by specified target
diff --git a/clang/test/CodeGen/fp128_complex.c 
b/clang/test/CodeGen/fp128_complex.c
index 48659d224168416..0e87cbe8ce81219 100644
--- a/clang/test/CodeGen/fp128_complex.c
+++ b/clang/test/CodeGen/fp128_complex.c
@@ -1,4 +1,4 @@
-// RUN: %clang -target aarch64-linux-gnuabi %s -S -emit-llvm -o - | FileCheck 
%s
+// RUN: %clang -target aarch64-linux-gnueabi %s -S -emit-llvm -o - | FileCheck 
%s
 
 _Complex long double a, b, c, d;
 void test_fp128_compound_assign(void) {
diff --git a/clang/test/Driver/mips-features.c 
b/clang/test/Driver/mips-features.c
index fad6009ffb89bab..18edcd05ea85c9f 100644
--- a/clang/test/Driver/mips-features.c
+++ b/clang/test/Driver/mips-features.c
@@ -400,12 +400,12 @@
 // LONG-CALLS-DEF-NOT: "long-calls"
 //
 // -mbranch-likely
-// RUN: %clang -target -mips-mti-linux-gnu -### -c %s -mbranch-likely 2>&1 \
+// RUN: %clang -target mips-mti-linux-gnu -### -c %s -mbranch-likely 2>&1 \
 // RUN:   | FileCheck --check-prefix=BRANCH-LIKELY %s
 // BRANCH-LIKELY: argument unused during compilation: '-mbranch-likely'
 //
 // -mno-branch-likely
-// RUN: %clang -target -mips-mti-linux-gnu -### -c %s -mno-branch-likely 2>&1 \
+// RUN: %clang -target mips-mti-linux-gnu -### -c %s -mno-branch-likely 2>&1 \
 // RUN:   | FileCheck --check-prefix=NO-BRANCH-LIKELY %s
 // NO-BRANCH-LIKELY: argument unused during compilation: '-mno-branch-likely'
 
diff --git a/clang/test/Frontend/fixed_point_bit_widths.c 
b/clang/test/Frontend/fixed_point_bit_widths.c
index ac8db49ed516aef..e56f787e824f24a 100644
--- a/clang/test/Frontend/fixed_point_bit_widths.c
+++ b/clang/test/Frontend/fixed_point_bit_widths.c
@@ -1,7 +1,7 @@
 // RUN: %clang -x c -ffixed-point -S -emit-llvm -o - %s | FileCheck %s
-// RUN: %clang -x c -ffixed-point -S -emit-llvm -o - 
--target=x86_64-scei-ps4-ubuntu-fast %s | FileCheck %s
+// RUN: %clang -x c -ffixed-point -S -emit-llvm -o - --target=x86_64-scei-ps4 
%s | FileCheck %s
 // RUN: %clang -x c -ffixed-point -S -emit-llvm -o - --target=ppc64 %s | 
FileCheck %s
-// RUN: %clang -x c -ffixed-point -S -emit-llvm -o - 
--target=x86_64-scei-ps4-windows10pro-fast %s | FileCheck %s
+// RUN: %clang -x c -ffixed-point -S -emit-llvm -o - --target=x86_64-scei-ps4 
%s | FileCheck %s
 
 /* Primary signed _Accum */
 
diff --git a/llvm/include/llvm/TargetParser/Triple.h 
b/llvm/include/llvm/TargetParser/Triple.h
index 95014a546f72453..525ea6df3643ca6 100644
--- a/llvm/include/llvm/TargetParser/Triple.h
+++ b/llvm/include/llvm/TargetParser/Triple.h
@@ -273,7 +273,7 @@ class Triple {
 Callable,
 Mesh,
 Amplification,
-
+OpenCL,
 OpenHOS,
 
 LastEnvironmentType = OpenHOS
diff --git a/llvm/lib/TargetParser/Triple.cpp b/llvm/lib/TargetParser/Tripl

[Lldb-commits] [lldb] [clang] [clang-tools-extra] [lld] [libc] [compiler-rt] [llvm] [libcxx] [flang] Make clang report invalid target versions for all environment types. (PR #78655)

2024-01-24 Thread via lldb-commits

https://github.com/ZijunZhaoCCK updated 
https://github.com/llvm/llvm-project/pull/78655

>From f440f44e7e270d4636ad39f4e4223c904e496d3a Mon Sep 17 00:00:00 2001
From: zijunzhao 
Date: Fri, 19 Jan 2024 00:47:05 +
Subject: [PATCH 1/3] Make clang report invalid target versions for all
 environment.

Followup for https://github.com/llvm/llvm-project/pull/75373

1. Make this feature not just available for android, but everyone.
2. Correct some target triples/
3. Add opencl to the environment type list.
---
 clang/lib/Driver/Driver.cpp  | 19 ++-
 clang/test/CodeGen/fp128_complex.c   |  2 +-
 clang/test/Driver/mips-features.c|  4 ++--
 clang/test/Frontend/fixed_point_bit_widths.c |  4 ++--
 llvm/include/llvm/TargetParser/Triple.h  |  2 +-
 llvm/lib/TargetParser/Triple.cpp | 14 ++
 6 files changed, 30 insertions(+), 15 deletions(-)

diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
index 1889ea28079df1..2d6986d145483b 100644
--- a/clang/lib/Driver/Driver.cpp
+++ b/clang/lib/Driver/Driver.cpp
@@ -1430,15 +1430,16 @@ Compilation *Driver::BuildCompilation(ArrayRef ArgList) {
   const ToolChain &TC = getToolChain(
   *UArgs, computeTargetTriple(*this, TargetTriple, *UArgs));
 
-  if (TC.getTriple().isAndroid()) {
-llvm::Triple Triple = TC.getTriple();
-StringRef TripleVersionName = Triple.getEnvironmentVersionString();
-
-if (Triple.getEnvironmentVersion().empty() && TripleVersionName != "") {
-  Diags.Report(diag::err_drv_triple_version_invalid)
-  << TripleVersionName << TC.getTripleString();
-  ContainsError = true;
-}
+  // Check if the environment version is valid.
+  llvm::Triple Triple = TC.getTriple();
+  StringRef TripleVersionName = Triple.getEnvironmentVersionString();
+  StringRef TripleObjectFormat = 
Triple.getObjectFormatTypeName(Triple.getObjectFormat());
+
+  if (Triple.getEnvironmentVersion().empty() && TripleVersionName != ""
+&& TripleVersionName != TripleObjectFormat) {
+Diags.Report(diag::err_drv_triple_version_invalid)
+<< TripleVersionName << TC.getTripleString();
+ContainsError = true;
   }
 
   // Report warning when arm64EC option is overridden by specified target
diff --git a/clang/test/CodeGen/fp128_complex.c 
b/clang/test/CodeGen/fp128_complex.c
index 48659d22416841..0e87cbe8ce8121 100644
--- a/clang/test/CodeGen/fp128_complex.c
+++ b/clang/test/CodeGen/fp128_complex.c
@@ -1,4 +1,4 @@
-// RUN: %clang -target aarch64-linux-gnuabi %s -S -emit-llvm -o - | FileCheck 
%s
+// RUN: %clang -target aarch64-linux-gnueabi %s -S -emit-llvm -o - | FileCheck 
%s
 
 _Complex long double a, b, c, d;
 void test_fp128_compound_assign(void) {
diff --git a/clang/test/Driver/mips-features.c 
b/clang/test/Driver/mips-features.c
index fad6009ffb89ba..18edcd05ea85c9 100644
--- a/clang/test/Driver/mips-features.c
+++ b/clang/test/Driver/mips-features.c
@@ -400,12 +400,12 @@
 // LONG-CALLS-DEF-NOT: "long-calls"
 //
 // -mbranch-likely
-// RUN: %clang -target -mips-mti-linux-gnu -### -c %s -mbranch-likely 2>&1 \
+// RUN: %clang -target mips-mti-linux-gnu -### -c %s -mbranch-likely 2>&1 \
 // RUN:   | FileCheck --check-prefix=BRANCH-LIKELY %s
 // BRANCH-LIKELY: argument unused during compilation: '-mbranch-likely'
 //
 // -mno-branch-likely
-// RUN: %clang -target -mips-mti-linux-gnu -### -c %s -mno-branch-likely 2>&1 \
+// RUN: %clang -target mips-mti-linux-gnu -### -c %s -mno-branch-likely 2>&1 \
 // RUN:   | FileCheck --check-prefix=NO-BRANCH-LIKELY %s
 // NO-BRANCH-LIKELY: argument unused during compilation: '-mno-branch-likely'
 
diff --git a/clang/test/Frontend/fixed_point_bit_widths.c 
b/clang/test/Frontend/fixed_point_bit_widths.c
index ac8db49ed516ae..e56f787e824f24 100644
--- a/clang/test/Frontend/fixed_point_bit_widths.c
+++ b/clang/test/Frontend/fixed_point_bit_widths.c
@@ -1,7 +1,7 @@
 // RUN: %clang -x c -ffixed-point -S -emit-llvm -o - %s | FileCheck %s
-// RUN: %clang -x c -ffixed-point -S -emit-llvm -o - 
--target=x86_64-scei-ps4-ubuntu-fast %s | FileCheck %s
+// RUN: %clang -x c -ffixed-point -S -emit-llvm -o - --target=x86_64-scei-ps4 
%s | FileCheck %s
 // RUN: %clang -x c -ffixed-point -S -emit-llvm -o - --target=ppc64 %s | 
FileCheck %s
-// RUN: %clang -x c -ffixed-point -S -emit-llvm -o - 
--target=x86_64-scei-ps4-windows10pro-fast %s | FileCheck %s
+// RUN: %clang -x c -ffixed-point -S -emit-llvm -o - --target=x86_64-scei-ps4 
%s | FileCheck %s
 
 /* Primary signed _Accum */
 
diff --git a/llvm/include/llvm/TargetParser/Triple.h 
b/llvm/include/llvm/TargetParser/Triple.h
index 95014a546f7245..525ea6df3643ca 100644
--- a/llvm/include/llvm/TargetParser/Triple.h
+++ b/llvm/include/llvm/TargetParser/Triple.h
@@ -273,7 +273,7 @@ class Triple {
 Callable,
 Mesh,
 Amplification,
-
+OpenCL,
 OpenHOS,
 
 LastEnvironmentType = OpenHOS
diff --git a/llvm/lib/TargetParser/Triple.cpp b/llvm/lib/TargetParser/Triple.cpp
inde

[Lldb-commits] [lldb] [clang] [clang-tools-extra] [c++20] P1907R1: Support for generalized non-type template arguments of scalar type. (PR #78041)

2024-01-24 Thread Andrey Ali Khan Bolshakov via lldb-commits

bolshakov-a wrote:

@erichkeane, @cor3ntin, argument types 
[here](https://github.com/llvm/llvm-project/blob/main/clang/lib/Sema/SemaTemplateDeduction.cpp#L3022)
 occurs to be different with sugar added to one of them. This patch fixes the 
problem:
```
--- a/clang/lib/AST/TemplateBase.cpp
+++ b/clang/lib/AST/TemplateBase.cpp
@@ -450,7 +450,7 @@ bool TemplateArgument::structurallyEquals(const 
TemplateArgument &Other) const {
getAsIntegral() == Other.getAsIntegral();
 
   case StructuralValue: {
-if (getStructuralValueType() != Other.getStructuralValueType())
+if (getStructuralValueType().getCanonicalType() != 
Other.getStructuralValueType().getCanonicalType())
   return false;
 
 llvm::FoldingSetNodeID A, B;
```
Not sure if it is correct. Running tests...

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


[Lldb-commits] [lldb] [clang] [clang-tools-extra] [c++20] P1907R1: Support for generalized non-type template arguments of scalar type. (PR #78041)

2024-01-24 Thread Erich Keane via lldb-commits

erichkeane wrote:

That certainly makes sense to me.  Can you submit a patch for review to do so, 
then we can get it cherry-picked to 18?  It would be great if we could save 
this feature in 18.

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


[Lldb-commits] [compiler-rt] [flang] [clang-tools-extra] [libc] [lld] [libcxx] [lldb] [clang] [llvm] Make clang report invalid target versions for all environment types. (PR #78655)

2024-01-24 Thread via lldb-commits

https://github.com/ZijunZhaoCCK updated 
https://github.com/llvm/llvm-project/pull/78655

>From f440f44e7e270d4636ad39f4e4223c904e496d3a Mon Sep 17 00:00:00 2001
From: zijunzhao 
Date: Fri, 19 Jan 2024 00:47:05 +
Subject: [PATCH 1/4] Make clang report invalid target versions for all
 environment.

Followup for https://github.com/llvm/llvm-project/pull/75373

1. Make this feature not just available for android, but everyone.
2. Correct some target triples/
3. Add opencl to the environment type list.
---
 clang/lib/Driver/Driver.cpp  | 19 ++-
 clang/test/CodeGen/fp128_complex.c   |  2 +-
 clang/test/Driver/mips-features.c|  4 ++--
 clang/test/Frontend/fixed_point_bit_widths.c |  4 ++--
 llvm/include/llvm/TargetParser/Triple.h  |  2 +-
 llvm/lib/TargetParser/Triple.cpp | 14 ++
 6 files changed, 30 insertions(+), 15 deletions(-)

diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
index 1889ea28079df10..2d6986d145483b8 100644
--- a/clang/lib/Driver/Driver.cpp
+++ b/clang/lib/Driver/Driver.cpp
@@ -1430,15 +1430,16 @@ Compilation *Driver::BuildCompilation(ArrayRef ArgList) {
   const ToolChain &TC = getToolChain(
   *UArgs, computeTargetTriple(*this, TargetTriple, *UArgs));
 
-  if (TC.getTriple().isAndroid()) {
-llvm::Triple Triple = TC.getTriple();
-StringRef TripleVersionName = Triple.getEnvironmentVersionString();
-
-if (Triple.getEnvironmentVersion().empty() && TripleVersionName != "") {
-  Diags.Report(diag::err_drv_triple_version_invalid)
-  << TripleVersionName << TC.getTripleString();
-  ContainsError = true;
-}
+  // Check if the environment version is valid.
+  llvm::Triple Triple = TC.getTriple();
+  StringRef TripleVersionName = Triple.getEnvironmentVersionString();
+  StringRef TripleObjectFormat = 
Triple.getObjectFormatTypeName(Triple.getObjectFormat());
+
+  if (Triple.getEnvironmentVersion().empty() && TripleVersionName != ""
+&& TripleVersionName != TripleObjectFormat) {
+Diags.Report(diag::err_drv_triple_version_invalid)
+<< TripleVersionName << TC.getTripleString();
+ContainsError = true;
   }
 
   // Report warning when arm64EC option is overridden by specified target
diff --git a/clang/test/CodeGen/fp128_complex.c 
b/clang/test/CodeGen/fp128_complex.c
index 48659d224168416..0e87cbe8ce81219 100644
--- a/clang/test/CodeGen/fp128_complex.c
+++ b/clang/test/CodeGen/fp128_complex.c
@@ -1,4 +1,4 @@
-// RUN: %clang -target aarch64-linux-gnuabi %s -S -emit-llvm -o - | FileCheck 
%s
+// RUN: %clang -target aarch64-linux-gnueabi %s -S -emit-llvm -o - | FileCheck 
%s
 
 _Complex long double a, b, c, d;
 void test_fp128_compound_assign(void) {
diff --git a/clang/test/Driver/mips-features.c 
b/clang/test/Driver/mips-features.c
index fad6009ffb89bab..18edcd05ea85c9f 100644
--- a/clang/test/Driver/mips-features.c
+++ b/clang/test/Driver/mips-features.c
@@ -400,12 +400,12 @@
 // LONG-CALLS-DEF-NOT: "long-calls"
 //
 // -mbranch-likely
-// RUN: %clang -target -mips-mti-linux-gnu -### -c %s -mbranch-likely 2>&1 \
+// RUN: %clang -target mips-mti-linux-gnu -### -c %s -mbranch-likely 2>&1 \
 // RUN:   | FileCheck --check-prefix=BRANCH-LIKELY %s
 // BRANCH-LIKELY: argument unused during compilation: '-mbranch-likely'
 //
 // -mno-branch-likely
-// RUN: %clang -target -mips-mti-linux-gnu -### -c %s -mno-branch-likely 2>&1 \
+// RUN: %clang -target mips-mti-linux-gnu -### -c %s -mno-branch-likely 2>&1 \
 // RUN:   | FileCheck --check-prefix=NO-BRANCH-LIKELY %s
 // NO-BRANCH-LIKELY: argument unused during compilation: '-mno-branch-likely'
 
diff --git a/clang/test/Frontend/fixed_point_bit_widths.c 
b/clang/test/Frontend/fixed_point_bit_widths.c
index ac8db49ed516aef..e56f787e824f24a 100644
--- a/clang/test/Frontend/fixed_point_bit_widths.c
+++ b/clang/test/Frontend/fixed_point_bit_widths.c
@@ -1,7 +1,7 @@
 // RUN: %clang -x c -ffixed-point -S -emit-llvm -o - %s | FileCheck %s
-// RUN: %clang -x c -ffixed-point -S -emit-llvm -o - 
--target=x86_64-scei-ps4-ubuntu-fast %s | FileCheck %s
+// RUN: %clang -x c -ffixed-point -S -emit-llvm -o - --target=x86_64-scei-ps4 
%s | FileCheck %s
 // RUN: %clang -x c -ffixed-point -S -emit-llvm -o - --target=ppc64 %s | 
FileCheck %s
-// RUN: %clang -x c -ffixed-point -S -emit-llvm -o - 
--target=x86_64-scei-ps4-windows10pro-fast %s | FileCheck %s
+// RUN: %clang -x c -ffixed-point -S -emit-llvm -o - --target=x86_64-scei-ps4 
%s | FileCheck %s
 
 /* Primary signed _Accum */
 
diff --git a/llvm/include/llvm/TargetParser/Triple.h 
b/llvm/include/llvm/TargetParser/Triple.h
index 95014a546f72453..525ea6df3643ca6 100644
--- a/llvm/include/llvm/TargetParser/Triple.h
+++ b/llvm/include/llvm/TargetParser/Triple.h
@@ -273,7 +273,7 @@ class Triple {
 Callable,
 Mesh,
 Amplification,
-
+OpenCL,
 OpenHOS,
 
 LastEnvironmentType = OpenHOS
diff --git a/llvm/lib/TargetParser/Triple.cpp b/llvm/lib/TargetParser/Tripl

[Lldb-commits] [clang-tools-extra] [clang] [lldb] [c++20] P1907R1: Support for generalized non-type template arguments of scalar type. (PR #78041)

2024-01-24 Thread Andrey Ali Khan Bolshakov via lldb-commits

bolshakov-a wrote:

The tests are passed.
Maybe, someone else could write a test and commit? I'm slightly busy.

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


[Lldb-commits] [lldb] [clang] [clang-tools-extra] [c++20] P1907R1: Support for generalized non-type template arguments of scalar type. (PR #78041)

2024-01-24 Thread Erich Keane via lldb-commits

erichkeane wrote:

Fixed in: e3ee3762304aa81e4a240500844bfdd003401b36

I'll submit a request to cherry-pick to the release branch.

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


[Lldb-commits] [lldb] [clang] [clang-tools-extra] Revert "[c++20] P1907R1: Support for generalized non-type template arguments of scalar type." (PR #79302)

2024-01-24 Thread Erich Keane via lldb-commits

https://github.com/erichkeane closed 
https://github.com/llvm/llvm-project/pull/79302
___
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] [lldb] Revert "[c++20] P1907R1: Support for generalized non-type template arguments of scalar type." (PR #79302)

2024-01-24 Thread Erich Keane via lldb-commits

erichkeane wrote:

Fixed in : e3ee3762304aa81e4a240500844bfdd003401b36

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


[Lldb-commits] [clang] [lldb] [NFC][Clang] Improve const correctness for IdentifierInfo (PR #79365)

2024-01-24 Thread via lldb-commits

llvmbot wrote:



@llvm/pr-subscribers-clang-static-analyzer-1

@llvm/pr-subscribers-clang-modules

Author: Bill Wendling (bwendling)


Changes

The IdentifierInfo isn't typically modified. Use 'const' wherever possible.

---

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


76 Files Affected:

- (modified) clang/include/clang/AST/ASTContext.h (+2-2) 
- (modified) clang/include/clang/AST/Decl.h (+20-17) 
- (modified) clang/include/clang/AST/DeclObjC.h (+15-14) 
- (modified) clang/include/clang/AST/DeclTemplate.h (+4-4) 
- (modified) clang/include/clang/AST/ExprCXX.h (+5-5) 
- (modified) clang/include/clang/AST/ExternalASTSource.h (+1-1) 
- (modified) clang/include/clang/AST/NestedNameSpecifier.h (+3-3) 
- (modified) clang/include/clang/Analysis/SelectorExtras.h (+2-2) 
- (modified) clang/include/clang/Basic/IdentifierTable.h (+13-12) 
- (modified) clang/include/clang/Lex/ExternalPreprocessorSource.h (+1-1) 
- (modified) clang/include/clang/Lex/MacroInfo.h (+4-4) 
- (modified) clang/include/clang/Lex/Preprocessor.h (+5-4) 
- (modified) clang/include/clang/Parse/Parser.h (+6-10) 
- (modified) clang/include/clang/Sema/CodeCompleteConsumer.h (+5-4) 
- (modified) clang/include/clang/Sema/DeclSpec.h (+11-12) 
- (modified) clang/include/clang/Sema/ParsedTemplate.h (+4-3) 
- (modified) clang/include/clang/Sema/Sema.h (+38-41) 
- (modified) clang/include/clang/Serialization/ASTReader.h (+5-5) 
- (modified) clang/lib/ARCMigrate/ObjCMT.cpp (+4-3) 
- (modified) clang/lib/ARCMigrate/TransAPIUses.cpp (+1-1) 
- (modified) clang/lib/AST/ASTContext.cpp (+4-7) 
- (modified) clang/lib/AST/ASTImporter.cpp (+3-3) 
- (modified) clang/lib/AST/Decl.cpp (+10-8) 
- (modified) clang/lib/AST/DeclObjC.cpp (+11-16) 
- (modified) clang/lib/AST/DeclTemplate.cpp (+6-8) 
- (modified) clang/lib/AST/NSAPI.cpp (+37-67) 
- (modified) clang/lib/AST/NestedNameSpecifier.cpp (+9-9) 
- (modified) clang/lib/AST/SelectorLocationsKind.cpp (+2-2) 
- (modified) clang/lib/AST/StmtPrinter.cpp (+2-2) 
- (modified) clang/lib/AST/StmtProfile.cpp (+3-3) 
- (modified) clang/lib/Analysis/ObjCNoReturn.cpp (+3-2) 
- (modified) clang/lib/Basic/IdentifierTable.cpp (+9-7) 
- (modified) clang/lib/CodeGen/CGBlocks.cpp (+2-2) 
- (modified) clang/lib/CodeGen/CGCUDANV.cpp (+1-1) 
- (modified) clang/lib/CodeGen/CGDecl.cpp (+2-2) 
- (modified) clang/lib/CodeGen/CGObjC.cpp (+11-12) 
- (modified) clang/lib/CodeGen/CGObjCMac.cpp (+6-7) 
- (modified) clang/lib/CodeGen/CodeGenFunction.cpp (+1-1) 
- (modified) clang/lib/CodeGen/CodeGenModule.cpp (+3-3) 
- (modified) clang/lib/Frontend/Rewrite/RewriteModernObjC.cpp (+1-1) 
- (modified) clang/lib/Lex/HeaderSearch.cpp (+1-2) 
- (modified) clang/lib/Lex/MacroInfo.cpp (+1-1) 
- (modified) clang/lib/Lex/PPLexerChange.cpp (+4-5) 
- (modified) clang/lib/Lex/PPMacroExpansion.cpp (+2-2) 
- (modified) clang/lib/Lex/Preprocessor.cpp (+1-1) 
- (modified) clang/lib/Parse/ParseDecl.cpp (+1-1) 
- (modified) clang/lib/Parse/ParseDeclCXX.cpp (+1-1) 
- (modified) clang/lib/Parse/ParseExprCXX.cpp (+3-2) 
- (modified) clang/lib/Parse/ParseObjc.cpp (+6-6) 
- (modified) clang/lib/Parse/ParseTemplate.cpp (+2-2) 
- (modified) clang/lib/Sema/CodeCompleteConsumer.cpp (+2-1) 
- (modified) clang/lib/Sema/Sema.cpp (+2-3) 
- (modified) clang/lib/Sema/SemaCodeComplete.cpp (+53-55) 
- (modified) clang/lib/Sema/SemaDecl.cpp (+10-9) 
- (modified) clang/lib/Sema/SemaDeclCXX.cpp (+4-5) 
- (modified) clang/lib/Sema/SemaDeclObjC.cpp (+2-3) 
- (modified) clang/lib/Sema/SemaExprCXX.cpp (+11-13) 
- (modified) clang/lib/Sema/SemaExprObjC.cpp (+2-4) 
- (modified) clang/lib/Sema/SemaObjCProperty.cpp (+2-2) 
- (modified) clang/lib/Sema/SemaOpenMP.cpp (+1-1) 
- (modified) clang/lib/Sema/SemaPseudoObject.cpp (+22-26) 
- (modified) clang/lib/Sema/SemaStmt.cpp (+3-5) 
- (modified) clang/lib/Sema/SemaTemplate.cpp (+10-16) 
- (modified) clang/lib/Serialization/ASTCommon.cpp (+1-1) 
- (modified) clang/lib/Serialization/ASTReader.cpp (+7-7) 
- (modified) clang/lib/Serialization/ASTWriter.cpp (+9-9) 
- (modified) clang/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp (+2-2) 
- (modified) clang/lib/StaticAnalyzer/Checkers/LocalizationChecker.cpp (+54-54) 
- (modified) clang/lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp (+2-1) 
- (modified) clang/lib/StaticAnalyzer/Checkers/ObjCMissingSuperCallChecker.cpp 
(+1-1) 
- (modified) clang/lib/StaticAnalyzer/Checkers/ObjCSuperDeallocChecker.cpp 
(+2-2) 
- (modified) clang/tools/libclang/CIndexCodeCompletion.cpp (+5-5) 
- (modified) lldb/source/Plugins/ExpressionParser/Clang/ASTUtils.h (+1-1) 
- (modified) lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp 
(+4-3) 
- (modified) 
lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp
 (+2-2) 
- (modified) lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp (+6-5) 


``diff
diff --git a/clang/include/clang/AST/ASTContext.h 
b/clang/include/clang/AST/ASTContext.h
index

[Lldb-commits] [lldb] [clang] [NFC][Clang] Improve const correctness for IdentifierInfo (PR #79365)

2024-01-24 Thread via lldb-commits

cor3ntin wrote:

I think this is nice, thanks!

I'd like to wait a few weeks before we land it, I'm afraid these changes (which 
do contain some small white spaces-only changes too) might disrupt the release 
process as lot of cherry-picking between main and the llvm18 branch are 
happening and we should minimize the opportunity for merge conflicts.

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


[Lldb-commits] [lldb] [clang] [openmp] [compiler-rt] [lld] [llvm] [libc] [libcxx] [clang-tools-extra] [mlir] [pstl] [Driver] Test ignored target-specific options for AMDGPU/NVPTX (PR #79222)

2024-01-24 Thread via lldb-commits

gulfemsavrun wrote:

We started seeing a test failure in our Clang toolchain builders for Mac:
```
FAIL: Clang :: Driver/unsupported-option-gpu.c (10452 of 19269)
 TEST 'Clang :: Driver/unsupported-option-gpu.c' FAILED 

Exit Code: 1

Command Output (stderr):
--
RUN: at line 4: /Volumes/Work/s/w/ir/x/w/llvm_build/bin/clang -### -c 
-mcmodel=medium -x cuda 
/Volumes/Work/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/unsupported-option-gpu.c
 
--cuda-path=/Volumes/Work/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/Inputs/CUDA/usr/local/cuda
 --offload-arch=sm_60 --no-cuda-version-check -fbasic-block-sections=all
+ /Volumes/Work/s/w/ir/x/w/llvm_build/bin/clang -### -c -mcmodel=medium -x cuda 
/Volumes/Work/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/unsupported-option-gpu.c
 
--cuda-path=/Volumes/Work/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/Inputs/CUDA/usr/local/cuda
 --offload-arch=sm_60 --no-cuda-version-check -fbasic-block-sections=all
Fuchsia clang version 19.0.0git (https://llvm.googlesource.com/llvm-project 
c1cb0b80f00888920050068a8c6b4f78ca40dd43)
Target: x86_64-apple-darwin22.6.0
Thread model: posix
InstalledDir: /Volumes/Work/s/w/ir/x/w/llvm_build/bin
clang: error: unsupported option '-fbasic-block-sections=all' for target 
'x86_64-apple-macosx13.0.0'
 "/Volumes/Work/s/w/ir/x/w/llvm_build/bin/llvm" "clang" "-cc1" "-triple" 
"nvptx64-nvidia-cuda" "-aux-triple" "x86_64-apple-darwin22.6.0" 
"-Wundef-prefix=TARGET_OS_" "-Werror=undef-prefix" 
"-Wdeprecated-objc-isa-usage" "-Werror=deprecated-objc-isa-usage" "-S" 
"-disable-free" "-clear-ast-before-backend" "-main-file-name" 
"unsupported-option-gpu.c" "-mrelocation-model" "static" "-mframe-pointer=all" 
"-fno-rounding-math" "-no-integrated-as" "-aux-target-cpu" "penryn" 
"-fcompatibility-qualified-id-block-type-checking" 
"-fvisibility-inlines-hidden-static-local-var" 
"-fbuiltin-headers-in-system-modules" "-fdefine-target-os-macros" 
"-fcuda-is-device" "-mllvm" "-enable-memcpyopt-without-libcalls" 
"-mlink-builtin-bitcode" 
"/Volumes/Work/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/Inputs/CUDA/usr/local/cuda/nvvm/libdevice/libdevice.compute_30.10.bc"
 "-target-sdk-version=7.0" "-mcmodel=medium" "-target-cpu" "sm_60" 
"-target-feature" "+ptx42" "-debugger-tuning=gdb" "-fno-dwarf-directory-asm" 
"-fdebug-compilation-dir=/Volumes/Work/s/w/ir/x/w/llvm_build/tools/clang/test/Driver"
 "-target-linker-version" "857.1" "-resource-dir" 
"/Volumes/Work/s/w/ir/x/w/llvm_build/lib/clang/19" "-internal-isystem" 
"/Volumes/Work/s/w/ir/x/w/llvm_build/lib/clang/19/include/cuda_wrappers" 
"-include" "__clang_cuda_runtime_wrapper.h" "-internal-isystem" 
"/Volumes/Work/s/w/ir/x/w/llvm_build/bin/../include/c++/v1" "-internal-isystem" 
"/Volumes/Work/s/w/ir/x/w/llvm_build/bin/../include/c++/v1" "-internal-isystem" 
"/usr/local/include" "-internal-isystem" 
"/Volumes/Work/s/w/ir/x/w/llvm_build/lib/clang/19/include" 
"-internal-externc-isystem" "/usr/include" "-internal-isystem" 
"/Volumes/Work/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/Inputs/CUDA/usr/local/cuda/include"
 "-internal-isystem" "/usr/local/include" "-internal-isystem" 
"/Volumes/Work/s/w/ir/x/w/llvm_build/lib/clang/19/include" 
"-internal-externc-isystem" "/usr/include" "-fdeprecated-macro" "-fno-autolink" 
"-ferror-limit" "19" "-fgnuc-version=4.2.1" "-fcxx-exceptions" "-fexceptions" 
"-cuid=5730a5be306aa06d" "-D__GCC_HAVE_DWARF2_CFI_ASM=1" "-o" 
"/Volumes/Work/s/w/ir/x/t/lit-tmp-sgc_485s/unsupported-option-gpu-sm_60-18c1d6.s"
 "-x" "cuda" 
"/Volumes/Work/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/unsupported-option-gpu.c"
 
"/Volumes/Work/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/Inputs/CUDA/usr/local/cuda/bin/ptxas"
 "-m64" "-O0" "--gpu-name" "sm_60" "--output-file" 
"/Volumes/Work/s/w/ir/x/t/lit-tmp-sgc_485s/unsupported-option-gpu-sm_60-02dbb3.cubin"
 
"/Volumes/Work/s/w/ir/x/t/lit-tmp-sgc_485s/unsupported-option-gpu-sm_60-18c1d6.s"
 "fatbinary" "--cuda" "-64" "--create" 
"/Volumes/Work/s/w/ir/x/t/lit-tmp-sgc_485s/unsupported-option-gpu-36608d.fatbin"
 
"--image=profile=sm_60,file=/Volumes/Work/s/w/ir/x/t/lit-tmp-sgc_485s/unsupported-option-gpu-sm_60-02dbb3.cubin"
 
"--image=profile=compute_60,file=/Volumes/Work/s/w/ir/x/t/lit-tmp-sgc_485s/unsupported-option-gpu-sm_60-18c1d6.s"
 "/Volumes/Work/s/w/ir/x/w/llvm_build/bin/llvm" "clang" "-cc1" "-triple" 
"x86_64-apple-macosx13.0.0" "-target-sdk-version=7.0" "-aux-triple" 
"nvptx64-nvidia-cuda" "-Wundef-prefix=TARGET_OS_" "-Werror=undef-prefix" 
"-Wdeprecated-objc-isa-usage" "-Werror=deprecated-objc-isa-usage" "-emit-obj" 
"-mrelax-all" "-disable-free" "-clear-ast-before-backend" "-main-file-name" 
"unsupported-option-gpu.c" "-mrelocation-model" "pic" "-pic-level" "2" 
"-mframe-pointer=all" "-ffp-contract=on" "-fno-rounding-math" 
"-funwind-tables=2" "-fcompatibility-qualified-id-block-type-checking" 
"-fvisibility-inlines-hidden-static-local-var" 
"-fbuiltin-headers-in-system-modules" "-fdefine

[Lldb-commits] [lldb] [clang] [openmp] [compiler-rt] [lld] [llvm] [libc] [libcxx] [clang-tools-extra] [mlir] [pstl] [Driver] Test ignored target-specific options for AMDGPU/NVPTX (PR #79222)

2024-01-24 Thread Joseph Huber via lldb-commits

jhuber6 wrote:

Maybe need to specify `--target=x86_64-unknown-linux-gnu` in the test?

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


[Lldb-commits] [lldb] [lldb] [NFC] Remove unused WatchpointResourceList class (PR #79385)

2024-01-24 Thread Jason Molenda via lldb-commits

https://github.com/jasonmolenda created 
https://github.com/llvm/llvm-project/pull/79385

In `[lldb] [mostly NFC] Large WP foundation: WatchpointResources (#68845)` I 
added a new template StopPointSiteList to combine WatchpointResourceList and 
BreakpointSiteList.  But I didn't remove the now-unused WatchpointResourceList 
class.  This patch fixes that.

>From 229ea2a0311c7c0ecd8554016d3827f8c8ae6c5f Mon Sep 17 00:00:00 2001
From: Jason Molenda 
Date: Wed, 24 Jan 2024 14:45:41 -0800
Subject: [PATCH] [lldb] [NFC] Remove unused WatchpointResourceList class

In `[lldb] [mostly NFC] Large WP foundation: WatchpointResources
(#68845)` I added a new template StopPointSiteList to combine
WatchpointResourceList and BreakpointSiteList.  But I didn't
remove the now-unused WatchpointResourceList class.  This patch
fixes that.
---
 .../lldb/Breakpoint/WatchpointResourceList.h  | 145 --
 .../Breakpoint/WatchpointResourceList.cpp | 114 --
 2 files changed, 259 deletions(-)
 delete mode 100644 lldb/include/lldb/Breakpoint/WatchpointResourceList.h
 delete mode 100644 lldb/source/Breakpoint/WatchpointResourceList.cpp

diff --git a/lldb/include/lldb/Breakpoint/WatchpointResourceList.h 
b/lldb/include/lldb/Breakpoint/WatchpointResourceList.h
deleted file mode 100644
index 0e6c5fab877895c..000
--- a/lldb/include/lldb/Breakpoint/WatchpointResourceList.h
+++ /dev/null
@@ -1,145 +0,0 @@
-//===-- WatchpointResourceList.h *- 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 LLDB_BREAKPOINT_WATCHPOINTRESOURCELIST_H
-#define LLDB_BREAKPOINT_WATCHPOINTRESOURCELIST_H
-
-#include "lldb/Utility/Iterable.h"
-#include "lldb/lldb-private.h"
-#include "lldb/lldb-public.h"
-
-#include 
-#include 
-
-namespace lldb_private {
-
-class WatchpointResourceList {
-
-public:
-  WatchpointResourceList();
-
-  ~WatchpointResourceList();
-
-  /// Add a WatchpointResource to the list.
-  ///
-  /// \param[in] wp_res_sp
-  ///A shared pointer to a breakpoint site being added to the list.
-  ///
-  /// \return
-  ///The ID of the BreakpointSite in the list.
-  lldb::wp_resource_id_t Add(const lldb::WatchpointResourceSP &wp_res_sp);
-
-  /// Removes the watchpoint resource given by \a id from this list.
-  ///
-  /// \param[in] id
-  ///   The watchpoint resource to remove.
-  ///
-  /// \result
-  ///   \b true if the watchpoint resource \a id was in the list.
-  bool Remove(lldb::wp_resource_id_t id);
-
-  /// Removes the watchpoint resource containing address \a addr from this 
list.
-  ///
-  /// \param[in] addr
-  ///   The address from which to remove a watchpoint resource.
-  ///
-  /// \result
-  ///   \b true if \a addr had a watchpoint resource to remove from the list.
-  bool RemoveByAddress(lldb::addr_t addr);
-
-  /// Returns a shared pointer to the watchpoint resource which contains
-  /// \a addr.
-  ///
-  /// \param[in] addr
-  /// The address to look for.
-  ///
-  /// \result
-  /// A shared pointer to the watchpoint resource. May contain a nullptr
-  /// pointer if no watchpoint site exists with a matching address.
-  lldb::WatchpointResourceSP FindByAddress(lldb::addr_t addr);
-
-  /// Returns a shared pointer to the watchpoint resource which is owned
-  /// by \a wp_sp.
-  ///
-  /// \param[in] wp_sp
-  /// The WatchpointSP to look for.
-  ///
-  /// \result
-  /// A shared pointer to the watchpoint resource. May contain a nullptr
-  /// pointer if no watchpoint site exists
-  lldb::WatchpointResourceSP FindByWatchpointSP(lldb::WatchpointSP &wp_sp);
-
-  /// Returns a shared pointer to the watchpoint resource which is owned
-  /// by \a wp.
-  ///
-  /// \param[in] wp
-  /// The Watchpoint to look for.
-  ///
-  /// \result
-  /// A shared pointer to the watchpoint resource. May contain a nullptr
-  /// pointer if no watchpoint site exists
-  lldb::WatchpointResourceSP
-  FindByWatchpoint(const lldb_private::Watchpoint *wp);
-
-  /// Returns a shared pointer to the watchpoint resource which has hardware
-  /// index \a id.  Some Process plugins may not have access to the actual
-  /// hardware watchpoint register number used for a WatchpointResource, so
-  /// the wp_resource_id_t may not be correctly tracking the target's wp
-  /// register target.
-  ///
-  /// \param[in] id
-  /// The hardware resource index to search for.
-  ///
-  /// \result
-  /// A shared pointer to the watchpoint resource. May contain a nullptr
-  /// pointer if no watchpoint site exists with a matching id.
-  lldb::WatchpointResourceSP FindByID(lldb::wp_resource_id_t id);
-
-  ///
-  /// Get the number of WatchpointResources that are available.
-  ///
-  /// \re

[Lldb-commits] [lldb] [lldb] [NFC] Remove unused WatchpointResourceList class (PR #79385)

2024-01-24 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Jason Molenda (jasonmolenda)


Changes

In `[lldb] [mostly NFC] Large WP foundation: WatchpointResources (#68845)` I added a new template StopPointSiteList to combine 
WatchpointResourceList and BreakpointSiteList.  But I didn't remove the 
now-unused WatchpointResourceList class.  This patch fixes that.

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


2 Files Affected:

- (removed) lldb/include/lldb/Breakpoint/WatchpointResourceList.h (-145) 
- (removed) lldb/source/Breakpoint/WatchpointResourceList.cpp (-114) 


``diff
diff --git a/lldb/include/lldb/Breakpoint/WatchpointResourceList.h 
b/lldb/include/lldb/Breakpoint/WatchpointResourceList.h
deleted file mode 100644
index 0e6c5fab877895c..000
--- a/lldb/include/lldb/Breakpoint/WatchpointResourceList.h
+++ /dev/null
@@ -1,145 +0,0 @@
-//===-- WatchpointResourceList.h *- 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 LLDB_BREAKPOINT_WATCHPOINTRESOURCELIST_H
-#define LLDB_BREAKPOINT_WATCHPOINTRESOURCELIST_H
-
-#include "lldb/Utility/Iterable.h"
-#include "lldb/lldb-private.h"
-#include "lldb/lldb-public.h"
-
-#include 
-#include 
-
-namespace lldb_private {
-
-class WatchpointResourceList {
-
-public:
-  WatchpointResourceList();
-
-  ~WatchpointResourceList();
-
-  /// Add a WatchpointResource to the list.
-  ///
-  /// \param[in] wp_res_sp
-  ///A shared pointer to a breakpoint site being added to the list.
-  ///
-  /// \return
-  ///The ID of the BreakpointSite in the list.
-  lldb::wp_resource_id_t Add(const lldb::WatchpointResourceSP &wp_res_sp);
-
-  /// Removes the watchpoint resource given by \a id from this list.
-  ///
-  /// \param[in] id
-  ///   The watchpoint resource to remove.
-  ///
-  /// \result
-  ///   \b true if the watchpoint resource \a id was in the list.
-  bool Remove(lldb::wp_resource_id_t id);
-
-  /// Removes the watchpoint resource containing address \a addr from this 
list.
-  ///
-  /// \param[in] addr
-  ///   The address from which to remove a watchpoint resource.
-  ///
-  /// \result
-  ///   \b true if \a addr had a watchpoint resource to remove from the list.
-  bool RemoveByAddress(lldb::addr_t addr);
-
-  /// Returns a shared pointer to the watchpoint resource which contains
-  /// \a addr.
-  ///
-  /// \param[in] addr
-  /// The address to look for.
-  ///
-  /// \result
-  /// A shared pointer to the watchpoint resource. May contain a nullptr
-  /// pointer if no watchpoint site exists with a matching address.
-  lldb::WatchpointResourceSP FindByAddress(lldb::addr_t addr);
-
-  /// Returns a shared pointer to the watchpoint resource which is owned
-  /// by \a wp_sp.
-  ///
-  /// \param[in] wp_sp
-  /// The WatchpointSP to look for.
-  ///
-  /// \result
-  /// A shared pointer to the watchpoint resource. May contain a nullptr
-  /// pointer if no watchpoint site exists
-  lldb::WatchpointResourceSP FindByWatchpointSP(lldb::WatchpointSP &wp_sp);
-
-  /// Returns a shared pointer to the watchpoint resource which is owned
-  /// by \a wp.
-  ///
-  /// \param[in] wp
-  /// The Watchpoint to look for.
-  ///
-  /// \result
-  /// A shared pointer to the watchpoint resource. May contain a nullptr
-  /// pointer if no watchpoint site exists
-  lldb::WatchpointResourceSP
-  FindByWatchpoint(const lldb_private::Watchpoint *wp);
-
-  /// Returns a shared pointer to the watchpoint resource which has hardware
-  /// index \a id.  Some Process plugins may not have access to the actual
-  /// hardware watchpoint register number used for a WatchpointResource, so
-  /// the wp_resource_id_t may not be correctly tracking the target's wp
-  /// register target.
-  ///
-  /// \param[in] id
-  /// The hardware resource index to search for.
-  ///
-  /// \result
-  /// A shared pointer to the watchpoint resource. May contain a nullptr
-  /// pointer if no watchpoint site exists with a matching id.
-  lldb::WatchpointResourceSP FindByID(lldb::wp_resource_id_t id);
-
-  ///
-  /// Get the number of WatchpointResources that are available.
-  ///
-  /// \return
-  /// The number of WatchpointResources that are stored in the
-  /// WatchpointResourceList.
-  uint32_t GetSize();
-
-  /// Get the WatchpointResource at a given index.
-  ///
-  /// \param [in] idx
-  /// The index of the resource.
-  /// \return
-  /// The WatchpointResource at that index number.
-  lldb::WatchpointResourceSP GetResourceAtIndex(uint32_t idx);
-
-  typedef std::vector collection;
-  typedef LockingAdaptedIterable
-  WatchpointResourceIterable;
-
-  /// Iterate over the list of WatchpointRe

[Lldb-commits] [lldb] [lldb] [NFC] Remove unused WatchpointResourceList class (PR #79385)

2024-01-24 Thread Jason Molenda via lldb-commits

https://github.com/jasonmolenda updated 
https://github.com/llvm/llvm-project/pull/79385

>From 229ea2a0311c7c0ecd8554016d3827f8c8ae6c5f Mon Sep 17 00:00:00 2001
From: Jason Molenda 
Date: Wed, 24 Jan 2024 14:45:41 -0800
Subject: [PATCH 1/2] [lldb] [NFC] Remove unused WatchpointResourceList class

In `[lldb] [mostly NFC] Large WP foundation: WatchpointResources
(#68845)` I added a new template StopPointSiteList to combine
WatchpointResourceList and BreakpointSiteList.  But I didn't
remove the now-unused WatchpointResourceList class.  This patch
fixes that.
---
 .../lldb/Breakpoint/WatchpointResourceList.h  | 145 --
 .../Breakpoint/WatchpointResourceList.cpp | 114 --
 2 files changed, 259 deletions(-)
 delete mode 100644 lldb/include/lldb/Breakpoint/WatchpointResourceList.h
 delete mode 100644 lldb/source/Breakpoint/WatchpointResourceList.cpp

diff --git a/lldb/include/lldb/Breakpoint/WatchpointResourceList.h 
b/lldb/include/lldb/Breakpoint/WatchpointResourceList.h
deleted file mode 100644
index 0e6c5fab877895..00
--- a/lldb/include/lldb/Breakpoint/WatchpointResourceList.h
+++ /dev/null
@@ -1,145 +0,0 @@
-//===-- WatchpointResourceList.h *- 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 LLDB_BREAKPOINT_WATCHPOINTRESOURCELIST_H
-#define LLDB_BREAKPOINT_WATCHPOINTRESOURCELIST_H
-
-#include "lldb/Utility/Iterable.h"
-#include "lldb/lldb-private.h"
-#include "lldb/lldb-public.h"
-
-#include 
-#include 
-
-namespace lldb_private {
-
-class WatchpointResourceList {
-
-public:
-  WatchpointResourceList();
-
-  ~WatchpointResourceList();
-
-  /// Add a WatchpointResource to the list.
-  ///
-  /// \param[in] wp_res_sp
-  ///A shared pointer to a breakpoint site being added to the list.
-  ///
-  /// \return
-  ///The ID of the BreakpointSite in the list.
-  lldb::wp_resource_id_t Add(const lldb::WatchpointResourceSP &wp_res_sp);
-
-  /// Removes the watchpoint resource given by \a id from this list.
-  ///
-  /// \param[in] id
-  ///   The watchpoint resource to remove.
-  ///
-  /// \result
-  ///   \b true if the watchpoint resource \a id was in the list.
-  bool Remove(lldb::wp_resource_id_t id);
-
-  /// Removes the watchpoint resource containing address \a addr from this 
list.
-  ///
-  /// \param[in] addr
-  ///   The address from which to remove a watchpoint resource.
-  ///
-  /// \result
-  ///   \b true if \a addr had a watchpoint resource to remove from the list.
-  bool RemoveByAddress(lldb::addr_t addr);
-
-  /// Returns a shared pointer to the watchpoint resource which contains
-  /// \a addr.
-  ///
-  /// \param[in] addr
-  /// The address to look for.
-  ///
-  /// \result
-  /// A shared pointer to the watchpoint resource. May contain a nullptr
-  /// pointer if no watchpoint site exists with a matching address.
-  lldb::WatchpointResourceSP FindByAddress(lldb::addr_t addr);
-
-  /// Returns a shared pointer to the watchpoint resource which is owned
-  /// by \a wp_sp.
-  ///
-  /// \param[in] wp_sp
-  /// The WatchpointSP to look for.
-  ///
-  /// \result
-  /// A shared pointer to the watchpoint resource. May contain a nullptr
-  /// pointer if no watchpoint site exists
-  lldb::WatchpointResourceSP FindByWatchpointSP(lldb::WatchpointSP &wp_sp);
-
-  /// Returns a shared pointer to the watchpoint resource which is owned
-  /// by \a wp.
-  ///
-  /// \param[in] wp
-  /// The Watchpoint to look for.
-  ///
-  /// \result
-  /// A shared pointer to the watchpoint resource. May contain a nullptr
-  /// pointer if no watchpoint site exists
-  lldb::WatchpointResourceSP
-  FindByWatchpoint(const lldb_private::Watchpoint *wp);
-
-  /// Returns a shared pointer to the watchpoint resource which has hardware
-  /// index \a id.  Some Process plugins may not have access to the actual
-  /// hardware watchpoint register number used for a WatchpointResource, so
-  /// the wp_resource_id_t may not be correctly tracking the target's wp
-  /// register target.
-  ///
-  /// \param[in] id
-  /// The hardware resource index to search for.
-  ///
-  /// \result
-  /// A shared pointer to the watchpoint resource. May contain a nullptr
-  /// pointer if no watchpoint site exists with a matching id.
-  lldb::WatchpointResourceSP FindByID(lldb::wp_resource_id_t id);
-
-  ///
-  /// Get the number of WatchpointResources that are available.
-  ///
-  /// \return
-  /// The number of WatchpointResources that are stored in the
-  /// WatchpointResourceList.
-  uint32_t GetSize();
-
-  /// Get the WatchpointResource at a given index.
-  ///
-  /// \param [in] idx
-  /// The index of the resource.
-  /// \retur

[Lldb-commits] [lldb] Remove watchpointresource setid method (PR #79388)

2024-01-24 Thread Jason Molenda via lldb-commits

https://github.com/jasonmolenda created 
https://github.com/llvm/llvm-project/pull/79388

None

>From 229ea2a0311c7c0ecd8554016d3827f8c8ae6c5f Mon Sep 17 00:00:00 2001
From: Jason Molenda 
Date: Wed, 24 Jan 2024 14:45:41 -0800
Subject: [PATCH 1/2] [lldb] [NFC] Remove unused WatchpointResourceList class

In `[lldb] [mostly NFC] Large WP foundation: WatchpointResources
(#68845)` I added a new template StopPointSiteList to combine
WatchpointResourceList and BreakpointSiteList.  But I didn't
remove the now-unused WatchpointResourceList class.  This patch
fixes that.
---
 .../lldb/Breakpoint/WatchpointResourceList.h  | 145 --
 .../Breakpoint/WatchpointResourceList.cpp | 114 --
 2 files changed, 259 deletions(-)
 delete mode 100644 lldb/include/lldb/Breakpoint/WatchpointResourceList.h
 delete mode 100644 lldb/source/Breakpoint/WatchpointResourceList.cpp

diff --git a/lldb/include/lldb/Breakpoint/WatchpointResourceList.h 
b/lldb/include/lldb/Breakpoint/WatchpointResourceList.h
deleted file mode 100644
index 0e6c5fab877895..00
--- a/lldb/include/lldb/Breakpoint/WatchpointResourceList.h
+++ /dev/null
@@ -1,145 +0,0 @@
-//===-- WatchpointResourceList.h *- 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 LLDB_BREAKPOINT_WATCHPOINTRESOURCELIST_H
-#define LLDB_BREAKPOINT_WATCHPOINTRESOURCELIST_H
-
-#include "lldb/Utility/Iterable.h"
-#include "lldb/lldb-private.h"
-#include "lldb/lldb-public.h"
-
-#include 
-#include 
-
-namespace lldb_private {
-
-class WatchpointResourceList {
-
-public:
-  WatchpointResourceList();
-
-  ~WatchpointResourceList();
-
-  /// Add a WatchpointResource to the list.
-  ///
-  /// \param[in] wp_res_sp
-  ///A shared pointer to a breakpoint site being added to the list.
-  ///
-  /// \return
-  ///The ID of the BreakpointSite in the list.
-  lldb::wp_resource_id_t Add(const lldb::WatchpointResourceSP &wp_res_sp);
-
-  /// Removes the watchpoint resource given by \a id from this list.
-  ///
-  /// \param[in] id
-  ///   The watchpoint resource to remove.
-  ///
-  /// \result
-  ///   \b true if the watchpoint resource \a id was in the list.
-  bool Remove(lldb::wp_resource_id_t id);
-
-  /// Removes the watchpoint resource containing address \a addr from this 
list.
-  ///
-  /// \param[in] addr
-  ///   The address from which to remove a watchpoint resource.
-  ///
-  /// \result
-  ///   \b true if \a addr had a watchpoint resource to remove from the list.
-  bool RemoveByAddress(lldb::addr_t addr);
-
-  /// Returns a shared pointer to the watchpoint resource which contains
-  /// \a addr.
-  ///
-  /// \param[in] addr
-  /// The address to look for.
-  ///
-  /// \result
-  /// A shared pointer to the watchpoint resource. May contain a nullptr
-  /// pointer if no watchpoint site exists with a matching address.
-  lldb::WatchpointResourceSP FindByAddress(lldb::addr_t addr);
-
-  /// Returns a shared pointer to the watchpoint resource which is owned
-  /// by \a wp_sp.
-  ///
-  /// \param[in] wp_sp
-  /// The WatchpointSP to look for.
-  ///
-  /// \result
-  /// A shared pointer to the watchpoint resource. May contain a nullptr
-  /// pointer if no watchpoint site exists
-  lldb::WatchpointResourceSP FindByWatchpointSP(lldb::WatchpointSP &wp_sp);
-
-  /// Returns a shared pointer to the watchpoint resource which is owned
-  /// by \a wp.
-  ///
-  /// \param[in] wp
-  /// The Watchpoint to look for.
-  ///
-  /// \result
-  /// A shared pointer to the watchpoint resource. May contain a nullptr
-  /// pointer if no watchpoint site exists
-  lldb::WatchpointResourceSP
-  FindByWatchpoint(const lldb_private::Watchpoint *wp);
-
-  /// Returns a shared pointer to the watchpoint resource which has hardware
-  /// index \a id.  Some Process plugins may not have access to the actual
-  /// hardware watchpoint register number used for a WatchpointResource, so
-  /// the wp_resource_id_t may not be correctly tracking the target's wp
-  /// register target.
-  ///
-  /// \param[in] id
-  /// The hardware resource index to search for.
-  ///
-  /// \result
-  /// A shared pointer to the watchpoint resource. May contain a nullptr
-  /// pointer if no watchpoint site exists with a matching id.
-  lldb::WatchpointResourceSP FindByID(lldb::wp_resource_id_t id);
-
-  ///
-  /// Get the number of WatchpointResources that are available.
-  ///
-  /// \return
-  /// The number of WatchpointResources that are stored in the
-  /// WatchpointResourceList.
-  uint32_t GetSize();
-
-  /// Get the WatchpointResource at a given index.
-  ///
-  /// \param [in] idx
-  /// The index of the resource.
-  /// 

[Lldb-commits] [lldb] Remove watchpointresource setid method (PR #79388)

2024-01-24 Thread Jason Molenda via lldb-commits

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


[Lldb-commits] [lldb] Remove watchpointresource setid method (PR #79388)

2024-01-24 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Jason Molenda (jasonmolenda)


Changes



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


4 Files Affected:

- (modified) lldb/include/lldb/Breakpoint/WatchpointResource.h (-8) 
- (removed) lldb/include/lldb/Breakpoint/WatchpointResourceList.h (-145) 
- (modified) lldb/source/Breakpoint/WatchpointResource.cpp (-2) 
- (removed) lldb/source/Breakpoint/WatchpointResourceList.cpp (-114) 


``diff
diff --git a/lldb/include/lldb/Breakpoint/WatchpointResource.h 
b/lldb/include/lldb/Breakpoint/WatchpointResource.h
index 4b1d733850f1bbf..070d84cff8f26fe 100644
--- a/lldb/include/lldb/Breakpoint/WatchpointResource.h
+++ b/lldb/include/lldb/Breakpoint/WatchpointResource.h
@@ -121,14 +121,6 @@ class WatchpointResource
   ///A copy of the Watchpoints which own this resource.
   WatchpointCollection CopyConstituentsList();
 
-  // The ID of the WatchpointResource is set by the WatchpointResourceList
-  // when the Resource has been set in the inferior and is being added
-  // to the List, in an attempt to match the hardware watchpoint register
-  // ordering.  If a Process can correctly identify the hardware watchpoint
-  // register index when it has created the Resource, it may initialize it
-  // before it is inserted in the WatchpointResourceList.
-  void SetID(lldb::wp_resource_id_t);
-
   lldb::wp_resource_id_t GetID() const;
 
   bool Contains(lldb::addr_t addr);
diff --git a/lldb/include/lldb/Breakpoint/WatchpointResourceList.h 
b/lldb/include/lldb/Breakpoint/WatchpointResourceList.h
deleted file mode 100644
index 0e6c5fab877895c..000
--- a/lldb/include/lldb/Breakpoint/WatchpointResourceList.h
+++ /dev/null
@@ -1,145 +0,0 @@
-//===-- WatchpointResourceList.h *- 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 LLDB_BREAKPOINT_WATCHPOINTRESOURCELIST_H
-#define LLDB_BREAKPOINT_WATCHPOINTRESOURCELIST_H
-
-#include "lldb/Utility/Iterable.h"
-#include "lldb/lldb-private.h"
-#include "lldb/lldb-public.h"
-
-#include 
-#include 
-
-namespace lldb_private {
-
-class WatchpointResourceList {
-
-public:
-  WatchpointResourceList();
-
-  ~WatchpointResourceList();
-
-  /// Add a WatchpointResource to the list.
-  ///
-  /// \param[in] wp_res_sp
-  ///A shared pointer to a breakpoint site being added to the list.
-  ///
-  /// \return
-  ///The ID of the BreakpointSite in the list.
-  lldb::wp_resource_id_t Add(const lldb::WatchpointResourceSP &wp_res_sp);
-
-  /// Removes the watchpoint resource given by \a id from this list.
-  ///
-  /// \param[in] id
-  ///   The watchpoint resource to remove.
-  ///
-  /// \result
-  ///   \b true if the watchpoint resource \a id was in the list.
-  bool Remove(lldb::wp_resource_id_t id);
-
-  /// Removes the watchpoint resource containing address \a addr from this 
list.
-  ///
-  /// \param[in] addr
-  ///   The address from which to remove a watchpoint resource.
-  ///
-  /// \result
-  ///   \b true if \a addr had a watchpoint resource to remove from the list.
-  bool RemoveByAddress(lldb::addr_t addr);
-
-  /// Returns a shared pointer to the watchpoint resource which contains
-  /// \a addr.
-  ///
-  /// \param[in] addr
-  /// The address to look for.
-  ///
-  /// \result
-  /// A shared pointer to the watchpoint resource. May contain a nullptr
-  /// pointer if no watchpoint site exists with a matching address.
-  lldb::WatchpointResourceSP FindByAddress(lldb::addr_t addr);
-
-  /// Returns a shared pointer to the watchpoint resource which is owned
-  /// by \a wp_sp.
-  ///
-  /// \param[in] wp_sp
-  /// The WatchpointSP to look for.
-  ///
-  /// \result
-  /// A shared pointer to the watchpoint resource. May contain a nullptr
-  /// pointer if no watchpoint site exists
-  lldb::WatchpointResourceSP FindByWatchpointSP(lldb::WatchpointSP &wp_sp);
-
-  /// Returns a shared pointer to the watchpoint resource which is owned
-  /// by \a wp.
-  ///
-  /// \param[in] wp
-  /// The Watchpoint to look for.
-  ///
-  /// \result
-  /// A shared pointer to the watchpoint resource. May contain a nullptr
-  /// pointer if no watchpoint site exists
-  lldb::WatchpointResourceSP
-  FindByWatchpoint(const lldb_private::Watchpoint *wp);
-
-  /// Returns a shared pointer to the watchpoint resource which has hardware
-  /// index \a id.  Some Process plugins may not have access to the actual
-  /// hardware watchpoint register number used for a WatchpointResource, so
-  /// the wp_resource_id_t may not be correctly tracking the target's wp
-  /// register target.
-  ///
-  /// \param[in] id
-  /// The hardware resource index to search for.
-  ///
-  

[Lldb-commits] [lldb] [lldb] [NFC] Remove unused WatchpointResource::SetID method (PR #79389)

2024-01-24 Thread Jason Molenda via lldb-commits

https://github.com/jasonmolenda created 
https://github.com/llvm/llvm-project/pull/79389

I originally thought to try to guesstimate the hardware watchpoint index number 
that a Resource was associated with, but gdb remote serial protocol doesn't 
give us the hardware register index used so it was only a guess.  I changed my 
mind and simply use ever-incrementing ID numbers for the WatchpointResources, 
but forgot to remove the SetID method.

>From 655d9530f6b05deb7bdb6a1e61dab4ee28ffd9aa Mon Sep 17 00:00:00 2001
From: Jason Molenda 
Date: Wed, 24 Jan 2024 15:00:53 -0800
Subject: [PATCH] [lldb] [NFC] Remove unused WatchpointResource::SetID method

I originally thought to try to guesstimate the hardware watchpoint
index number that a Resource was associated with, but gdb remote
serial protocol doesn't give us the hardware register index used
so it was only a guess.  I changed my mind and simply use
ever-incrementing ID numbers for the WatchpointResources, but forgot
to remove the SetID method.
---
 lldb/include/lldb/Breakpoint/WatchpointResource.h | 8 
 lldb/source/Breakpoint/WatchpointResource.cpp | 2 --
 2 files changed, 10 deletions(-)

diff --git a/lldb/include/lldb/Breakpoint/WatchpointResource.h 
b/lldb/include/lldb/Breakpoint/WatchpointResource.h
index 4b1d733850f1bbf..070d84cff8f26fe 100644
--- a/lldb/include/lldb/Breakpoint/WatchpointResource.h
+++ b/lldb/include/lldb/Breakpoint/WatchpointResource.h
@@ -121,14 +121,6 @@ class WatchpointResource
   ///A copy of the Watchpoints which own this resource.
   WatchpointCollection CopyConstituentsList();
 
-  // The ID of the WatchpointResource is set by the WatchpointResourceList
-  // when the Resource has been set in the inferior and is being added
-  // to the List, in an attempt to match the hardware watchpoint register
-  // ordering.  If a Process can correctly identify the hardware watchpoint
-  // register index when it has created the Resource, it may initialize it
-  // before it is inserted in the WatchpointResourceList.
-  void SetID(lldb::wp_resource_id_t);
-
   lldb::wp_resource_id_t GetID() const;
 
   bool Contains(lldb::addr_t addr);
diff --git a/lldb/source/Breakpoint/WatchpointResource.cpp 
b/lldb/source/Breakpoint/WatchpointResource.cpp
index d0f8dc346f3c024..c1eb50c0358b30e 100644
--- a/lldb/source/Breakpoint/WatchpointResource.cpp
+++ b/lldb/source/Breakpoint/WatchpointResource.cpp
@@ -42,8 +42,6 @@ void WatchpointResource::SetType(bool read, bool write) {
 
 wp_resource_id_t WatchpointResource::GetID() const { return m_id; }
 
-void WatchpointResource::SetID(wp_resource_id_t id) { m_id = id; }
-
 bool WatchpointResource::Contains(addr_t addr) {
   if (addr >= m_addr && addr < m_addr + m_size)
 return true;

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


[Lldb-commits] [lldb] [lldb] [NFC] Remove unused WatchpointResource::SetID method (PR #79389)

2024-01-24 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Jason Molenda (jasonmolenda)


Changes

I originally thought to try to guesstimate the hardware watchpoint index number 
that a Resource was associated with, but gdb remote serial protocol doesn't 
give us the hardware register index used so it was only a guess.  I changed my 
mind and simply use ever-incrementing ID numbers for the WatchpointResources, 
but forgot to remove the SetID method.

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


2 Files Affected:

- (modified) lldb/include/lldb/Breakpoint/WatchpointResource.h (-8) 
- (modified) lldb/source/Breakpoint/WatchpointResource.cpp (-2) 


``diff
diff --git a/lldb/include/lldb/Breakpoint/WatchpointResource.h 
b/lldb/include/lldb/Breakpoint/WatchpointResource.h
index 4b1d733850f1bbf..070d84cff8f26fe 100644
--- a/lldb/include/lldb/Breakpoint/WatchpointResource.h
+++ b/lldb/include/lldb/Breakpoint/WatchpointResource.h
@@ -121,14 +121,6 @@ class WatchpointResource
   ///A copy of the Watchpoints which own this resource.
   WatchpointCollection CopyConstituentsList();
 
-  // The ID of the WatchpointResource is set by the WatchpointResourceList
-  // when the Resource has been set in the inferior and is being added
-  // to the List, in an attempt to match the hardware watchpoint register
-  // ordering.  If a Process can correctly identify the hardware watchpoint
-  // register index when it has created the Resource, it may initialize it
-  // before it is inserted in the WatchpointResourceList.
-  void SetID(lldb::wp_resource_id_t);
-
   lldb::wp_resource_id_t GetID() const;
 
   bool Contains(lldb::addr_t addr);
diff --git a/lldb/source/Breakpoint/WatchpointResource.cpp 
b/lldb/source/Breakpoint/WatchpointResource.cpp
index d0f8dc346f3c024..c1eb50c0358b30e 100644
--- a/lldb/source/Breakpoint/WatchpointResource.cpp
+++ b/lldb/source/Breakpoint/WatchpointResource.cpp
@@ -42,8 +42,6 @@ void WatchpointResource::SetType(bool read, bool write) {
 
 wp_resource_id_t WatchpointResource::GetID() const { return m_id; }
 
-void WatchpointResource::SetID(wp_resource_id_t id) { m_id = id; }
-
 bool WatchpointResource::Contains(addr_t addr) {
   if (addr >= m_addr && addr < m_addr + m_size)
 return true;

``




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


[Lldb-commits] [libcxx] [compiler-rt] [libclc] [lld] [clang] [llvm] [libc] [lldb] [clang-tools-extra] [libcxxabi] [flang] [VPlan] Add new VPUniformPerUFRecipe, use for step truncation. (PR #78113)

2024-01-24 Thread via lldb-commits

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


[Lldb-commits] [libc] [clang] [flang] [llvm] [compiler-rt] [libcxxabi] [clang-tools-extra] [libcxx] [lldb] [lld] [libclc] [VPlan] Add new VPUniformPerUFRecipe, use for step truncation. (PR #78113)

2024-01-24 Thread via lldb-commits


@@ -230,7 +230,11 @@ Type *VPTypeAnalysis::inferScalarType(const VPValue *V) {
 return V->getUnderlyingValue()->getType();
   })
   .Case(
-  [](const VPWidenCastRecipe *R) { return R->getResultType(); });
+  [](const VPWidenCastRecipe *R) { return R->getResultType(); })
+  .Case([](const VPExpandSCEVRecipe *R) {

ayalz wrote:

So now that VPDerivedIVRecipe simply mirrors the type of its first start-value 
operand, should it join VPCanonicalIVPHIRecipe et al.'s or VPPredInstPHIRecipe 
et al.'s cases above and remove its getScalarType() method? Possibly as a 
follow-up.

Should VPWidenIntOrFpInductionRecipe's trunc also utilize VPScalarCastRecipe, 
and retire its getScalarType(), possibly as a follow-up?

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


[Lldb-commits] [llvm] [clang] [flang] [lldb] [libcxxabi] [libc] [libcxx] [libclc] [lld] [compiler-rt] [clang-tools-extra] [VPlan] Add new VPUniformPerUFRecipe, use for step truncation. (PR #78113)

2024-01-24 Thread via lldb-commits


@@ -1469,6 +1461,52 @@ void VPReplicateRecipe::print(raw_ostream &O, const 
Twine &Indent,
 }
 #endif
 
+static bool isUniformAcrossVFsAndUFs(VPScalarCastRecipe *C) {
+  return C->isDefinedOutsideVectorRegions() ||
+ isa(C->getOperand(0)) ||
+ isa(C->getOperand(0));
+}
+
+Value *VPScalarCastRecipe ::generate(VPTransformState &State, unsigned Part) {
+  assert(vputils::onlyFirstLaneUsed(this) &&
+ "Codegen only implemented for first lane.");
+  switch (Opcode) {
+  case Instruction::SExt:
+  case Instruction::ZExt:

ayalz wrote:

Only Trunc is currently being used, still.

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


[Lldb-commits] [lldb] [libc] [llvm] [clang-tools-extra] [libcxxabi] [flang] [lld] [compiler-rt] [clang] [libcxx] [libclc] [VPlan] Add new VPUniformPerUFRecipe, use for step truncation. (PR #78113)

2024-01-24 Thread via lldb-commits


@@ -1469,6 +1461,52 @@ void VPReplicateRecipe::print(raw_ostream &O, const 
Twine &Indent,
 }
 #endif
 
+static bool isUniformAcrossVFsAndUFs(VPScalarCastRecipe *C) {

ayalz wrote:

Worth documenting, potentially leaving behind a note that uniformity should 
essentially be associated with VPValues.

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


[Lldb-commits] [flang] [compiler-rt] [libclc] [clang-tools-extra] [llvm] [clang] [libc] [libcxxabi] [lldb] [libcxx] [lld] [VPlan] Add new VPUniformPerUFRecipe, use for step truncation. (PR #78113)

2024-01-24 Thread via lldb-commits

https://github.com/ayalz commented:

Nice reuse and clean-up! Title and commit message deserve an update.

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


[Lldb-commits] [clang-tools-extra] [libclc] [libcxxabi] [clang] [lld] [lldb] [flang] [libc] [llvm] [libcxx] [compiler-rt] [VPlan] Add new VPUniformPerUFRecipe, use for step truncation. (PR #78113)

2024-01-24 Thread via lldb-commits


@@ -498,10 +498,34 @@ static VPValue *createScalarIVSteps(VPlan &Plan, const 
InductionDescriptor &ID,
   VPCanonicalIVPHIRecipe *CanonicalIV = Plan.getCanonicalIV();
   Type *TruncTy = TruncI ? TruncI->getType() : IVTy;
   VPValue *BaseIV = CanonicalIV;

ayalz wrote:

Can we first check if Start and Step are canonical, regardless of types, in 
order to introduce a VPDerivedIVRecipe, i.e., remove the last Type parameter 
from isCanonical():

```
  VPSingleDefRecipe *BaseIV = CanonicalIV;

  // If the induction needs transforming besides truncating, create a
  // VPDerivedIVRecipe.
  if (!CanonicalIV->isCanonical(ID.getKind(), StartV, Step)) {
BaseIV = new VPDerivedIVRecipe(ID, StartV, CanonicalIV, Step);
HeaderVPBB->insert(BaseIV, IP);
  }
```

then check if BaseIV needs to be truncated:

```
  VPTypeAnalysis TypeInfo(SE.getContext());
  Type *BaseIVTy = TypeInfo.inferScalarType(BaseIV);
  if (TruncI && TruncI->getType() != BaseIVTy) {
Type *TruncTy = TruncI->getType();
assert(BaseIVTy->getScalarSizeInBits() > TruncTy->getScalarSizeInBits() &&
 BaseIVTy->isIntegerTy() && "Truncation requires an integer step");
BaseIV = new VPScalarCastRecipe(Instruction::Trunc, BaseIV, TruncTy);
BaseIVTy = TruncTy;
HeaderVPBB->insert(BaseIV, IP);
  }
```
  
and finally check if Step needs to be truncated:

```
  Type *StepTy = TypeInfo.inferScalarType(Step);
  if (BaseIVTy != StepTy) {
assert(StepTy->getScalarSizeInBits() > BaseIVTy->getScalarSizeInBits() &&
   StepTy->isIntegerTy() && "Not truncating.");
Step = new VPScalarCastRecipe(Instruction::Trunc, Step, BaseIVTy);
auto *VecPreheader =
cast(Plan.getVectorLoopRegion()->getSinglePredecessor());
VecPreheader->appendRecipe(Step->getDefiningRecipe());
  }
```
before creating, inserting and returning `Steps`? Is `IVTy` needed?

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


[Lldb-commits] [lldb] [lldb] [NFC] Remove unused WatchpointResourceList class (PR #79385)

2024-01-24 Thread Alex Langford via lldb-commits

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

Thanks for taking care of that!

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


[Lldb-commits] [lldb] [lldb] [NFC] Remove unused WatchpointResource::SetID method (PR #79389)

2024-01-24 Thread Alex Langford via lldb-commits

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

LGTM

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


[Lldb-commits] [lldb] bddeef5 - [lldb] [NFC] Remove unused WatchpointResourceList class (#79385)

2024-01-24 Thread via lldb-commits

Author: Jason Molenda
Date: 2024-01-24T15:18:33-08:00
New Revision: bddeef54cb66609ad0a32d840051713cd8487adb

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

LOG: [lldb] [NFC] Remove unused WatchpointResourceList class (#79385)

In `[lldb] [mostly NFC] Large WP foundation: WatchpointResources
(#68845)` I added a new template StopPointSiteList to combine
WatchpointResourceList and BreakpointSiteList. But I didn't remove the
now-unused WatchpointResourceList class. This patch fixes that.

Added: 


Modified: 
lldb/source/Breakpoint/CMakeLists.txt

Removed: 
lldb/include/lldb/Breakpoint/WatchpointResourceList.h
lldb/source/Breakpoint/WatchpointResourceList.cpp



diff  --git a/lldb/include/lldb/Breakpoint/WatchpointResourceList.h 
b/lldb/include/lldb/Breakpoint/WatchpointResourceList.h
deleted file mode 100644
index 0e6c5fab877895c..000
--- a/lldb/include/lldb/Breakpoint/WatchpointResourceList.h
+++ /dev/null
@@ -1,145 +0,0 @@
-//===-- WatchpointResourceList.h *- 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 LLDB_BREAKPOINT_WATCHPOINTRESOURCELIST_H
-#define LLDB_BREAKPOINT_WATCHPOINTRESOURCELIST_H
-
-#include "lldb/Utility/Iterable.h"
-#include "lldb/lldb-private.h"
-#include "lldb/lldb-public.h"
-
-#include 
-#include 
-
-namespace lldb_private {
-
-class WatchpointResourceList {
-
-public:
-  WatchpointResourceList();
-
-  ~WatchpointResourceList();
-
-  /// Add a WatchpointResource to the list.
-  ///
-  /// \param[in] wp_res_sp
-  ///A shared pointer to a breakpoint site being added to the list.
-  ///
-  /// \return
-  ///The ID of the BreakpointSite in the list.
-  lldb::wp_resource_id_t Add(const lldb::WatchpointResourceSP &wp_res_sp);
-
-  /// Removes the watchpoint resource given by \a id from this list.
-  ///
-  /// \param[in] id
-  ///   The watchpoint resource to remove.
-  ///
-  /// \result
-  ///   \b true if the watchpoint resource \a id was in the list.
-  bool Remove(lldb::wp_resource_id_t id);
-
-  /// Removes the watchpoint resource containing address \a addr from this 
list.
-  ///
-  /// \param[in] addr
-  ///   The address from which to remove a watchpoint resource.
-  ///
-  /// \result
-  ///   \b true if \a addr had a watchpoint resource to remove from the list.
-  bool RemoveByAddress(lldb::addr_t addr);
-
-  /// Returns a shared pointer to the watchpoint resource which contains
-  /// \a addr.
-  ///
-  /// \param[in] addr
-  /// The address to look for.
-  ///
-  /// \result
-  /// A shared pointer to the watchpoint resource. May contain a nullptr
-  /// pointer if no watchpoint site exists with a matching address.
-  lldb::WatchpointResourceSP FindByAddress(lldb::addr_t addr);
-
-  /// Returns a shared pointer to the watchpoint resource which is owned
-  /// by \a wp_sp.
-  ///
-  /// \param[in] wp_sp
-  /// The WatchpointSP to look for.
-  ///
-  /// \result
-  /// A shared pointer to the watchpoint resource. May contain a nullptr
-  /// pointer if no watchpoint site exists
-  lldb::WatchpointResourceSP FindByWatchpointSP(lldb::WatchpointSP &wp_sp);
-
-  /// Returns a shared pointer to the watchpoint resource which is owned
-  /// by \a wp.
-  ///
-  /// \param[in] wp
-  /// The Watchpoint to look for.
-  ///
-  /// \result
-  /// A shared pointer to the watchpoint resource. May contain a nullptr
-  /// pointer if no watchpoint site exists
-  lldb::WatchpointResourceSP
-  FindByWatchpoint(const lldb_private::Watchpoint *wp);
-
-  /// Returns a shared pointer to the watchpoint resource which has hardware
-  /// index \a id.  Some Process plugins may not have access to the actual
-  /// hardware watchpoint register number used for a WatchpointResource, so
-  /// the wp_resource_id_t may not be correctly tracking the target's wp
-  /// register target.
-  ///
-  /// \param[in] id
-  /// The hardware resource index to search for.
-  ///
-  /// \result
-  /// A shared pointer to the watchpoint resource. May contain a nullptr
-  /// pointer if no watchpoint site exists with a matching id.
-  lldb::WatchpointResourceSP FindByID(lldb::wp_resource_id_t id);
-
-  ///
-  /// Get the number of WatchpointResources that are available.
-  ///
-  /// \return
-  /// The number of WatchpointResources that are stored in the
-  /// WatchpointResourceList.
-  uint32_t GetSize();
-
-  /// Get the WatchpointResource at a given index.
-  ///
-  /// \param [in] idx
-  /// The index of the r

[Lldb-commits] [lldb] [lldb] [NFC] Remove unused WatchpointResourceList class (PR #79385)

2024-01-24 Thread Jason Molenda via lldb-commits

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


[Lldb-commits] [lldb] 56da799 - [lldb] [NFC] Remove unused WatchpointResource::SetID method (#79389)

2024-01-24 Thread via lldb-commits

Author: Jason Molenda
Date: 2024-01-24T15:18:49-08:00
New Revision: 56da7991ead442b7c0ef9ec47d625253ed6b926e

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

LOG: [lldb] [NFC] Remove unused WatchpointResource::SetID method (#79389)

I originally thought to try to guesstimate the hardware watchpoint index
number that a Resource was associated with, but gdb remote serial
protocol doesn't give us the hardware register index used so it was only
a guess. I changed my mind and simply use ever-incrementing ID numbers
for the WatchpointResources, but forgot to remove the SetID method.

Added: 


Modified: 
lldb/include/lldb/Breakpoint/WatchpointResource.h
lldb/source/Breakpoint/WatchpointResource.cpp

Removed: 




diff  --git a/lldb/include/lldb/Breakpoint/WatchpointResource.h 
b/lldb/include/lldb/Breakpoint/WatchpointResource.h
index 4b1d733850f1bbf..070d84cff8f26fe 100644
--- a/lldb/include/lldb/Breakpoint/WatchpointResource.h
+++ b/lldb/include/lldb/Breakpoint/WatchpointResource.h
@@ -121,14 +121,6 @@ class WatchpointResource
   ///A copy of the Watchpoints which own this resource.
   WatchpointCollection CopyConstituentsList();
 
-  // The ID of the WatchpointResource is set by the WatchpointResourceList
-  // when the Resource has been set in the inferior and is being added
-  // to the List, in an attempt to match the hardware watchpoint register
-  // ordering.  If a Process can correctly identify the hardware watchpoint
-  // register index when it has created the Resource, it may initialize it
-  // before it is inserted in the WatchpointResourceList.
-  void SetID(lldb::wp_resource_id_t);
-
   lldb::wp_resource_id_t GetID() const;
 
   bool Contains(lldb::addr_t addr);

diff  --git a/lldb/source/Breakpoint/WatchpointResource.cpp 
b/lldb/source/Breakpoint/WatchpointResource.cpp
index d0f8dc346f3c024..c1eb50c0358b30e 100644
--- a/lldb/source/Breakpoint/WatchpointResource.cpp
+++ b/lldb/source/Breakpoint/WatchpointResource.cpp
@@ -42,8 +42,6 @@ void WatchpointResource::SetType(bool read, bool write) {
 
 wp_resource_id_t WatchpointResource::GetID() const { return m_id; }
 
-void WatchpointResource::SetID(wp_resource_id_t id) { m_id = id; }
-
 bool WatchpointResource::Contains(addr_t addr) {
   if (addr >= m_addr && addr < m_addr + m_size)
 return true;



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


[Lldb-commits] [lldb] [lldb] [NFC] Remove unused WatchpointResource::SetID method (PR #79389)

2024-01-24 Thread Jason Molenda via lldb-commits

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


[Lldb-commits] [lldb] [clang] [NFC][Clang] Improve const correctness for IdentifierInfo (PR #79365)

2024-01-24 Thread Bill Wendling via lldb-commits

bwendling wrote:

> I'd like to wait a few weeks before we land it, I'm afraid these changes 
> (which do contain some small white spaces-only changes too) might disrupt the 
> release process as lot of cherry-picking between main and the llvm18 branch 
> are happening and we should minimize the opportunity for merge conflicts.

That sounds good. Thanks!

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


[Lldb-commits] [llvm] [libcxx] [libc] [clang] [flang] [compiler-rt] [libcxxabi] [lldb] [clang-tools-extra] [lld] [NVPTX] Improve lowering of v4i8 (PR #67866)

2024-01-24 Thread Justin Fargnoli via lldb-commits


@@ -2110,6 +2214,29 @@ def : Pat<(seteq Int1Regs:$a, Int1Regs:$b),
 def : Pat<(setueq Int1Regs:$a, Int1Regs:$b),
   (NOT1 (XORb1rr Int1Regs:$a, Int1Regs:$b))>;
 
+// comparisons of i8 extracted with BFE as i32
+def: Pat<(setgt (sext_inreg (trunc Int32Regs:$a), i8), (sext_inreg (trunc 
Int32Regs:$b), i8)),
+ (SETP_s32rr Int32Regs:$a, Int32Regs:$b, CmpGT)>;
+def: Pat<(setge (sext_inreg (trunc Int32Regs:$a), i8), (sext_inreg (trunc 
Int32Regs:$b), i8)),
+ (SETP_s32rr Int32Regs:$a, Int32Regs:$b, CmpGE)>;
+def: Pat<(setlt (sext_inreg (trunc Int32Regs:$a), i8), (sext_inreg (trunc 
Int32Regs:$b), i8)),
+ (SETP_s32rr Int32Regs:$a, Int32Regs:$b, CmpLT)>;
+def: Pat<(setle (sext_inreg (trunc Int32Regs:$a), i8), (sext_inreg (trunc 
Int32Regs:$b), i8)),
+ (SETP_s32rr Int32Regs:$a, Int32Regs:$b, CmpLE)>;
+
+def: Pat<(setugt (i16 (and (trunc Int32Regs:$a), 255)), (i16 (and (trunc 
Int32Regs:$b), 255))),
+ (SETP_u32rr Int32Regs:$a, Int32Regs:$b, CmpHI)>;
+def: Pat<(setuge (i16 (and (trunc Int32Regs:$a), 255)), (i16 (and (trunc 
Int32Regs:$b), 255))),
+ (SETP_u32rr Int32Regs:$a, Int32Regs:$b, CmpHS)>;
+def: Pat<(setult (i16 (and (trunc Int32Regs:$a), 255)), (i16 (and (trunc 
Int32Regs:$b), 255))),
+ (SETP_u32rr Int32Regs:$a, Int32Regs:$b, CmpLO)>;
+def: Pat<(setule (i16 (and (trunc Int32Regs:$a), 255)), (i16 (and (trunc 
Int32Regs:$b), 255))),
+ (SETP_u32rr Int32Regs:$a, Int32Regs:$b, CmpLS)>;
+def: Pat<(seteq (i16 (and (trunc Int32Regs:$a), 255)), (i16 (and (trunc 
Int32Regs:$b), 255))),
+ (SETP_u32rr Int32Regs:$a, Int32Regs:$b, CmpEQ)>;
+def: Pat<(setne (i16 (and (trunc Int32Regs:$a), 255)), (i16 (and (trunc 
Int32Regs:$b), 255))),
+ (SETP_u32rr Int32Regs:$a, Int32Regs:$b, CmpNE)>;

justinfargnoli wrote:

Hi @Artem-B, I believe that these patterns are not correct.

Doing the comparison, without first ensuring that the value only uses the lower 
8 bits, can lead to incorrect results. For example, when %a := Ox100 and %b := 
Ox1,
setugt (i16 (and (trunc Int32Regs:$a), 255)), (i16 (and (trunc Int32Regs:$b), 
255))) produces a false predicate. Whereas SETP_u32rr Int32Regs:$a, 
Int32Regs:$b, CmpHI will produce a true predicate.

(I'm not super familiar with the pattern syntax through, so please correct me 
if I'm misunderstanding something.)

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


[Lldb-commits] [libunwind] [compiler-rt] [lld] [clang-tools-extra] [clang] [lldb] [libcxx] [flang] [llvm] [libc] [Driver, CodeGen] Support -mtls-dialect= (PR #79256)

2024-01-24 Thread Fangrui Song via lldb-commits

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

>From be08e64c2c1f433b017185ce78525ad097e609be Mon Sep 17 00:00:00 2001
From: Fangrui Song 
Date: Tue, 23 Jan 2024 21:37:04 -0800
Subject: [PATCH 1/2] =?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
---
 clang/include/clang/Basic/CodeGenOptions.def |  3 +++
 clang/include/clang/Driver/Options.td|  5 +
 clang/lib/CodeGen/BackendUtil.cpp|  1 +
 clang/lib/Driver/ToolChains/Clang.cpp| 23 
 clang/test/CodeGen/RISCV/tls-dialect.c   | 13 +++
 clang/test/Driver/tls-dialect.c  | 19 
 6 files changed, 64 insertions(+)
 create mode 100644 clang/test/CodeGen/RISCV/tls-dialect.c
 create mode 100644 clang/test/Driver/tls-dialect.c

diff --git a/clang/include/clang/Basic/CodeGenOptions.def 
b/clang/include/clang/Basic/CodeGenOptions.def
index 2f2e45d5cf63dfa..7c0bfe328496147 100644
--- a/clang/include/clang/Basic/CodeGenOptions.def
+++ b/clang/include/clang/Basic/CodeGenOptions.def
@@ -369,6 +369,9 @@ ENUM_CODEGENOPT(VecLib, llvm::driver::VectorLibrary, 3, 
llvm::driver::VectorLibr
 /// The default TLS model to use.
 ENUM_CODEGENOPT(DefaultTLSModel, TLSModel, 2, GeneralDynamicTLSModel)
 
+/// Whether to enable TLSDESC. AArch64 enables TLSDESC regardless of this 
value.
+CODEGENOPT(EnableTLSDESC, 1, 0)
+
 /// Bit size of immediate TLS offsets (0 == use the default).
 VALUE_CODEGENOPT(TLSSize, 8, 0)
 
diff --git a/clang/include/clang/Driver/Options.td 
b/clang/include/clang/Driver/Options.td
index 7f4fa33748facaf..773bc1dcda01d5c 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -4419,6 +4419,8 @@ def mtls_size_EQ : Joined<["-"], "mtls-size=">, 
Group,
   HelpText<"Specify bit size of immediate TLS offsets (AArch64 ELF only): "
"12 (for 4KB) | 24 (for 16MB, default) | 32 (for 4GB) | 48 (for 
256TB, needs -mcmodel=large)">,
   MarshallingInfoInt>;
+def mtls_dialect_EQ : Joined<["-"], "mtls-dialect=">, Group,
+  Flags<[TargetSpecific]>, HelpText<"Which thread-local storage dialect to use 
for dynamic accesses of TLS variables">;
 def mimplicit_it_EQ : Joined<["-"], "mimplicit-it=">, Group;
 def mdefault_build_attributes : Joined<["-"], "mdefault-build-attributes">, 
Group;
 def mno_default_build_attributes : Joined<["-"], 
"mno-default-build-attributes">, Group;
@@ -7066,6 +7068,9 @@ def fexperimental_assignment_tracking_EQ : Joined<["-"], 
"fexperimental-assignme
   Values<"disabled,enabled,forced">, 
NormalizedValues<["Disabled","Enabled","Forced"]>,
   MarshallingInfoEnum, "Enabled">;
 
+def enable_tlsdesc : Flag<["-"], "enable-tlsdesc">,
+  MarshallingInfoFlag>;
+
 } // let Visibility = [CC1Option]
 
 
//===--===//
diff --git a/clang/lib/CodeGen/BackendUtil.cpp 
b/clang/lib/CodeGen/BackendUtil.cpp
index ec203f6f28bc173..7877e20d77f7724 100644
--- a/clang/lib/CodeGen/BackendUtil.cpp
+++ b/clang/lib/CodeGen/BackendUtil.cpp
@@ -401,6 +401,7 @@ static bool initTargetOptions(DiagnosticsEngine &Diags,
   Options.UniqueBasicBlockSectionNames =
   CodeGenOpts.UniqueBasicBlockSectionNames;
   Options.TLSSize = CodeGenOpts.TLSSize;
+  Options.EnableTLSDESC = CodeGenOpts.EnableTLSDESC;
   Options.EmulatedTLS = CodeGenOpts.EmulatedTLS;
   Options.DebuggerTuning = CodeGenOpts.getDebuggerTuning();
   Options.EmitStackSizeSection = CodeGenOpts.StackSizeSection;
diff --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index 5dc614e11aab599..93fd579eb92ba50 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -5822,6 +5822,29 @@ void Clang::ConstructJob(Compilation &C, const JobAction 
&JA,
 Args.AddLastArg(CmdArgs, options::OPT_mtls_size_EQ);
   }
 
+  if (Arg *A = Args.getLastArg(options::OPT_mtls_dialect_EQ)) {
+StringRef V = A->getValue();
+bool SupportedArgument = false, EnableTLSDESC = false;
+bool Unsupported = !Triple.isOSBinFormatELF();
+if (Triple.isRISCV()) {
+  SupportedArgument = V == "desc" || V == "trad";
+  EnableTLSDESC = V == "desc";
+} else if (Triple.isX86()) {
+  SupportedArgument = V == "gnu";
+} else {
+  Unsupported = true;
+}
+if (Unsupported) {
+  D.Diag(diag::err_drv_unsupported_opt_for_target)
+  << A->getSpelling() << TripleStr;
+} else if (!SupportedArgument) {
+  D.Diag(diag::err_drv_unsupported_option_argument_for_target)
+  << A->getSpelling() << V << TripleStr;
+} else if (EnableTLSDESC) {
+  CmdArgs.push_back("-enable-tlsdesc");
+}
+  }
+
   // Add the target cpu
   std::string CPU = getCPUName(D, Args, Triple, /*FromAs*/ false);
   if (!CPU.empty()) {
diff --git a/clang/test/CodeG

[Lldb-commits] [libcxx] [clang-tools-extra] [flang] [libc] [llvm] [lld] [compiler-rt] [lldb] [clang] [libunwind] [Driver, CodeGen] Support -mtls-dialect= (PR #79256)

2024-01-24 Thread Fangrui Song via lldb-commits

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


[Lldb-commits] [libcxx] [clang-tools-extra] [flang] [libc] [llvm] [lld] [compiler-rt] [lldb] [clang] [libunwind] [Driver, CodeGen] Support -mtls-dialect= (PR #79256)

2024-01-24 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 bb6a4850553dd4140a5bd63187ec1b14d0b731f9 
7953afb6b942ac645c5165bc38e3694265ef4d5d -- 
clang/test/CodeGen/RISCV/tls-dialect.c clang/test/Driver/tls-dialect.c 
clang/lib/CodeGen/BackendUtil.cpp clang/lib/Driver/ToolChains/Clang.cpp 
clang/lib/Driver/ToolChains/CommonArgs.cpp 
clang/lib/Driver/ToolChains/CommonArgs.h llvm/include/llvm/TargetParser/Triple.h
``





View the diff from clang-format here.


``diff
diff --git a/clang/lib/Driver/ToolChains/CommonArgs.cpp 
b/clang/lib/Driver/ToolChains/CommonArgs.cpp
index 26a032c719..1d6b449f04 100644
--- a/clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ b/clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -727,7 +727,8 @@ bool tools::isUseSeparateSections(const llvm::Triple 
&Triple) {
   return Triple.isPS();
 }
 
-bool tools::isTLSDESCEnabled(const ToolChain &TC, const llvm::opt::ArgList 
&Args) {
+bool tools::isTLSDESCEnabled(const ToolChain &TC,
+ const llvm::opt::ArgList &Args) {
   const llvm::Triple &Triple = TC.getEffectiveTriple();
   Arg *A = Args.getLastArg(options::OPT_mtls_dialect_EQ);
   if (!A)

``




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


[Lldb-commits] [flang] [libunwind] [llvm] [clang] [lldb] [libc] [clang-tools-extra] [compiler-rt] [libcxx] [lld] [ELF] Implement R_RISCV_TLSDESC for RISC-V (PR #79239)

2024-01-24 Thread Fangrui Song via lldb-commits

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


[Lldb-commits] [lldb] [llvm] [compiler-rt] [flang] [clang] [clang-tools-extra] [libunwind] [lld] [libc] [libcxx] [ELF] Implement R_RISCV_TLSDESC for RISC-V (PR #79239)

2024-01-24 Thread Fangrui Song via lldb-commits

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

>From 3725fa4eac3d3d946289d7eb7213f3a1751a2770 Mon Sep 17 00:00:00 2001
From: Fangrui Song 
Date: Tue, 23 Jan 2024 17:58:07 -0800
Subject: [PATCH] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20initia?=
 =?UTF-8?q?l=20version?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Created using spr 1.3.4
---
 lld/ELF/Arch/RISCV.cpp| 158 +
 lld/ELF/Relocations.cpp   |  25 ++--
 lld/test/ELF/riscv-tlsdesc-gd-mixed.s |  26 
 lld/test/ELF/riscv-tlsdesc-relax.s| 125 +
 lld/test/ELF/riscv-tlsdesc.s  | 192 ++
 5 files changed, 492 insertions(+), 34 deletions(-)
 create mode 100644 lld/test/ELF/riscv-tlsdesc-gd-mixed.s
 create mode 100644 lld/test/ELF/riscv-tlsdesc-relax.s
 create mode 100644 lld/test/ELF/riscv-tlsdesc.s

diff --git a/lld/ELF/Arch/RISCV.cpp b/lld/ELF/Arch/RISCV.cpp
index d7d3d3e4781497..67d7e2562e9b17 100644
--- a/lld/ELF/Arch/RISCV.cpp
+++ b/lld/ELF/Arch/RISCV.cpp
@@ -61,6 +61,7 @@ enum Op {
   AUIPC = 0x17,
   JALR = 0x67,
   LD = 0x3003,
+  LUI = 0x37,
   LW = 0x2003,
   SRLI = 0x5013,
   SUB = 0x4033,
@@ -73,6 +74,7 @@ enum Reg {
   X_T0 = 5,
   X_T1 = 6,
   X_T2 = 7,
+  X_A0 = 10,
   X_T3 = 28,
 };
 
@@ -102,6 +104,26 @@ static uint32_t setLO12_S(uint32_t insn, uint32_t imm) {
  (extractBits(imm, 4, 0) << 7);
 }
 
+namespace {
+struct SymbolAnchor {
+  uint64_t offset;
+  Defined *d;
+  bool end; // true for the anchor of st_value+st_size
+};
+} // namespace
+
+struct elf::RISCVRelaxAux {
+  // This records symbol start and end offsets which will be adjusted according
+  // to the nearest relocDeltas element.
+  SmallVector anchors;
+  // For relocations[i], the actual offset is r_offset - (i ? relocDeltas[i-1] 
:
+  // 0).
+  std::unique_ptr relocDeltas;
+  // For relocations[i], the actual type is relocTypes[i].
+  std::unique_ptr relocTypes;
+  SmallVector writes;
+};
+
 RISCV::RISCV() {
   copyRel = R_RISCV_COPY;
   pltRel = R_RISCV_JUMP_SLOT;
@@ -119,6 +141,7 @@ RISCV::RISCV() {
 tlsGotRel = R_RISCV_TLS_TPREL32;
   }
   gotRel = symbolicRel;
+  tlsDescRel = R_RISCV_TLSDESC;
 
   // .got[0] = _DYNAMIC
   gotHeaderEntriesNum = 1;
@@ -187,6 +210,8 @@ int64_t RISCV::getImplicitAddend(const uint8_t *buf, 
RelType type) const {
   case R_RISCV_JUMP_SLOT:
 // These relocations are defined as not having an implicit addend.
 return 0;
+  case R_RISCV_TLSDESC:
+return config->is64 ? read64le(buf + 8) : read32le(buf + 4);
   }
 }
 
@@ -295,6 +320,12 @@ RelExpr RISCV::getRelExpr(const RelType type, const Symbol 
&s,
   case R_RISCV_PCREL_LO12_I:
   case R_RISCV_PCREL_LO12_S:
 return R_RISCV_PC_INDIRECT;
+  case R_RISCV_TLSDESC_HI20:
+  case R_RISCV_TLSDESC_LOAD_LO12:
+  case R_RISCV_TLSDESC_ADD_LO12:
+return R_TLSDESC_PC;
+  case R_RISCV_TLSDESC_CALL:
+return R_TLSDESC_CALL;
   case R_RISCV_TLS_GD_HI20:
 return R_TLSGD_PC;
   case R_RISCV_TLS_GOT_HI20:
@@ -419,6 +450,7 @@ void RISCV::relocate(uint8_t *loc, const Relocation &rel, 
uint64_t val) const {
 
   case R_RISCV_GOT_HI20:
   case R_RISCV_PCREL_HI20:
+  case R_RISCV_TLSDESC_HI20:
   case R_RISCV_TLS_GD_HI20:
   case R_RISCV_TLS_GOT_HI20:
   case R_RISCV_TPREL_HI20:
@@ -430,6 +462,8 @@ void RISCV::relocate(uint8_t *loc, const Relocation &rel, 
uint64_t val) const {
   }
 
   case R_RISCV_PCREL_LO12_I:
+  case R_RISCV_TLSDESC_LOAD_LO12:
+  case R_RISCV_TLSDESC_ADD_LO12:
   case R_RISCV_TPREL_LO12_I:
   case R_RISCV_LO12_I: {
 uint64_t hi = (val + 0x800) >> 12;
@@ -513,29 +547,113 @@ void RISCV::relocate(uint8_t *loc, const Relocation 
&rel, uint64_t val) const {
 break;
 
   case R_RISCV_RELAX:
-return; // Ignored (for now)
-
+return;
+  case R_RISCV_TLSDESC:
+// The addend is stored in the second word.
+if (config->is64)
+  write64le(loc + 8, val);
+else
+  write32le(loc + 4, val);
+break;
   default:
 llvm_unreachable("unknown relocation");
   }
 }
 
+static void tlsdescToIe(uint8_t *loc, const Relocation &rel, uint64_t val) {
+  switch (rel.type) {
+  case R_RISCV_TLSDESC_HI20:
+  case R_RISCV_TLSDESC_LOAD_LO12:
+write32le(loc, 0x0013); // nop
+return;
+  case R_RISCV_TLSDESC_ADD_LO12:
+write32le(loc, utype(AUIPC, X_A0, hi20(val))); // auipc a0,
+return;
+  case R_RISCV_TLSDESC_CALL:
+if (config->is64)
+  write32le(loc, itype(LD, X_A0, X_A0, lo12(val))); // ld a0,(a0)
+else
+  write32le(loc, itype(LW, X_A0, X_A0, lo12(val))); // lw a0,(a0)
+return;
+  default:
+llvm_unreachable("unsupported relocation for TLSDESC to IE relaxation");
+  }
+}
+
+static void tlsdescToLe(uint8_t *loc, const Relocation &rel, uint64_t val) {
+  switch (rel.type) {
+  case R_RISCV_TLSDESC_HI20:
+  case R_RISCV_TLSDESC_LOAD_LO12:
+write32le(loc, 0x0013); // nop
+return;
+  case R_RISCV_TLSDESC_ADD_L

[Lldb-commits] [flang] [libunwind] [llvm] [clang] [lldb] [libc] [clang-tools-extra] [compiler-rt] [libcxx] [lld] [ELF] Implement R_RISCV_TLSDESC for RISC-V (PR #79239)

2024-01-24 Thread Fangrui Song via lldb-commits


@@ -0,0 +1,125 @@
+# REQUIRES: riscv
+# RUN: rm -rf %t && split-file %s %t && cd %t
+# RUN: llvm-mc -filetype=obj -triple=riscv64 -mattr=+c,+relax a.s -o a.64.o
+# RUN: llvm-mc -filetype=obj -triple=riscv64 -mattr=+c,+relax c.s -o c.64.o
+# RUN: ld.lld -shared -soname=c.64.so c.64.o -o c.64.so
+
+# RUN: ld.lld -shared -z now a.64.o c.64.o -o a.64.so -z separate-code
+# RUN: llvm-objdump --no-show-raw-insn -M no-aliases -h -d a.64.so | FileCheck 
%s --check-prefix=GD64
+
+# RUN: ld.lld -e 0 -z now a.64.o c.64.o -o a.64.le -z separate-code
+# RUN: llvm-objdump --no-show-raw-insn -M no-aliases -h -d a.64.le | FileCheck 
%s --check-prefix=LE64
+
+# RUN: ld.lld -e 0 -z now a.64.o c.64.so -o a.64.ie -z separate-code
+# RUN: llvm-objdump --no-show-raw-insn -M no-aliases -h -d a.64.ie | FileCheck 
%s --check-prefix=IE64
+
+# GD64:  .got 0018 20c0
+# GD64-LABEL: <_start>:
+# GD64-NEXT: jal {{.*}} 
+# GD64-LABEL: :
+## &.got[c]-. = 0x20c0+8 - 0x1004 = 0x10c4
+# GD64:1004: auipc   a2, 0x1
+# GD64-NEXT: ld  a3, 0xc4(a2)
+# GD64-NEXT: addia0, a2, 0xc4
+# GD64-NEXT: jalrt0, 0x0(a3)
+# GD64-NEXT: c.add   a0, tp
+# GD64-NEXT: jal {{.*}} 
+# GD64-NEXT: auipc   a4, 0x1
+# GD64-NEXT: ld  a5, 0xae(a4)
+# GD64-NEXT: addia0, a4, 0xae
+# GD64-NEXT: jalrt0, 0x0(a5)
+# GD64-NEXT: c.add   a0, tp
+
+# LE64-LABEL: <_start>:
+# LE64-NEXT: jal {{.*}} 
+# LE64-LABEL: :
+# LE64-NEXT:  11004: lui a0, 0x0
+# LE64-NEXT: addia0, zero, 0xc
+# LE64-NEXT: c.add   a0, tp
+# LE64-NEXT: jal {{.*}} 
+# LE64-NEXT: addizero, zero, 0x0
+# LE64-NEXT: lui a0, 0x0
+# LE64-NEXT: addia0, zero, 0xc
+# LE64-NEXT: c.add   a0, tp
+# LE64-NEXT: addizero, zero, 0x0
+# LE64-NEXT: lui a0, 0x0
+# LE64-NEXT: addia0, zero, 0xc
+# LE64-NEXT: c.add   a0, tp
+
+# IE64:   .got 0010 000120e0
+# IE64-LABEL: <_start>:
+# IE64-NEXT: jal {{.*}} 
+# IE64-LABEL: :
+## &.got[c]-. = 0x120e0+8 - 0x11004 = 0x10e4
+# IE64-NEXT:  11004: auipc   a0, 0x1
+# IE64-NEXT: ld  a0, 0xe4(a0)
+# IE64-NEXT: c.add   a0, tp
+# IE64-NEXT: jal {{.*}} 
+# IE64-NEXT: addizero, zero, 0x0
+## &.got[c]-. = 0x120e0+8 - 0x11016 = 0x10d2
+# IE64-NEXT:  11016: auipc   a0, 0x1
+# IE64-NEXT: ld  a0, 0xd2(a0)
+# IE64-NEXT: c.add   a0, tp
+# IE64-NEXT: addizero, zero, 0x0
+## &.got[c]-. = 0x120e0+8 - 0x11024 = 0x10c4
+# IE64-NEXT:  11024: auipc   a0, 0x1
+# IE64-NEXT: ld  a0, 0xc4(a0)
+# IE64-NEXT: c.add   a0, tp
+
+#--- a.s
+.globl _start
+_start:
+.balign 16
+  call foo
+
+foo:
+.Ltlsdesc_hi0:
+.option norelax
+## All 4 instructions have an R_RISCV_RELAX.
+  auipc a2, %tlsdesc_hi(c)
+  .reloc .-4, R_RISCV_RELAX, 0
+  lda3, %tlsdesc_load_lo(.Ltlsdesc_hi0)(a2)
+  .reloc .-4, R_RISCV_RELAX, 0
+  addi  a0, a2, %tlsdesc_add_lo(.Ltlsdesc_hi0)
+  .reloc .-4, R_RISCV_RELAX, 0
+  jalr  t0, 0(a3), %tlsdesc_call(.Ltlsdesc_hi0)
+  .reloc .-4, R_RISCV_RELAX, 0
+  add   a0, a0, tp

MaskRay wrote:

Thanks for noticing this. `i386-tlsdesc-gd.s` has `movl %edx, %ebx  # GCC -O0 
may add an extra insn in between.` that I forgot to copy here. Done.

This requires the following code to handle it.
```
+  // For HI20/LOAD_LO12, disable NOP conversion in the presence of
+  // R_RISCV_RELAX, in case an unrelated instruction follows the current
+  // instruction.
+  if ((rel.type == R_RISCV_TLSDESC_HI20 ||
+   rel.type == R_RISCV_TLSDESC_LOAD_LO12) &&
+  i + 1 != relocs.size() && relocs[i + 1].type == R_RISCV_RELAX)
+continue;
```

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


[Lldb-commits] [flang] [libunwind] [llvm] [clang] [lldb] [libc] [clang-tools-extra] [compiler-rt] [libcxx] [lld] [ELF] Implement R_RISCV_TLSDESC for RISC-V (PR #79239)

2024-01-24 Thread Fangrui Song via lldb-commits

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


[Lldb-commits] [flang] [libunwind] [llvm] [clang] [lld] [lldb] [libc] [clang-tools-extra] [compiler-rt] [libcxx] [X86] Use RORX over SHR imm (PR #77964)

2024-01-24 Thread Bryce Wilson via lldb-commits

https://github.com/Bryce-MW updated 
https://github.com/llvm/llvm-project/pull/77964

>From d4c312b9dbf447d0a53dda0e6cdc482bd908430b Mon Sep 17 00:00:00 2001
From: Bryce Wilson 
Date: Fri, 12 Jan 2024 16:01:32 -0600
Subject: [PATCH 01/14] [X86] Use RORX over SHR imm

---
 llvm/lib/Target/X86/X86InstrShiftRotate.td |  78 ++
 llvm/test/CodeGen/X86/atomic-unordered.ll  |   3 +-
 llvm/test/CodeGen/X86/bmi2.ll  |   6 +-
 llvm/test/CodeGen/X86/cmp-shiftX-maskX.ll  |   3 +-
 llvm/test/CodeGen/X86/pr35636.ll   |   4 +-
 llvm/test/CodeGen/X86/vector-trunc-ssat.ll | 116 ++---
 6 files changed, 143 insertions(+), 67 deletions(-)

diff --git a/llvm/lib/Target/X86/X86InstrShiftRotate.td 
b/llvm/lib/Target/X86/X86InstrShiftRotate.td
index f951894db1890cd..238e8e9b6e97f30 100644
--- a/llvm/lib/Target/X86/X86InstrShiftRotate.td
+++ b/llvm/lib/Target/X86/X86InstrShiftRotate.td
@@ -879,6 +879,26 @@ let Predicates = [HasBMI2, HasEGPR, In64BitMode] in {
   defm SHLX64 : bmi_shift<"shlx{q}", GR64, i64mem, "_EVEX">, T8, PD, REX_W, 
EVEX;
 }
 
+
+def immle16_8 : ImmLeaf;
+def immle32_8 : ImmLeaf;
+def immle64_8 : ImmLeaf;
+def immle32_16 : ImmLeaf;
+def immle64_16 : ImmLeaf;
+def immle64_32 : ImmLeaf;
+
 let Predicates = [HasBMI2] in {
   // Prefer RORX which is non-destructive and doesn't update EFLAGS.
   let AddedComplexity = 10 in {
@@ -891,6 +911,64 @@ let Predicates = [HasBMI2] in {
   (RORX32ri GR32:$src, (ROT32L2R_imm8 imm:$shamt))>;
 def : Pat<(rotl GR64:$src, (i8 imm:$shamt)),
   (RORX64ri GR64:$src, (ROT64L2R_imm8 imm:$shamt))>;
+
+// A right shift by less than a smaller register size that is then
+// truncated to that register size can be replaced by RORX to
+// preserve flags with the same execution cost
+
+def : Pat<(i8 (trunc (srl GR16:$src, (i8 immle16_8:$shamt,
+  (EXTRACT_SUBREG (RORX32ri (INSERT_SUBREG (i32 (IMPLICIT_DEF)), 
GR16:$src, sub_16bit), imm:$shamt), sub_8bit)>;
+def : Pat<(i8 (trunc (sra GR16:$src, (i8 immle16_8:$shamt,
+  (EXTRACT_SUBREG (RORX32ri (INSERT_SUBREG (i32 (IMPLICIT_DEF)), 
GR16:$src, sub_16bit), imm:$shamt), sub_8bit)>;
+def : Pat<(i8 (trunc (srl GR32:$src, (i8 immle32_8:$shamt,
+  (EXTRACT_SUBREG (RORX32ri GR32:$src, imm:$shamt), sub_8bit)>;
+def : Pat<(i8 (trunc (sra GR32:$src, (i8 immle32_8:$shamt,
+  (EXTRACT_SUBREG (RORX32ri GR32:$src, imm:$shamt), sub_8bit)>;
+def : Pat<(i8 (trunc (srl GR64:$src, (i8 immle64_8:$shamt,
+  (EXTRACT_SUBREG (RORX64ri GR64:$src, imm:$shamt), sub_8bit)>;
+def : Pat<(i8 (trunc (sra GR64:$src, (i8 immle64_8:$shamt,
+  (EXTRACT_SUBREG (RORX64ri GR64:$src, imm:$shamt), sub_8bit)>;
+
+
+def : Pat<(i16 (trunc (srl GR32:$src, (i8 immle32_16:$shamt,
+  (EXTRACT_SUBREG (RORX32ri GR32:$src, imm:$shamt), sub_16bit)>;
+def : Pat<(i16 (trunc (sra GR32:$src, (i8 immle32_16:$shamt,
+  (EXTRACT_SUBREG (RORX32ri GR32:$src, imm:$shamt), sub_16bit)>;
+def : Pat<(i16 (trunc (srl GR64:$src, (i8 immle64_16:$shamt,
+  (EXTRACT_SUBREG (RORX64ri GR64:$src, imm:$shamt), sub_16bit)>;
+def : Pat<(i16 (trunc (sra GR64:$src, (i8 immle64_16:$shamt,
+  (EXTRACT_SUBREG (RORX64ri GR64:$src, imm:$shamt), sub_16bit)>;
+
+def : Pat<(i32 (trunc (srl GR64:$src, (i8 immle64_32:$shamt,
+  (EXTRACT_SUBREG (RORX64ri GR64:$src, imm:$shamt), sub_32bit)>;
+def : Pat<(i32 (trunc (sra GR64:$src, (i8 immle64_32:$shamt,
+  (EXTRACT_SUBREG (RORX64ri GR64:$src, imm:$shamt), sub_32bit)>;
+
+
+// Can't expand the load
+def : Pat<(i8 (trunc (srl (loadi32 addr:$src), (i8 immle32_8:$shamt,
+  (EXTRACT_SUBREG (RORX32mi addr:$src, imm:$shamt), sub_8bit)>;
+def : Pat<(i8 (trunc (sra (loadi32 addr:$src), (i8 immle32_8:$shamt,
+  (EXTRACT_SUBREG (RORX32mi addr:$src, imm:$shamt), sub_8bit)>;
+def : Pat<(i8 (trunc (srl (loadi64 addr:$src), (i8 immle64_8:$shamt,
+  (EXTRACT_SUBREG (RORX64mi addr:$src, imm:$shamt), sub_8bit)>;
+def : Pat<(i8 (trunc (sra (loadi64 addr:$src), (i8 immle64_8:$shamt,
+  (EXTRACT_SUBREG (RORX64mi addr:$src, imm:$shamt), sub_8bit)>;
+
+
+def : Pat<(i16 (trunc (srl (loadi32 addr:$src), (i8 immle32_16:$shamt,
+  (EXTRACT_SUBREG (RORX32mi addr:$src, imm:$shamt), sub_16bit)>;
+def : Pat<(i16 (trunc (sra (loadi32 addr:$src), (i8 immle32_16:$shamt,
+  (EXTRACT_SUBREG (RORX32mi addr:$src, imm:$shamt), sub_16bit)>;
+def : Pat<(i16 (trunc (srl (loadi64 addr:$src), (i8 immle64_16:$shamt,
+  (EXTRACT_SUBREG (RORX64mi addr:$src, imm:$shamt), sub_16bit)>;
+def : Pat<(i16 (trunc (sra (loadi64 addr:$src), (i8 immle64_16:$shamt,
+  (EXTRACT_SUBREG (RORX64mi addr:$src, imm:$shamt), sub_16bit)>;
+
+def : Pat<(i32 (trunc (

[Lldb-commits] [libunwind] [llvm] [libc] [flang] [clang-tools-extra] [clang] [libcxx] [lld] [compiler-rt] [lldb] [ELF] Implement R_RISCV_TLSDESC for RISC-V (PR #79239)

2024-01-24 Thread Paul Kirth via lldb-commits

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

LGTM on my end. Thanks for all the help on this.

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


[Lldb-commits] [lldb] [libcxx] [libc] [clang] [clang-tools-extra] [libunwind] [compiler-rt] [lld] [flang] [llvm] Reland: [libc++][format] P2637R3: Member visit (std::basic_format_arg) #76449 (PR #7903

2024-01-24 Thread Hristo Hristov via lldb-commits

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

>From e03452fda84a5284420bba1913299b68caabb6cd Mon Sep 17 00:00:00 2001
From: Zingam 
Date: Mon, 22 Jan 2024 20:35:00 +0200
Subject: [PATCH 1/2] Revert "Revert "[libc++][format] P2637R3: Member `visit`
 (`std::basic_format_arg`) (#76449)""

This reverts commit 02f95b77515fe18ed1076b94cbb850ea0cf3c77e.
---
 libcxx/docs/ReleaseNotes/18.rst   |   1 +
 libcxx/docs/Status/Cxx2cPapers.csv|   2 +-
 libcxx/docs/Status/FormatIssues.csv   |   2 +-
 libcxx/include/__config   |   6 +
 libcxx/include/__format/format_arg.h  | 109 +-
 libcxx/include/__format/format_context.h  |  33 +-
 libcxx/include/format |   2 +-
 .../format.arg/visit.pass.cpp | 333 
 .../format.arg/visit.return_type.pass.cpp | 369 ++
 .../visit_format_arg.deprecated.verify.cpp|  38 ++
 .../format.arg/visit_format_arg.pass.cpp  |   6 +-
 .../format.arguments/format.args/get.pass.cpp |  48 ++-
 libcxx/test/support/test_basic_format_arg.h   |  20 +-
 libcxx/test/support/test_macros.h |   5 +
 .../generate_feature_test_macro_components.py |   1 +
 15 files changed, 927 insertions(+), 48 deletions(-)
 create mode 100644 
libcxx/test/std/utilities/format/format.arguments/format.arg/visit.pass.cpp
 create mode 100644 
libcxx/test/std/utilities/format/format.arguments/format.arg/visit.return_type.pass.cpp
 create mode 100644 
libcxx/test/std/utilities/format/format.arguments/format.arg/visit_format_arg.deprecated.verify.cpp

diff --git a/libcxx/docs/ReleaseNotes/18.rst b/libcxx/docs/ReleaseNotes/18.rst
index fd882bafe19a517..237a63022d55ff5 100644
--- a/libcxx/docs/ReleaseNotes/18.rst
+++ b/libcxx/docs/ReleaseNotes/18.rst
@@ -79,6 +79,7 @@ Implemented Papers
 - P1759R6 - Native handles and file streams
 - P2868R3 - Remove Deprecated ``std::allocator`` Typedef From C++26
 - P2517R1 - Add a conditional ``noexcept`` specification to ``std::apply``
+- P2637R3 - Member ``visit``
 - P2447R6 - ``span`` over initializer list
 
 
diff --git a/libcxx/docs/Status/Cxx2cPapers.csv 
b/libcxx/docs/Status/Cxx2cPapers.csv
index f80b1f6b663f045..c45aa3c510072e4 100644
--- a/libcxx/docs/Status/Cxx2cPapers.csv
+++ b/libcxx/docs/Status/Cxx2cPapers.csv
@@ -17,7 +17,7 @@
 "`P0792R14 `__","LWG","``function_ref``: a 
type-erased callable reference","Varna June 2023","","",""
 "`P2874R2 `__","LWG","Mandating Annex D Require No 
More","Varna June 2023","","",""
 "`P2757R3 `__","LWG","Type-checking format 
args","Varna June 2023","","","|format|"
-"`P2637R3 `__","LWG","Member ``visit``","Varna June 
2023","|Partial|","18.0",""
+"`P2637R3 `__","LWG","Member ``visit``","Varna June 
2023","|Complete|","18.0",""
 "`P2641R4 `__","CWG, LWG","Checking if a ``union`` 
alternative is active","Varna June 2023","","",""
 "`P1759R6 `__","LWG","Native handles and file 
streams","Varna June 2023","|Complete|","18.0",""
 "`P2697R1 `__","LWG","Interfacing ``bitset`` with 
``string_view``","Varna June 2023","|Complete|","18.0",""
diff --git a/libcxx/docs/Status/FormatIssues.csv 
b/libcxx/docs/Status/FormatIssues.csv
index 513988d08036ca6..6e58e752191ea5d 100644
--- a/libcxx/docs/Status/FormatIssues.csv
+++ b/libcxx/docs/Status/FormatIssues.csv
@@ -16,7 +16,7 @@ Number,Name,Standard,Assignee,Status,First released version
 "`P2693R1 `__","Formatting ``thread::id`` and 
``stacktrace``","C++23","Mark de Wever","|In Progress|"
 "`P2510R3 `__","Formatting pointers","C++26","Mark 
de Wever","|Complete|",17.0
 "`P2757R3 `__","Type-checking format 
args","C++26","","",
-"`P2637R3 `__","Member ``visit``","C++26","","",
+"`P2637R3 `__","Member ``visit``","C++26","Hristo 
Hristov","|Complete|",18.0
 "`P2905R2 `__","Runtime format strings","C++26 
DR","Mark de Wever","|Complete|",18.0
 "`P2918R2 `__","Runtime format strings 
II","C++26","Mark de Wever","|Complete|",18.0
 "`P2909R4 `__","Fix formatting of code units as 
integers (Dude, where’s my ``char``?)","C++26 DR","Mark de 
Wever","|Complete|",18.0
diff --git a/libcxx/include/__config b/libcxx/include/__config
index 9a64cdb489119d9..00489d971c296c2 100644
--- a/libcxx/include/__config
+++ b/libcxx/include/__config
@@ -995,6 +995,12 @@ typedef __char32_t char32_t;
 #define _LIBCPP_DEPRECATED_IN_CXX23
 #  endif
 
+#  if _LIBCPP_STD_VER >= 26
+#define _LIBCPP_DEPRECATED_IN_CXX26 _LIBCPP_DEPRECATED
+#  else
+#define _LIBCPP_DEPRECATED_IN_CXX26
+#  endif
+
 #  if !defined(_LIBCPP_

[Lldb-commits] [lldb] [libcxx] [libc] [clang] [clang-tools-extra] [libunwind] [compiler-rt] [lld] [flang] [llvm] Reland: [libc++][format] P2637R3: Member visit (std::basic_format_arg) #76449 (PR #7903

2024-01-24 Thread Hristo Hristov via lldb-commits

H-G-Hristov wrote:

I noticed some of clang-cl test crashed. I rebased again.

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


[Lldb-commits] [lldb] [flang] [libc] [clang] [lld] [clang-tools-extra] [libcxx] [compiler-rt] [libunwind] [llvm] [mlir] [ELF] Implement R_RISCV_TLSDESC for RISC-V (PR #79239)

2024-01-24 Thread Fangrui Song via lldb-commits

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

>From 3725fa4eac3d3d946289d7eb7213f3a1751a2770 Mon Sep 17 00:00:00 2001
From: Fangrui Song 
Date: Tue, 23 Jan 2024 17:58:07 -0800
Subject: [PATCH] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20initia?=
 =?UTF-8?q?l=20version?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Created using spr 1.3.4
---
 lld/ELF/Arch/RISCV.cpp| 158 +
 lld/ELF/Relocations.cpp   |  25 ++--
 lld/test/ELF/riscv-tlsdesc-gd-mixed.s |  26 
 lld/test/ELF/riscv-tlsdesc-relax.s| 125 +
 lld/test/ELF/riscv-tlsdesc.s  | 192 ++
 5 files changed, 492 insertions(+), 34 deletions(-)
 create mode 100644 lld/test/ELF/riscv-tlsdesc-gd-mixed.s
 create mode 100644 lld/test/ELF/riscv-tlsdesc-relax.s
 create mode 100644 lld/test/ELF/riscv-tlsdesc.s

diff --git a/lld/ELF/Arch/RISCV.cpp b/lld/ELF/Arch/RISCV.cpp
index d7d3d3e47814971..67d7e2562e9b178 100644
--- a/lld/ELF/Arch/RISCV.cpp
+++ b/lld/ELF/Arch/RISCV.cpp
@@ -61,6 +61,7 @@ enum Op {
   AUIPC = 0x17,
   JALR = 0x67,
   LD = 0x3003,
+  LUI = 0x37,
   LW = 0x2003,
   SRLI = 0x5013,
   SUB = 0x4033,
@@ -73,6 +74,7 @@ enum Reg {
   X_T0 = 5,
   X_T1 = 6,
   X_T2 = 7,
+  X_A0 = 10,
   X_T3 = 28,
 };
 
@@ -102,6 +104,26 @@ static uint32_t setLO12_S(uint32_t insn, uint32_t imm) {
  (extractBits(imm, 4, 0) << 7);
 }
 
+namespace {
+struct SymbolAnchor {
+  uint64_t offset;
+  Defined *d;
+  bool end; // true for the anchor of st_value+st_size
+};
+} // namespace
+
+struct elf::RISCVRelaxAux {
+  // This records symbol start and end offsets which will be adjusted according
+  // to the nearest relocDeltas element.
+  SmallVector anchors;
+  // For relocations[i], the actual offset is r_offset - (i ? relocDeltas[i-1] 
:
+  // 0).
+  std::unique_ptr relocDeltas;
+  // For relocations[i], the actual type is relocTypes[i].
+  std::unique_ptr relocTypes;
+  SmallVector writes;
+};
+
 RISCV::RISCV() {
   copyRel = R_RISCV_COPY;
   pltRel = R_RISCV_JUMP_SLOT;
@@ -119,6 +141,7 @@ RISCV::RISCV() {
 tlsGotRel = R_RISCV_TLS_TPREL32;
   }
   gotRel = symbolicRel;
+  tlsDescRel = R_RISCV_TLSDESC;
 
   // .got[0] = _DYNAMIC
   gotHeaderEntriesNum = 1;
@@ -187,6 +210,8 @@ int64_t RISCV::getImplicitAddend(const uint8_t *buf, 
RelType type) const {
   case R_RISCV_JUMP_SLOT:
 // These relocations are defined as not having an implicit addend.
 return 0;
+  case R_RISCV_TLSDESC:
+return config->is64 ? read64le(buf + 8) : read32le(buf + 4);
   }
 }
 
@@ -295,6 +320,12 @@ RelExpr RISCV::getRelExpr(const RelType type, const Symbol 
&s,
   case R_RISCV_PCREL_LO12_I:
   case R_RISCV_PCREL_LO12_S:
 return R_RISCV_PC_INDIRECT;
+  case R_RISCV_TLSDESC_HI20:
+  case R_RISCV_TLSDESC_LOAD_LO12:
+  case R_RISCV_TLSDESC_ADD_LO12:
+return R_TLSDESC_PC;
+  case R_RISCV_TLSDESC_CALL:
+return R_TLSDESC_CALL;
   case R_RISCV_TLS_GD_HI20:
 return R_TLSGD_PC;
   case R_RISCV_TLS_GOT_HI20:
@@ -419,6 +450,7 @@ void RISCV::relocate(uint8_t *loc, const Relocation &rel, 
uint64_t val) const {
 
   case R_RISCV_GOT_HI20:
   case R_RISCV_PCREL_HI20:
+  case R_RISCV_TLSDESC_HI20:
   case R_RISCV_TLS_GD_HI20:
   case R_RISCV_TLS_GOT_HI20:
   case R_RISCV_TPREL_HI20:
@@ -430,6 +462,8 @@ void RISCV::relocate(uint8_t *loc, const Relocation &rel, 
uint64_t val) const {
   }
 
   case R_RISCV_PCREL_LO12_I:
+  case R_RISCV_TLSDESC_LOAD_LO12:
+  case R_RISCV_TLSDESC_ADD_LO12:
   case R_RISCV_TPREL_LO12_I:
   case R_RISCV_LO12_I: {
 uint64_t hi = (val + 0x800) >> 12;
@@ -513,29 +547,113 @@ void RISCV::relocate(uint8_t *loc, const Relocation 
&rel, uint64_t val) const {
 break;
 
   case R_RISCV_RELAX:
-return; // Ignored (for now)
-
+return;
+  case R_RISCV_TLSDESC:
+// The addend is stored in the second word.
+if (config->is64)
+  write64le(loc + 8, val);
+else
+  write32le(loc + 4, val);
+break;
   default:
 llvm_unreachable("unknown relocation");
   }
 }
 
+static void tlsdescToIe(uint8_t *loc, const Relocation &rel, uint64_t val) {
+  switch (rel.type) {
+  case R_RISCV_TLSDESC_HI20:
+  case R_RISCV_TLSDESC_LOAD_LO12:
+write32le(loc, 0x0013); // nop
+return;
+  case R_RISCV_TLSDESC_ADD_LO12:
+write32le(loc, utype(AUIPC, X_A0, hi20(val))); // auipc a0,
+return;
+  case R_RISCV_TLSDESC_CALL:
+if (config->is64)
+  write32le(loc, itype(LD, X_A0, X_A0, lo12(val))); // ld a0,(a0)
+else
+  write32le(loc, itype(LW, X_A0, X_A0, lo12(val))); // lw a0,(a0)
+return;
+  default:
+llvm_unreachable("unsupported relocation for TLSDESC to IE relaxation");
+  }
+}
+
+static void tlsdescToLe(uint8_t *loc, const Relocation &rel, uint64_t val) {
+  switch (rel.type) {
+  case R_RISCV_TLSDESC_HI20:
+  case R_RISCV_TLSDESC_LOAD_LO12:
+write32le(loc, 0x0013); // nop
+return;
+  case R_RISCV_TLSDESC_ADD

[Lldb-commits] [libc] [lldb] [libunwind] [clang] [compiler-rt] [mlir] [llvm] [lld] [flang] [libcxx] [clang-tools-extra] [ELF] Implement R_RISCV_TLSDESC for RISC-V (PR #79239)

2024-01-24 Thread Fangrui Song via lldb-commits

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


[Lldb-commits] [libc] [lldb] [libunwind] [clang] [compiler-rt] [mlir] [llvm] [lld] [flang] [libcxx] [clang-tools-extra] [ELF] Implement R_RISCV_TLSDESC for RISC-V (PR #79239)

2024-01-24 Thread Fangrui Song via lldb-commits


@@ -513,29 +547,113 @@ void RISCV::relocate(uint8_t *loc, const Relocation 
&rel, uint64_t val) const {
 break;
 
   case R_RISCV_RELAX:
-return; // Ignored (for now)
-
+return;
+  case R_RISCV_TLSDESC:
+// The addend is stored in the second word.
+if (config->is64)
+  write64le(loc + 8, val);
+else
+  write32le(loc + 4, val);
+break;
   default:
 llvm_unreachable("unknown relocation");
   }
 }
 
+static void tlsdescToIe(uint8_t *loc, const Relocation &rel, uint64_t val) {
+  switch (rel.type) {
+  case R_RISCV_TLSDESC_HI20:
+  case R_RISCV_TLSDESC_LOAD_LO12:
+write32le(loc, 0x0013); // nop
+return;
+  case R_RISCV_TLSDESC_ADD_LO12:
+write32le(loc, utype(AUIPC, X_A0, hi20(val))); // auipc a0,
+return;
+  case R_RISCV_TLSDESC_CALL:
+if (config->is64)
+  write32le(loc, itype(LD, X_A0, X_A0, lo12(val))); // ld a0,(a0)
+else
+  write32le(loc, itype(LW, X_A0, X_A0, lo12(val))); // lw a0,(a0)
+return;
+  default:
+llvm_unreachable("unsupported relocation for TLSDESC to IE relaxation");
+  }
+}
+
+static void tlsdescToLe(uint8_t *loc, const Relocation &rel, uint64_t val) {

MaskRay wrote:

Thanks for catching this. Implemented the short form.

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


[Lldb-commits] [mlir] [libunwind] [lld] [flang] [clang-tools-extra] [libc] [libcxx] [llvm] [clang] [compiler-rt] [lldb] [Driver, CodeGen] Support -mtls-dialect= (PR #79256)

2024-01-24 Thread Fangrui Song via lldb-commits

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

>From be08e64c2c1f433b017185ce78525ad097e609be Mon Sep 17 00:00:00 2001
From: Fangrui Song 
Date: Tue, 23 Jan 2024 21:37:04 -0800
Subject: [PATCH 1/2] =?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
---
 clang/include/clang/Basic/CodeGenOptions.def |  3 +++
 clang/include/clang/Driver/Options.td|  5 +
 clang/lib/CodeGen/BackendUtil.cpp|  1 +
 clang/lib/Driver/ToolChains/Clang.cpp| 23 
 clang/test/CodeGen/RISCV/tls-dialect.c   | 13 +++
 clang/test/Driver/tls-dialect.c  | 19 
 6 files changed, 64 insertions(+)
 create mode 100644 clang/test/CodeGen/RISCV/tls-dialect.c
 create mode 100644 clang/test/Driver/tls-dialect.c

diff --git a/clang/include/clang/Basic/CodeGenOptions.def 
b/clang/include/clang/Basic/CodeGenOptions.def
index 2f2e45d5cf63df..7c0bfe32849614 100644
--- a/clang/include/clang/Basic/CodeGenOptions.def
+++ b/clang/include/clang/Basic/CodeGenOptions.def
@@ -369,6 +369,9 @@ ENUM_CODEGENOPT(VecLib, llvm::driver::VectorLibrary, 3, 
llvm::driver::VectorLibr
 /// The default TLS model to use.
 ENUM_CODEGENOPT(DefaultTLSModel, TLSModel, 2, GeneralDynamicTLSModel)
 
+/// Whether to enable TLSDESC. AArch64 enables TLSDESC regardless of this 
value.
+CODEGENOPT(EnableTLSDESC, 1, 0)
+
 /// Bit size of immediate TLS offsets (0 == use the default).
 VALUE_CODEGENOPT(TLSSize, 8, 0)
 
diff --git a/clang/include/clang/Driver/Options.td 
b/clang/include/clang/Driver/Options.td
index 7f4fa33748faca..773bc1dcda01d5 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -4419,6 +4419,8 @@ def mtls_size_EQ : Joined<["-"], "mtls-size=">, 
Group,
   HelpText<"Specify bit size of immediate TLS offsets (AArch64 ELF only): "
"12 (for 4KB) | 24 (for 16MB, default) | 32 (for 4GB) | 48 (for 
256TB, needs -mcmodel=large)">,
   MarshallingInfoInt>;
+def mtls_dialect_EQ : Joined<["-"], "mtls-dialect=">, Group,
+  Flags<[TargetSpecific]>, HelpText<"Which thread-local storage dialect to use 
for dynamic accesses of TLS variables">;
 def mimplicit_it_EQ : Joined<["-"], "mimplicit-it=">, Group;
 def mdefault_build_attributes : Joined<["-"], "mdefault-build-attributes">, 
Group;
 def mno_default_build_attributes : Joined<["-"], 
"mno-default-build-attributes">, Group;
@@ -7066,6 +7068,9 @@ def fexperimental_assignment_tracking_EQ : Joined<["-"], 
"fexperimental-assignme
   Values<"disabled,enabled,forced">, 
NormalizedValues<["Disabled","Enabled","Forced"]>,
   MarshallingInfoEnum, "Enabled">;
 
+def enable_tlsdesc : Flag<["-"], "enable-tlsdesc">,
+  MarshallingInfoFlag>;
+
 } // let Visibility = [CC1Option]
 
 
//===--===//
diff --git a/clang/lib/CodeGen/BackendUtil.cpp 
b/clang/lib/CodeGen/BackendUtil.cpp
index ec203f6f28bc17..7877e20d77f772 100644
--- a/clang/lib/CodeGen/BackendUtil.cpp
+++ b/clang/lib/CodeGen/BackendUtil.cpp
@@ -401,6 +401,7 @@ static bool initTargetOptions(DiagnosticsEngine &Diags,
   Options.UniqueBasicBlockSectionNames =
   CodeGenOpts.UniqueBasicBlockSectionNames;
   Options.TLSSize = CodeGenOpts.TLSSize;
+  Options.EnableTLSDESC = CodeGenOpts.EnableTLSDESC;
   Options.EmulatedTLS = CodeGenOpts.EmulatedTLS;
   Options.DebuggerTuning = CodeGenOpts.getDebuggerTuning();
   Options.EmitStackSizeSection = CodeGenOpts.StackSizeSection;
diff --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index 5dc614e11aab59..93fd579eb92ba5 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -5822,6 +5822,29 @@ void Clang::ConstructJob(Compilation &C, const JobAction 
&JA,
 Args.AddLastArg(CmdArgs, options::OPT_mtls_size_EQ);
   }
 
+  if (Arg *A = Args.getLastArg(options::OPT_mtls_dialect_EQ)) {
+StringRef V = A->getValue();
+bool SupportedArgument = false, EnableTLSDESC = false;
+bool Unsupported = !Triple.isOSBinFormatELF();
+if (Triple.isRISCV()) {
+  SupportedArgument = V == "desc" || V == "trad";
+  EnableTLSDESC = V == "desc";
+} else if (Triple.isX86()) {
+  SupportedArgument = V == "gnu";
+} else {
+  Unsupported = true;
+}
+if (Unsupported) {
+  D.Diag(diag::err_drv_unsupported_opt_for_target)
+  << A->getSpelling() << TripleStr;
+} else if (!SupportedArgument) {
+  D.Diag(diag::err_drv_unsupported_option_argument_for_target)
+  << A->getSpelling() << V << TripleStr;
+} else if (EnableTLSDESC) {
+  CmdArgs.push_back("-enable-tlsdesc");
+}
+  }
+
   // Add the target cpu
   std::string CPU = getCPUName(D, Args, Triple, /*FromAs*/ false);
   if (!CPU.empty()) {
diff --git a/clang/test/CodeGen/RISCV

[Lldb-commits] [mlir] [libunwind] [lld] [flang] [clang-tools-extra] [libc] [libcxx] [llvm] [clang] [compiler-rt] [lldb] [ELF] Implement R_RISCV_TLSDESC for RISC-V (PR #79239)

2024-01-24 Thread Fangrui Song via lldb-commits

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

>From 3725fa4eac3d3d946289d7eb7213f3a1751a2770 Mon Sep 17 00:00:00 2001
From: Fangrui Song 
Date: Tue, 23 Jan 2024 17:58:07 -0800
Subject: [PATCH] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20initia?=
 =?UTF-8?q?l=20version?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Created using spr 1.3.4
---
 lld/ELF/Arch/RISCV.cpp| 158 +
 lld/ELF/Relocations.cpp   |  25 ++--
 lld/test/ELF/riscv-tlsdesc-gd-mixed.s |  26 
 lld/test/ELF/riscv-tlsdesc-relax.s| 125 +
 lld/test/ELF/riscv-tlsdesc.s  | 192 ++
 5 files changed, 492 insertions(+), 34 deletions(-)
 create mode 100644 lld/test/ELF/riscv-tlsdesc-gd-mixed.s
 create mode 100644 lld/test/ELF/riscv-tlsdesc-relax.s
 create mode 100644 lld/test/ELF/riscv-tlsdesc.s

diff --git a/lld/ELF/Arch/RISCV.cpp b/lld/ELF/Arch/RISCV.cpp
index d7d3d3e47814971..67d7e2562e9b178 100644
--- a/lld/ELF/Arch/RISCV.cpp
+++ b/lld/ELF/Arch/RISCV.cpp
@@ -61,6 +61,7 @@ enum Op {
   AUIPC = 0x17,
   JALR = 0x67,
   LD = 0x3003,
+  LUI = 0x37,
   LW = 0x2003,
   SRLI = 0x5013,
   SUB = 0x4033,
@@ -73,6 +74,7 @@ enum Reg {
   X_T0 = 5,
   X_T1 = 6,
   X_T2 = 7,
+  X_A0 = 10,
   X_T3 = 28,
 };
 
@@ -102,6 +104,26 @@ static uint32_t setLO12_S(uint32_t insn, uint32_t imm) {
  (extractBits(imm, 4, 0) << 7);
 }
 
+namespace {
+struct SymbolAnchor {
+  uint64_t offset;
+  Defined *d;
+  bool end; // true for the anchor of st_value+st_size
+};
+} // namespace
+
+struct elf::RISCVRelaxAux {
+  // This records symbol start and end offsets which will be adjusted according
+  // to the nearest relocDeltas element.
+  SmallVector anchors;
+  // For relocations[i], the actual offset is r_offset - (i ? relocDeltas[i-1] 
:
+  // 0).
+  std::unique_ptr relocDeltas;
+  // For relocations[i], the actual type is relocTypes[i].
+  std::unique_ptr relocTypes;
+  SmallVector writes;
+};
+
 RISCV::RISCV() {
   copyRel = R_RISCV_COPY;
   pltRel = R_RISCV_JUMP_SLOT;
@@ -119,6 +141,7 @@ RISCV::RISCV() {
 tlsGotRel = R_RISCV_TLS_TPREL32;
   }
   gotRel = symbolicRel;
+  tlsDescRel = R_RISCV_TLSDESC;
 
   // .got[0] = _DYNAMIC
   gotHeaderEntriesNum = 1;
@@ -187,6 +210,8 @@ int64_t RISCV::getImplicitAddend(const uint8_t *buf, 
RelType type) const {
   case R_RISCV_JUMP_SLOT:
 // These relocations are defined as not having an implicit addend.
 return 0;
+  case R_RISCV_TLSDESC:
+return config->is64 ? read64le(buf + 8) : read32le(buf + 4);
   }
 }
 
@@ -295,6 +320,12 @@ RelExpr RISCV::getRelExpr(const RelType type, const Symbol 
&s,
   case R_RISCV_PCREL_LO12_I:
   case R_RISCV_PCREL_LO12_S:
 return R_RISCV_PC_INDIRECT;
+  case R_RISCV_TLSDESC_HI20:
+  case R_RISCV_TLSDESC_LOAD_LO12:
+  case R_RISCV_TLSDESC_ADD_LO12:
+return R_TLSDESC_PC;
+  case R_RISCV_TLSDESC_CALL:
+return R_TLSDESC_CALL;
   case R_RISCV_TLS_GD_HI20:
 return R_TLSGD_PC;
   case R_RISCV_TLS_GOT_HI20:
@@ -419,6 +450,7 @@ void RISCV::relocate(uint8_t *loc, const Relocation &rel, 
uint64_t val) const {
 
   case R_RISCV_GOT_HI20:
   case R_RISCV_PCREL_HI20:
+  case R_RISCV_TLSDESC_HI20:
   case R_RISCV_TLS_GD_HI20:
   case R_RISCV_TLS_GOT_HI20:
   case R_RISCV_TPREL_HI20:
@@ -430,6 +462,8 @@ void RISCV::relocate(uint8_t *loc, const Relocation &rel, 
uint64_t val) const {
   }
 
   case R_RISCV_PCREL_LO12_I:
+  case R_RISCV_TLSDESC_LOAD_LO12:
+  case R_RISCV_TLSDESC_ADD_LO12:
   case R_RISCV_TPREL_LO12_I:
   case R_RISCV_LO12_I: {
 uint64_t hi = (val + 0x800) >> 12;
@@ -513,29 +547,113 @@ void RISCV::relocate(uint8_t *loc, const Relocation 
&rel, uint64_t val) const {
 break;
 
   case R_RISCV_RELAX:
-return; // Ignored (for now)
-
+return;
+  case R_RISCV_TLSDESC:
+// The addend is stored in the second word.
+if (config->is64)
+  write64le(loc + 8, val);
+else
+  write32le(loc + 4, val);
+break;
   default:
 llvm_unreachable("unknown relocation");
   }
 }
 
+static void tlsdescToIe(uint8_t *loc, const Relocation &rel, uint64_t val) {
+  switch (rel.type) {
+  case R_RISCV_TLSDESC_HI20:
+  case R_RISCV_TLSDESC_LOAD_LO12:
+write32le(loc, 0x0013); // nop
+return;
+  case R_RISCV_TLSDESC_ADD_LO12:
+write32le(loc, utype(AUIPC, X_A0, hi20(val))); // auipc a0,
+return;
+  case R_RISCV_TLSDESC_CALL:
+if (config->is64)
+  write32le(loc, itype(LD, X_A0, X_A0, lo12(val))); // ld a0,(a0)
+else
+  write32le(loc, itype(LW, X_A0, X_A0, lo12(val))); // lw a0,(a0)
+return;
+  default:
+llvm_unreachable("unsupported relocation for TLSDESC to IE relaxation");
+  }
+}
+
+static void tlsdescToLe(uint8_t *loc, const Relocation &rel, uint64_t val) {
+  switch (rel.type) {
+  case R_RISCV_TLSDESC_HI20:
+  case R_RISCV_TLSDESC_LOAD_LO12:
+write32le(loc, 0x0013); // nop
+return;
+  case R_RISCV_TLSDESC_ADD

[Lldb-commits] [mlir] [libunwind] [lld] [flang] [clang-tools-extra] [libc] [libcxx] [llvm] [clang] [compiler-rt] [lldb] [ELF] Implement R_RISCV_TLSDESC for RISC-V (PR #79239)

2024-01-24 Thread Fangrui Song via lldb-commits

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


[Lldb-commits] [llvm] [flang] [clang] [lld] [libc] [libcxx] [lldb] [clang-tools-extra] [compiler-rt] [libunwind] Reland: [libc++][format] P2637R3: Member visit (std::basic_format_arg) #76449 (PR #7903

2024-01-24 Thread Hristo Hristov via lldb-commits

https://github.com/H-G-Hristov commented:

@mordante I guess the PR missed LLVM18 release. I'll update the release notes 
accordingly. Is that OK?

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


[Lldb-commits] [clang-tools-extra] [flang] [compiler-rt] [lldb] [libc] [clang] [libcxx] [libunwind] [llvm] [lld] Reland: [libc++][format] P2637R3: Member visit (std::basic_format_arg) #76449 (PR #7903

2024-01-24 Thread Hristo Hristov via lldb-commits

https://github.com/H-G-Hristov edited 
https://github.com/llvm/llvm-project/pull/79032
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [llvm] [libunwind] [clang] [lld] [clang-tools-extra] [flang] [lldb] [libcxx] [libc] [compiler-rt] Reland: [libc++][format] P2637R3: Member visit (std::basic_format_arg) #76449 (PR #7903

2024-01-24 Thread Hristo Hristov via lldb-commits


@@ -79,6 +79,7 @@ Implemented Papers
 - P1759R6 - Native handles and file streams
 - P2868R3 - Remove Deprecated ``std::allocator`` Typedef From C++26
 - P2517R1 - Add a conditional ``noexcept`` specification to ``std::apply``
+- P2637R3 - Member ``visit``
 - P2447R6 - ``span`` over initializer list

H-G-Hristov wrote:

```suggestion
- P2517R1 - Add a conditional ``noexcept`` specification to ``std::apply``
- P2447R6 - ``span`` over initializer list
```

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


[Lldb-commits] [clang] [libc] [lld] [lldb] [libunwind] [libcxx] [compiler-rt] [llvm] [clang-tools-extra] [flang] Reland: [libc++][format] P2637R3: Member visit (std::basic_format_arg) #76449 (PR #7903

2024-01-24 Thread Hristo Hristov via lldb-commits


@@ -16,7 +16,7 @@ Number,Name,Standard,Assignee,Status,First released version
 "`P2693R1 `__","Formatting ``thread::id`` and 
``stacktrace``","C++23","Mark de Wever","|In Progress|"
 "`P2510R3 `__","Formatting pointers","C++26","Mark 
de Wever","|Complete|",17.0
 "`P2757R3 `__","Type-checking format 
args","C++26","","",
-"`P2637R3 `__","Member ``visit``","C++26","","",
+"`P2637R3 `__","Member ``visit``","C++26","Hristo 
Hristov","|Complete|",18.0

H-G-Hristov wrote:

```suggestion
"`P2637R3 `__","Member ``visit``","C++26","Hristo 
Hristov","|Complete|",19.0
```

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


[Lldb-commits] [libc] [compiler-rt] [libunwind] [flang] [lldb] [libcxx] [lld] [clang] [llvm] [clang-tools-extra] Reland: [libc++][format] P2637R3: Member visit (std::basic_format_arg) #76449 (PR #7903

2024-01-24 Thread Hristo Hristov via lldb-commits


@@ -17,7 +17,7 @@
 "`P0792R14 `__","LWG","``function_ref``: a 
type-erased callable reference","Varna June 2023","","",""
 "`P2874R2 `__","LWG","Mandating Annex D Require No 
More","Varna June 2023","","",""
 "`P2757R3 `__","LWG","Type-checking format 
args","Varna June 2023","","","|format|"
-"`P2637R3 `__","LWG","Member ``visit``","Varna June 
2023","|Partial|","18.0",""
+"`P2637R3 `__","LWG","Member ``visit``","Varna June 
2023","|Complete|","18.0",""

H-G-Hristov wrote:

```suggestion
"`P2637R3 `__","LWG","Member ``visit``","Varna June 
2023","|Complete|","19.0",""
```

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


  1   2   >