[llvm-branch-commits] [clang] release/18.x: Reland "[clang-repl] Keep the first llvm::Module empty to avoid invalid memory access. (#89031)" (PR #90544)
vgvassilev wrote: Ok, maybe we could move forward? https://github.com/llvm/llvm-project/pull/90544 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [flang] [Flang][OpenMP][MLIR] Initial derived type member map support (PR #82853)
https://github.com/agozillon updated https://github.com/llvm/llvm-project/pull/82853 >From 21b05eee943e4f1ad20fcd8f30bd14a0a3317db6 Mon Sep 17 00:00:00 2001 From: Andrew Gozillon Date: Fri, 15 Mar 2024 14:13:30 -0500 Subject: [PATCH] update with minor tidying up Created using spr 1.3.4 --- flang/lib/Lower/OpenMP/Utils.cpp | 2 +- flang/lib/Lower/OpenMP/Utils.h| 2 -- flang/lib/Optimizer/Transforms/CMakeLists.txt | 2 +- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/flang/lib/Lower/OpenMP/Utils.cpp b/flang/lib/Lower/OpenMP/Utils.cpp index 60aea9f5b70aba..18728e2c4c1b06 100644 --- a/flang/lib/Lower/OpenMP/Utils.cpp +++ b/flang/lib/Lower/OpenMP/Utils.cpp @@ -13,7 +13,6 @@ #include "Utils.h" #include "Clauses.h" -#include #include #include #include @@ -22,6 +21,7 @@ #include #include +#include #include llvm::cl::opt treatIndexAsSection( diff --git a/flang/lib/Lower/OpenMP/Utils.h b/flang/lib/Lower/OpenMP/Utils.h index f45e4490c2abe7..942dd4c12d87b6 100644 --- a/flang/lib/Lower/OpenMP/Utils.h +++ b/flang/lib/Lower/OpenMP/Utils.h @@ -14,7 +14,6 @@ #include "mlir/IR/Location.h" #include "mlir/IR/Value.h" #include "llvm/Support/CommandLine.h" -#include extern llvm::cl::opt treatIndexAsSection; extern llvm::cl::opt enableDelayedPrivatization; @@ -36,7 +35,6 @@ class Symbol; namespace parser { struct OmpObject; struct OmpObjectList; -struct Designator; } // namespace parser namespace lower { diff --git a/flang/lib/Optimizer/Transforms/CMakeLists.txt b/flang/lib/Optimizer/Transforms/CMakeLists.txt index ce5ce3ed1bc48d..63fbe2a0658d83 100644 --- a/flang/lib/Optimizer/Transforms/CMakeLists.txt +++ b/flang/lib/Optimizer/Transforms/CMakeLists.txt @@ -17,8 +17,8 @@ add_flang_library(FIRTransforms AddDebugFoundation.cpp PolymorphicOpConversion.cpp LoopVersioning.cpp - OMPMapInfoFinalization.cpp OMPFunctionFiltering.cpp + OMPMapInfoFinalization.cpp OMPMarkDeclareTarget.cpp VScaleAttr.cpp FunctionAttr.cpp ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [flang] [Flang][OpenMP][MLIR] Initial derived type member map support (PR #82853)
https://github.com/agozillon updated https://github.com/llvm/llvm-project/pull/82853 >From 21b05eee943e4f1ad20fcd8f30bd14a0a3317db6 Mon Sep 17 00:00:00 2001 From: Andrew Gozillon Date: Fri, 15 Mar 2024 14:13:30 -0500 Subject: [PATCH] update with minor tidying up Created using spr 1.3.4 --- flang/lib/Lower/OpenMP/Utils.cpp | 2 +- flang/lib/Lower/OpenMP/Utils.h| 2 -- flang/lib/Optimizer/Transforms/CMakeLists.txt | 2 +- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/flang/lib/Lower/OpenMP/Utils.cpp b/flang/lib/Lower/OpenMP/Utils.cpp index 60aea9f5b70aba..18728e2c4c1b06 100644 --- a/flang/lib/Lower/OpenMP/Utils.cpp +++ b/flang/lib/Lower/OpenMP/Utils.cpp @@ -13,7 +13,6 @@ #include "Utils.h" #include "Clauses.h" -#include #include #include #include @@ -22,6 +21,7 @@ #include #include +#include #include llvm::cl::opt treatIndexAsSection( diff --git a/flang/lib/Lower/OpenMP/Utils.h b/flang/lib/Lower/OpenMP/Utils.h index f45e4490c2abe7..942dd4c12d87b6 100644 --- a/flang/lib/Lower/OpenMP/Utils.h +++ b/flang/lib/Lower/OpenMP/Utils.h @@ -14,7 +14,6 @@ #include "mlir/IR/Location.h" #include "mlir/IR/Value.h" #include "llvm/Support/CommandLine.h" -#include extern llvm::cl::opt treatIndexAsSection; extern llvm::cl::opt enableDelayedPrivatization; @@ -36,7 +35,6 @@ class Symbol; namespace parser { struct OmpObject; struct OmpObjectList; -struct Designator; } // namespace parser namespace lower { diff --git a/flang/lib/Optimizer/Transforms/CMakeLists.txt b/flang/lib/Optimizer/Transforms/CMakeLists.txt index ce5ce3ed1bc48d..63fbe2a0658d83 100644 --- a/flang/lib/Optimizer/Transforms/CMakeLists.txt +++ b/flang/lib/Optimizer/Transforms/CMakeLists.txt @@ -17,8 +17,8 @@ add_flang_library(FIRTransforms AddDebugFoundation.cpp PolymorphicOpConversion.cpp LoopVersioning.cpp - OMPMapInfoFinalization.cpp OMPFunctionFiltering.cpp + OMPMapInfoFinalization.cpp OMPMarkDeclareTarget.cpp VScaleAttr.cpp FunctionAttr.cpp ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [OpenMP][MLIR] Extend record member map support for omp dialect to LLVM-IR (PR #82852)
https://github.com/agozillon updated https://github.com/llvm/llvm-project/pull/82852 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [OpenMP][MLIR] Extend record member map support for omp dialect to LLVM-IR (PR #82852)
https://github.com/agozillon updated https://github.com/llvm/llvm-project/pull/82852 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [OpenMP][MLIR] Add new arguments to map_info to help support record type maps (PR #82851)
https://github.com/agozillon updated https://github.com/llvm/llvm-project/pull/82851 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [OpenMP][MLIR] Add new arguments to map_info to help support record type maps (PR #82851)
https://github.com/agozillon updated https://github.com/llvm/llvm-project/pull/82851 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] release/18.x: [DAGCombiner] In mergeTruncStore, make sure we aren't storing shifted in bits. (#90939) (PR #91038)
https://github.com/AtariDreams created https://github.com/llvm/llvm-project/pull/91038 When looking through a right shift, we need to make sure that all of the bits we are using from the shift come from the shift input and not the sign or zero bits that are shifted in. Fixes #90936. (cherry picked from commit 3563af6c06ebc92bcaacef0e33285148ef0f75bd) >From 9212565cd56b6524f05a05bcafb43b458cb82900 Mon Sep 17 00:00:00 2001 From: Craig Topper Date: Fri, 3 May 2024 09:59:33 -0700 Subject: [PATCH] [DAGCombiner] In mergeTruncStore, make sure we aren't storing shifted in bits. (#90939) When looking through a right shift, we need to make sure that all of the bits we are using from the shift come from the shift input and not the sign or zero bits that are shifted in. Fixes #90936. (cherry picked from commit 3563af6c06ebc92bcaacef0e33285148ef0f75bd) --- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 4 llvm/test/CodeGen/AArch64/pr90936.ll | 20 +++ 2 files changed, 24 insertions(+) create mode 100644 llvm/test/CodeGen/AArch64/pr90936.ll diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index 5038f8a1fc1562..4951e45edb9ed7 100644 --- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -8952,6 +8952,10 @@ SDValue DAGCombiner::mergeTruncStores(StoreSDNode *N) { if (ShiftAmtC % NarrowNumBits != 0) return SDValue(); + // Make sure we aren't reading bits that are shifted in. + if (ShiftAmtC > WideVal.getScalarValueSizeInBits() - NarrowNumBits) +return SDValue(); + Offset = ShiftAmtC / NarrowNumBits; WideVal = WideVal.getOperand(0); } diff --git a/llvm/test/CodeGen/AArch64/pr90936.ll b/llvm/test/CodeGen/AArch64/pr90936.ll new file mode 100644 index 00..38cda8d388945f --- /dev/null +++ b/llvm/test/CodeGen/AArch64/pr90936.ll @@ -0,0 +1,20 @@ +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 4 +; RUN: llc < %s -mtriple=aarch64 | FileCheck %s + +define void @f(i16 %arg, ptr %arg1) { +; CHECK-LABEL: f: +; CHECK: // %bb.0: +; CHECK-NEXT:ubfx w8, w0, #8, #6 +; CHECK-NEXT:strb w0, [x1] +; CHECK-NEXT:strb w8, [x1, #1] +; CHECK-NEXT:ret +bb: + %i = trunc i16 %arg to i8 + %i2 = trunc i16 %arg to i14 + %i3 = lshr i14 %i2, 8 + store i8 %i, ptr %arg1, align 1 + %i4 = getelementptr i8, ptr %arg1, i64 1 + %i5 = trunc i14 %i3 to i8 + store i8 %i5, ptr %i4, align 1 + ret void +} ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] 8c55eb8 - Update ParseOpenMP.cpp
Author: jyu2-git Date: 2024-05-03T18:34:25-07:00 New Revision: 8c55eb84e362659ff94315eca096387c53a781c2 URL: https://github.com/llvm/llvm-project/commit/8c55eb84e362659ff94315eca096387c53a781c2 DIFF: https://github.com/llvm/llvm-project/commit/8c55eb84e362659ff94315eca096387c53a781c2.diff LOG: Update ParseOpenMP.cpp Format. Added: Modified: clang/lib/Parse/ParseOpenMP.cpp Removed: diff --git a/clang/lib/Parse/ParseOpenMP.cpp b/clang/lib/Parse/ParseOpenMP.cpp index 8a85e7582fb522..5265d8f1922c31 100644 --- a/clang/lib/Parse/ParseOpenMP.cpp +++ b/clang/lib/Parse/ParseOpenMP.cpp @@ -4323,7 +4323,7 @@ static OpenMPMapClauseKind isMapType(Parser ) { if (!Tok.isOneOf(tok::identifier, tok::kw_delete)) return OMPC_MAP_unknown; Preprocessor = P.getPreprocessor(); - unsigned MapType = + unsigned MapType = getOpenMPSimpleClauseType(OMPC_map, PP.getSpelling(Tok), P.getLangOpts()); if (MapType == OMPC_MAP_to || MapType == OMPC_MAP_from || MapType == OMPC_MAP_tofrom || MapType == OMPC_MAP_alloc || ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] ebb6ac3 - Update ParseOpenMP.cpp
Author: jyu2-git Date: 2024-05-03T18:20:24-07:00 New Revision: ebb6ac3dc1cc5f4e604ec3c7e68821432856920f URL: https://github.com/llvm/llvm-project/commit/ebb6ac3dc1cc5f4e604ec3c7e68821432856920f DIFF: https://github.com/llvm/llvm-project/commit/ebb6ac3dc1cc5f4e604ec3c7e68821432856920f.diff LOG: Update ParseOpenMP.cpp Fix format. Added: Modified: clang/lib/Parse/ParseOpenMP.cpp Removed: diff --git a/clang/lib/Parse/ParseOpenMP.cpp b/clang/lib/Parse/ParseOpenMP.cpp index bb1cbcc23318b7..8a85e7582fb522 100644 --- a/clang/lib/Parse/ParseOpenMP.cpp +++ b/clang/lib/Parse/ParseOpenMP.cpp @@ -4323,8 +4323,8 @@ static OpenMPMapClauseKind isMapType(Parser ) { if (!Tok.isOneOf(tok::identifier, tok::kw_delete)) return OMPC_MAP_unknown; Preprocessor = P.getPreprocessor(); - unsigned MapType = getOpenMPSimpleClauseType( - OMPC_map, PP.getSpelling(Tok), P.getLangOpts()); + unsigned MapType = + getOpenMPSimpleClauseType(OMPC_map, PP.getSpelling(Tok), P.getLangOpts()); if (MapType == OMPC_MAP_to || MapType == OMPC_MAP_from || MapType == OMPC_MAP_tofrom || MapType == OMPC_MAP_alloc || MapType == OMPC_MAP_delete || MapType == OMPC_MAP_release) ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] release/18.x: [SelectionDAG] Mark frame index as "aliased" at argument copy elison (PR #91035)
https://github.com/AtariDreams edited https://github.com/llvm/llvm-project/pull/91035 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] ae7c7fd - Update ParseOpenMP.cpp
Author: jyu2-git Date: 2024-05-03T17:51:42-07:00 New Revision: ae7c7fd37eed7ff76ffddd778685450f084f3162 URL: https://github.com/llvm/llvm-project/commit/ae7c7fd37eed7ff76ffddd778685450f084f3162 DIFF: https://github.com/llvm/llvm-project/commit/ae7c7fd37eed7ff76ffddd778685450f084f3162.diff LOG: Update ParseOpenMP.cpp Move static_cast when return MapType. Added: Modified: clang/lib/Parse/ParseOpenMP.cpp Removed: diff --git a/clang/lib/Parse/ParseOpenMP.cpp b/clang/lib/Parse/ParseOpenMP.cpp index b1cff11af590a5..bb1cbcc23318b7 100644 --- a/clang/lib/Parse/ParseOpenMP.cpp +++ b/clang/lib/Parse/ParseOpenMP.cpp @@ -4323,13 +4323,12 @@ static OpenMPMapClauseKind isMapType(Parser ) { if (!Tok.isOneOf(tok::identifier, tok::kw_delete)) return OMPC_MAP_unknown; Preprocessor = P.getPreprocessor(); - OpenMPMapClauseKind MapType = - static_cast(getOpenMPSimpleClauseType( - OMPC_map, PP.getSpelling(Tok), P.getLangOpts())); + unsigned MapType = getOpenMPSimpleClauseType( + OMPC_map, PP.getSpelling(Tok), P.getLangOpts()); if (MapType == OMPC_MAP_to || MapType == OMPC_MAP_from || MapType == OMPC_MAP_tofrom || MapType == OMPC_MAP_alloc || MapType == OMPC_MAP_delete || MapType == OMPC_MAP_release) -return MapType; +return static_cast(MapType); return OMPC_MAP_unknown; } ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [SelectionDAG] Mark frame index as "aliased" at argument copy elison (PR #91035)
https://github.com/AtariDreams created https://github.com/llvm/llvm-project/pull/91035 This is a fix for miscompiles reported in https://github.com/llvm/llvm-project/issues/89060 After argument copy elison the IR value for the eliminated alloca is aliasing with the fixed stack object. This patch is making sure that we mark the fixed stack object as being aliased with IR values to avoid that for example schedulers are reordering accesses to the fixed stack object. This could otherwise happen when there is a mix of MemOperands referring the shared fixed stack slow via both the IR value for the elided alloca, and via a fixed stack pseudo source value (as would be the case when lowering the arguments). (cherry picked from commit d8b253be56b3e9073b3e59123cf2da0bcde20c63) >From ba75cd14f4ccd9bcc9e067bd9e5ecd6239c89641 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Pettersson?= Date: Tue, 23 Apr 2024 13:49:18 +0200 Subject: [PATCH] [SelectionDAG] Mark frame index as "aliased" at argument copy elison (#89712) This is a fix for miscompiles reported in https://github.com/llvm/llvm-project/issues/89060 After argument copy elison the IR value for the eliminated alloca is aliasing with the fixed stack object. This patch is making sure that we mark the fixed stack object as being aliased with IR values to avoid that for example schedulers are reordering accesses to the fixed stack object. This could otherwise happen when there is a mix of MemOperands refering the shared fixed stack slow via both the IR value for the elided alloca, and via a fixed stack pseudo source value (as would be the case when lowering the arguments). (cherry picked from commit d8b253be56b3e9073b3e59123cf2da0bcde20c63) --- llvm/include/llvm/CodeGen/MachineFrameInfo.h | 7 .../SelectionDAG/SelectionDAGBuilder.cpp | 3 +- llvm/test/CodeGen/Hexagon/arg-copy-elison.ll | 39 +++ 3 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 llvm/test/CodeGen/Hexagon/arg-copy-elison.ll diff --git a/llvm/include/llvm/CodeGen/MachineFrameInfo.h b/llvm/include/llvm/CodeGen/MachineFrameInfo.h index 7d11d63d4066f4..c35faac09c4d93 100644 --- a/llvm/include/llvm/CodeGen/MachineFrameInfo.h +++ b/llvm/include/llvm/CodeGen/MachineFrameInfo.h @@ -697,6 +697,13 @@ class MachineFrameInfo { return Objects[ObjectIdx+NumFixedObjects].isAliased; } + /// Set "maybe pointed to by an LLVM IR value" for an object. + void setIsAliasedObjectIndex(int ObjectIdx, bool IsAliased) { +assert(unsigned(ObjectIdx+NumFixedObjects) < Objects.size() && + "Invalid Object Idx!"); +Objects[ObjectIdx+NumFixedObjects].isAliased = IsAliased; + } + /// Returns true if the specified index corresponds to an immutable object. bool isImmutableObjectIndex(int ObjectIdx) const { // Tail calling functions can clobber their function arguments. diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp index 5ce1013f30fd1b..7406a8ac1611de 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp @@ -10888,7 +10888,7 @@ static void tryToElideArgumentCopy( } // Perform the elision. Delete the old stack object and replace its only use - // in the variable info map. Mark the stack object as mutable. + // in the variable info map. Mark the stack object as mutable and aliased. LLVM_DEBUG({ dbgs() << "Eliding argument copy from " << Arg << " to " << *AI << '\n' << " Replacing frame index " << OldIndex << " with " << FixedIndex @@ -10896,6 +10896,7 @@ static void tryToElideArgumentCopy( }); MFI.RemoveStackObject(OldIndex); MFI.setIsImmutableObjectIndex(FixedIndex, false); + MFI.setIsAliasedObjectIndex(FixedIndex, true); AllocaIndex = FixedIndex; ArgCopyElisionFrameIndexMap.insert({OldIndex, FixedIndex}); for (SDValue ArgVal : ArgVals) diff --git a/llvm/test/CodeGen/Hexagon/arg-copy-elison.ll b/llvm/test/CodeGen/Hexagon/arg-copy-elison.ll new file mode 100644 index 00..f0c30c301f446f --- /dev/null +++ b/llvm/test/CodeGen/Hexagon/arg-copy-elison.ll @@ -0,0 +1,39 @@ +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 4 +; RUN: llc -mtriple hexagon-- -o - %s | FileCheck %s + +; Reproducer for https://github.com/llvm/llvm-project/issues/89060 +; +; Problem was a bug in argument copy elison. Given that the %alloca is +; eliminated, the same frame index will be used for accessing %alloca and %a +; on the fixed stack. Care must be taken when setting up +; MachinePointerInfo/MemOperands for those accesses to either make sure that +; we always refer to the fixed stack slot the same way (not using the +; ir.alloca name), or make sure that we still detect that they alias each +; other if using different kinds of MemOperands to identify the same fixed +; stack entry. +;
[llvm-branch-commits] [llvm] release/18.x: [AMDGPU] Fix GFX12 encoding of s_wait_event export_ready (#89622) (PR #91034)
https://github.com/AtariDreams edited https://github.com/llvm/llvm-project/pull/91034 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [AMDGPU] Fix GFX12 encoding of s_wait_event export_ready (#89622) (PR #91034)
https://github.com/AtariDreams created https://github.com/llvm/llvm-project/pull/91034 As well as flipping the sense of the bit, GFX12 moved it from bit 0 to bit 1 in the encoded simm16 operand. (cherry picked from commit e0a763c490d8ef58dca867e0ef834978ccf8e17d) >From aae41bf27fb055cfe9ac8e5a003a4d1ef255aa8f Mon Sep 17 00:00:00 2001 From: Jay Foad Date: Tue, 23 Apr 2024 14:38:45 +0100 Subject: [PATCH] [AMDGPU] Fix GFX12 encoding of s_wait_event export_ready (#89622) As well as flipping the sense of the bit, GFX12 moved it from bit 0 to bit 1 in the encoded simm16 operand. (cherry picked from commit e0a763c490d8ef58dca867e0ef834978ccf8e17d) --- llvm/lib/Target/AMDGPU/SOPInstructions.td| 2 +- llvm/test/CodeGen/AMDGPU/llvm.amdgcn.s.wait.event.ll | 10 +++--- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/llvm/lib/Target/AMDGPU/SOPInstructions.td b/llvm/lib/Target/AMDGPU/SOPInstructions.td index ae5ef0541929b7..5762efde73f02a 100644 --- a/llvm/lib/Target/AMDGPU/SOPInstructions.td +++ b/llvm/lib/Target/AMDGPU/SOPInstructions.td @@ -1786,7 +1786,7 @@ def : GCNPat< let SubtargetPredicate = isNotGFX12Plus in def : GCNPat <(int_amdgcn_s_wait_event_export_ready), (S_WAIT_EVENT (i16 0))>; let SubtargetPredicate = isGFX12Plus in - def : GCNPat <(int_amdgcn_s_wait_event_export_ready), (S_WAIT_EVENT (i16 1))>; + def : GCNPat <(int_amdgcn_s_wait_event_export_ready), (S_WAIT_EVENT (i16 2))>; // The first 10 bits of the mode register are the core FP mode on all // subtargets. diff --git a/llvm/test/CodeGen/AMDGPU/llvm.amdgcn.s.wait.event.ll b/llvm/test/CodeGen/AMDGPU/llvm.amdgcn.s.wait.event.ll index 08c77148f6ae13..433fefa4349889 100644 --- a/llvm/test/CodeGen/AMDGPU/llvm.amdgcn.s.wait.event.ll +++ b/llvm/test/CodeGen/AMDGPU/llvm.amdgcn.s.wait.event.ll @@ -5,14 +5,10 @@ ; GCN-LABEL: {{^}}test_wait_event: ; GFX11: s_wait_event 0x0 -; GFX12: s_wait_event 0x1 +; GFX12: s_wait_event 0x2 -define amdgpu_ps void @test_wait_event() #0 { +define amdgpu_ps void @test_wait_event() { entry: - call void @llvm.amdgcn.s.wait.event.export.ready() #0 + call void @llvm.amdgcn.s.wait.event.export.ready() ret void } - -declare void @llvm.amdgcn.s.wait.event.export.ready() #0 - -attributes #0 = { nounwind } ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] release/18.x: Reland "[clang-repl] Keep the first llvm::Module empty to avoid invalid memory access. (#89031)" (PR #90544)
nikic wrote: @vgvassilev My bad, I completely missed that the changed header is in the lib/ directory, not in include/. https://github.com/llvm/llvm-project/pull/90544 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] [clang] CTAD alias: fix the transformation for the require-clause expr (PR #90961)
@@ -2744,31 +2744,155 @@ bool hasDeclaredDeductionGuides(DeclarationName Name, DeclContext *DC) { return false; } +unsigned getTemplateDepth(NamedDecl *TemplateParam) { + if (auto *TTP = dyn_cast(TemplateParam)) +return TTP->getDepth(); + if (auto *TTP = dyn_cast(TemplateParam)) +return TTP->getDepth(); + if (auto *NTTP = dyn_cast(TemplateParam)) +return NTTP->getDepth(); + llvm_unreachable("Unhandled template parameter types"); +} + NamedDecl *transformTemplateParameter(Sema , DeclContext *DC, NamedDecl *TemplateParam, MultiLevelTemplateArgumentList , - unsigned NewIndex) { + unsigned NewIndex, unsigned NewDepth) { if (auto *TTP = dyn_cast(TemplateParam)) -return transformTemplateTypeParam(SemaRef, DC, TTP, Args, TTP->getDepth(), +return transformTemplateTypeParam(SemaRef, DC, TTP, Args, NewDepth, NewIndex); if (auto *TTP = dyn_cast(TemplateParam)) return transformTemplateParam(SemaRef, DC, TTP, Args, NewIndex, - TTP->getDepth()); + NewDepth); if (auto *NTTP = dyn_cast(TemplateParam)) return transformTemplateParam(SemaRef, DC, NTTP, Args, NewIndex, - NTTP->getDepth()); + NewDepth); llvm_unreachable("Unhandled template parameter types"); } -Expr *transformRequireClause(Sema , FunctionTemplateDecl *FTD, - llvm::ArrayRef TransformedArgs) { - Expr *RC = FTD->getTemplateParameters()->getRequiresClause(); +// Transform the require-clause of F if any. +// The return result is expected to be the require-clause for the synthesized +// alias deduction guide. +Expr *transformRequireClause( +Sema , FunctionTemplateDecl *F, +TypeAliasTemplateDecl *AliasTemplate, +ArrayRef DeduceResults) { + Expr *RC = F->getTemplateParameters()->getRequiresClause(); if (!RC) return nullptr; + + auto = SemaRef.Context; + LocalInstantiationScope Scope(SemaRef); + + // In the clang AST, constraint nodes are not instantiated at all unless they + // are being evaluated. This means that occurrences of template parameters + // in the require-clause expr have subtle differences compared to occurrences + // in other places, such as function parameters. When transforming the + // require-clause, we must respect these differences, particularly regarding + // the 'depth' information: + // 1) In the transformed require-clause, occurrences of template parameters + // must use the "uninstantiated" depth; + // 2) When substituting on the require-clause expr of the underlying + // deduction guide, we must use the entire set of template argument lists. + // + // It's important to note that we're performing this transformation on an + // *instantiated* AliasTemplate. + + // For 1), if the alias template is nested within a class template, we + // calcualte the 'uninstantiated' depth by adding the substitution level back. + unsigned AdjustDepth = 0; + if (auto *PrimaryTemplate = AliasTemplate->getInstantiatedFromMemberTemplate()) zyn0217 wrote: Should it be a while loop? https://github.com/llvm/llvm-project/pull/90961 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] [clang] CTAD alias: fix the transformation for the require-clause expr (PR #90961)
@@ -2744,31 +2744,155 @@ bool hasDeclaredDeductionGuides(DeclarationName Name, DeclContext *DC) { return false; } +unsigned getTemplateDepth(NamedDecl *TemplateParam) { + if (auto *TTP = dyn_cast(TemplateParam)) +return TTP->getDepth(); + if (auto *TTP = dyn_cast(TemplateParam)) +return TTP->getDepth(); + if (auto *NTTP = dyn_cast(TemplateParam)) +return NTTP->getDepth(); + llvm_unreachable("Unhandled template parameter types"); +} + NamedDecl *transformTemplateParameter(Sema , DeclContext *DC, NamedDecl *TemplateParam, MultiLevelTemplateArgumentList , - unsigned NewIndex) { + unsigned NewIndex, unsigned NewDepth) { if (auto *TTP = dyn_cast(TemplateParam)) -return transformTemplateTypeParam(SemaRef, DC, TTP, Args, TTP->getDepth(), +return transformTemplateTypeParam(SemaRef, DC, TTP, Args, NewDepth, NewIndex); if (auto *TTP = dyn_cast(TemplateParam)) return transformTemplateParam(SemaRef, DC, TTP, Args, NewIndex, - TTP->getDepth()); + NewDepth); if (auto *NTTP = dyn_cast(TemplateParam)) return transformTemplateParam(SemaRef, DC, NTTP, Args, NewIndex, - NTTP->getDepth()); + NewDepth); llvm_unreachable("Unhandled template parameter types"); } -Expr *transformRequireClause(Sema , FunctionTemplateDecl *FTD, - llvm::ArrayRef TransformedArgs) { - Expr *RC = FTD->getTemplateParameters()->getRequiresClause(); +// Transform the require-clause of F if any. +// The return result is expected to be the require-clause for the synthesized +// alias deduction guide. +Expr *transformRequireClause( +Sema , FunctionTemplateDecl *F, +TypeAliasTemplateDecl *AliasTemplate, +ArrayRef DeduceResults) { + Expr *RC = F->getTemplateParameters()->getRequiresClause(); if (!RC) return nullptr; + + auto = SemaRef.Context; + LocalInstantiationScope Scope(SemaRef); + + // In the clang AST, constraint nodes are not instantiated at all unless they + // are being evaluated. This means that occurrences of template parameters + // in the require-clause expr have subtle differences compared to occurrences + // in other places, such as function parameters. When transforming the + // require-clause, we must respect these differences, particularly regarding + // the 'depth' information: + // 1) In the transformed require-clause, occurrences of template parameters + // must use the "uninstantiated" depth; + // 2) When substituting on the require-clause expr of the underlying + // deduction guide, we must use the entire set of template argument lists. + // + // It's important to note that we're performing this transformation on an + // *instantiated* AliasTemplate. + + // For 1), if the alias template is nested within a class template, we + // calcualte the 'uninstantiated' depth by adding the substitution level back. + unsigned AdjustDepth = 0; + if (auto *PrimaryTemplate = AliasTemplate->getInstantiatedFromMemberTemplate()) +AdjustDepth = PrimaryTemplate->getTemplateDepth(); + + // We rebuild all template parameters with the uninstantiated depth, and + // build template arguments refer to them. + SmallVector AdjustedAliasTemplateArgs; + + for (auto *TP : *AliasTemplate->getTemplateParameters()) { +// Rebuild any internal references to earlier parameters and reindex +// as we go. +MultiLevelTemplateArgumentList Args; +Args.setKind(TemplateSubstitutionKind::Rewrite); +Args.addOuterTemplateArguments(AdjustedAliasTemplateArgs); +NamedDecl *NewParam = transformTemplateParameter( +SemaRef, AliasTemplate->getDeclContext(), TP, Args, +/*NewIndex=*/AdjustedAliasTemplateArgs.size(), +getTemplateDepth(TP) + AdjustDepth); + +auto NewTemplateArgument = Context.getCanonicalTemplateArgument( +Context.getInjectedTemplateArg(NewParam)); +AdjustedAliasTemplateArgs.push_back(NewTemplateArgument); + } + // Template arguments used to transform the template arguments in + // DeducedResults. + SmallVector TemplateArgsForBuildingRC( + F->getTemplateParameters()->size()); + // Transform the transformed template args MultiLevelTemplateArgumentList Args; Args.setKind(TemplateSubstitutionKind::Rewrite); - Args.addOuterTemplateArguments(TransformedArgs); - ExprResult E = SemaRef.SubstExpr(RC, Args); + Args.addOuterTemplateArguments(AdjustedAliasTemplateArgs); + + for (unsigned Index = 0; Index < DeduceResults.size(); ++Index) { +const auto = DeduceResults[Index]; +if (D.isNull()) + continue; +TemplateArgumentLoc Input = +SemaRef.getTrivialTemplateArgumentLoc(D, QualType(),
[llvm-branch-commits] [BOLT][BAT] Fix translate for branches added by BOLT (PR #90811)
@@ -492,6 +486,10 @@ uint64_t BoltAddressTranslation::translate(uint64_t FuncAddress, const uint32_t Val = KeyVal->second >> 1; // dropping BRANCHENTRY bit if (IsBranchSrc) { +// Branch entry is found in BAT +if (KeyVal->first == Offset && KeyVal->second & BRANCHENTRY) maksfb wrote: What would be the case where we need to check for the second condition (`KeyVal->second & BRANCHENTRY`)? Can we drop it? https://github.com/llvm/llvm-project/pull/90811 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [BOLT][BAT] Fix translate for branches added by BOLT (PR #90811)
https://github.com/aaupov updated https://github.com/llvm/llvm-project/pull/90811 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [BOLT][BAT] Fix translate for branches added by BOLT (PR #90811)
https://github.com/aaupov updated https://github.com/llvm/llvm-project/pull/90811 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [BOLT][BAT] Fix translate for branches added by BOLT (PR #90811)
@@ -478,18 +478,34 @@ uint64_t BoltAddressTranslation::translate(uint64_t FuncAddress, return Offset; const MapTy = Iter->second; + if (IsBranchSrc) { +// Try exact lookup first +auto KeyVal = Map.find(Offset); +if (KeyVal != Map.end() && KeyVal->second & BRANCHENTRY) + return KeyVal->second >> 1; + } auto KeyVal = Map.upper_bound(Offset); if (KeyVal == Map.begin()) return Offset; --KeyVal; const uint32_t Val = KeyVal->second >> 1; // dropping BRANCHENTRY bit - // Branch source addresses are translated to the first instruction of the - // source BB to avoid accounting for modifications BOLT may have made in the - // BB regarding deletion/addition of instructions. - if (IsBranchSrc) -return Val; + if (IsBranchSrc) { aaupov wrote: Agree we can do an upper_bound followed by a comparison. https://github.com/llvm/llvm-project/pull/90811 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [BOLT][BAT] Fix translate for branches added by BOLT (PR #90811)
@@ -478,18 +478,34 @@ uint64_t BoltAddressTranslation::translate(uint64_t FuncAddress, return Offset; const MapTy = Iter->second; + if (IsBranchSrc) { +// Try exact lookup first +auto KeyVal = Map.find(Offset); +if (KeyVal != Map.end() && KeyVal->second & BRANCHENTRY) + return KeyVal->second >> 1; + } auto KeyVal = Map.upper_bound(Offset); if (KeyVal == Map.begin()) return Offset; --KeyVal; const uint32_t Val = KeyVal->second >> 1; // dropping BRANCHENTRY bit - // Branch source addresses are translated to the first instruction of the - // source BB to avoid accounting for modifications BOLT may have made in the - // BB regarding deletion/addition of instructions. - if (IsBranchSrc) -return Val; + if (IsBranchSrc) { aaupov wrote: No as we use `find` for exact match, and `upper_bound` for regular translation. https://github.com/llvm/llvm-project/pull/90811 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [BOLT][BAT] Fix translate for branches added by BOLT (PR #90811)
@@ -24,6 +24,32 @@ READ-BAT-CHECK-NOT: BOLT-ERROR: unable to save profile in YAML format for input READ-BAT-CHECK: BOLT-INFO: Parsed 5 BAT entries READ-BAT-CHECK: PERF2BOLT: read 79 aggregated LBR entries +# Check handling of a branch not in BAT (added by BOLT) +RUN: FileCheck --input-file %p/Inputs/blarge_new_bat.preagg.txt --check-prefix PREAGG-CHECK %s +# The branch +PREAGG-CHECK: B 80007b 80004c 483 1 +RUN: llvm-objdump %t.out -d --start-address=0x80007b --stop-address=0x80007d \ +RUN: | FileCheck %s --check-prefix OBJDUMP-CHECK +OBJDUMP-CHECK: jmp +# Confirming it's not in BAT +RUN: llvm-bat-dump %t.out --dump-all | FileCheck %s --check-prefix BAT-DUMP-CHECK +BAT-DUMP-CHECK: Function Address: 0x800040, hash: 0x99e67ed32a203023 +# Containing basic block +BAT-DUMP-CHECK: 0x34 -> 0x32 hash: 0x6c36179f229b0032 +# Branch entry just above +BAT-DUMP-CHECK-NEXT: 0x37 -> 0x35 (branch) +# No entry for that offset +BAT-DUMP-NOT: 0x3b -> aaupov wrote: Yes, it's a negative check that the branch is not in BAT. https://github.com/llvm/llvm-project/pull/90811 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [tsan] Don't crash on vscale (PR #91018)
https://github.com/vitalybuka updated https://github.com/llvm/llvm-project/pull/91018 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [tsan] Don't crash on vscale (PR #91018)
https://github.com/vitalybuka created https://github.com/llvm/llvm-project/pull/91018 None ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] [clang] CTAD alias: fix the transformation for the require-clause expr (PR #90961)
@@ -2744,31 +2744,155 @@ bool hasDeclaredDeductionGuides(DeclarationName Name, DeclContext *DC) { return false; } +unsigned getTemplateDepth(NamedDecl *TemplateParam) { mizvekov wrote: ```suggestion unsigned getTemplateParameterDepth(NamedDecl *TemplateParam) { ``` https://github.com/llvm/llvm-project/pull/90961 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [libcxx] [libc++][TZDB] Implements time_zone::to_local. (PR #91003)
https://github.com/mordante created https://github.com/llvm/llvm-project/pull/91003 Implements parts of: - P0355 Extending chrono to Calendars and Time Zones >From 5f205f7478a13a6f7034808dff390c3fe87564dc Mon Sep 17 00:00:00 2001 From: Mark de Wever Date: Wed, 17 Apr 2024 21:00:22 +0200 Subject: [PATCH] [libc++][TZDB] Implements time_zone::to_local. Implements parts of: - P0355 Extending chrono to Calendars and Time Zones --- libcxx/include/__chrono/time_zone.h | 18 + libcxx/include/chrono | 4 ++ .../assert.to_local.pass.cpp | 40 +++ .../time.zone.members/to_local.pass.cpp | 66 +++ 4 files changed, 128 insertions(+) create mode 100644 libcxx/test/libcxx/time/time.zone/time.zone.timezone/time.zone.members/assert.to_local.pass.cpp create mode 100644 libcxx/test/std/time/time.zone/time.zone.timezone/time.zone.members/to_local.pass.cpp diff --git a/libcxx/include/__chrono/time_zone.h b/libcxx/include/__chrono/time_zone.h index a18c5d5295b7d6..620d880299635c 100644 --- a/libcxx/include/__chrono/time_zone.h +++ b/libcxx/include/__chrono/time_zone.h @@ -128,6 +128,24 @@ class _LIBCPP_AVAILABILITY_TZDB time_zone { return {}; } + template + [[nodiscard]] _LIBCPP_HIDE_FROM_ABI local_time> + to_local(const sys_time<_Duration>& __time) const { +using _Dp = common_type_t<_Duration, seconds>; + +sys_info __info = get_info(__time); + +_LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN( +__info.offset >= chrono::seconds{0} || __time.time_since_epoch() >= _Dp::min() - __info.offset, +"cannot convert the system time; it would be before the minimum local clock value"); + +_LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN( +__info.offset <= chrono::seconds{0} || __time.time_since_epoch() <= _Dp::max() - __info.offset, +"cannot convert the system time; it would be after the maximum local clock value"); + +return local_time<_Dp>{__time.time_since_epoch() + __info.offset}; + } + [[nodiscard]] _LIBCPP_HIDE_FROM_ABI const __impl& __implementation() const noexcept { return *__impl_; } private: diff --git a/libcxx/include/chrono b/libcxx/include/chrono index c70b241f086464..d6b889cdde73c4 100644 --- a/libcxx/include/chrono +++ b/libcxx/include/chrono @@ -778,6 +778,10 @@ class time_zone { template sys_time> to_sys(const local_time& tp, choose z) const; + + template + local_time> +to_local(const sys_time& tp) const; }; bool operator==(const time_zone& x, const time_zone& y) noexcept; // C++20 strong_ordering operator<=>(const time_zone& x, const time_zone& y) noexcept; // C++20 diff --git a/libcxx/test/libcxx/time/time.zone/time.zone.timezone/time.zone.members/assert.to_local.pass.cpp b/libcxx/test/libcxx/time/time.zone/time.zone.timezone/time.zone.members/assert.to_local.pass.cpp new file mode 100644 index 00..d9ca1c80751cce --- /dev/null +++ b/libcxx/test/libcxx/time/time.zone/time.zone.timezone/time.zone.members/assert.to_local.pass.cpp @@ -0,0 +1,40 @@ +//===--===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===--===// + +// UNSUPPORTED: c++03, c++11, c++14, c++17 + +// REQUIRES: has-unix-headers +// REQUIRES: libcpp-hardening-mode={{extensive|debug}} +// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing + +// XFAIL: libcpp-has-no-experimental-tzdb +// XFAIL: availability-tzdb-missing + +// + +// template +// local_time> +// to_local(const sys_time& tp) const; + +#include + +#include "check_assertion.h" + +// Tests values that cannot be converted. To make sure the test is does not depend on changes +// in the database it uses a time zone with a fixed offset. +int main(int, char**) { + TEST_LIBCPP_ASSERT_FAILURE(std::chrono::locate_zone("Etc/GMT+1")->to_local(std::chrono::sys_seconds::min()), + "cannot convert the system time; it would be before the minimum local clock value"); + + // TODO TZDB look why std::chrono::sys_seconds::max() fails + TEST_LIBCPP_ASSERT_FAILURE( + std::chrono::locate_zone("Etc/GMT-1")->to_local(std::chrono::sys_seconds::max() - std::chrono::seconds(1)), + "cannot convert the system time; it would be after the maximum local clock value"); + + return 0; +} diff --git a/libcxx/test/std/time/time.zone/time.zone.timezone/time.zone.members/to_local.pass.cpp b/libcxx/test/std/time/time.zone/time.zone.timezone/time.zone.members/to_local.pass.cpp new file mode 100644 index 00..dfeea244f7e38e --- /dev/null +++ b/libcxx/test/std/time/time.zone/time.zone.timezone/time.zone.members/to_local.pass.cpp @@ -0,0 +1,66 @@
[llvm-branch-commits] [llvm] [MTE] add stack frame history buffer (PR #86356)
https://github.com/fmayer updated https://github.com/llvm/llvm-project/pull/86356 >From a64c5d63a4df7f59845291ca0d634466713b1ff8 Mon Sep 17 00:00:00 2001 From: Florian Mayer Date: Fri, 29 Mar 2024 16:53:52 -0700 Subject: [PATCH 1/3] update Created using spr 1.3.4 --- llvm/lib/Target/AArch64/AArch64StackTagging.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/llvm/lib/Target/AArch64/AArch64StackTagging.cpp b/llvm/lib/Target/AArch64/AArch64StackTagging.cpp index a6e236386d5baa..6538abea832907 100644 --- a/llvm/lib/Target/AArch64/AArch64StackTagging.cpp +++ b/llvm/lib/Target/AArch64/AArch64StackTagging.cpp @@ -489,7 +489,6 @@ Instruction *AArch64StackTagging::insertBaseTaggedPointer( auto *IntptrTy = IRB.getIntPtrTy(M.getDataLayout()); Value *SlotPtr = memtag::getAndroidSlotPtr(IRB, StackMteSlot); -SlotPtr->setName("TLS_SLOT_STACK_MTE"); auto *ThreadLong = IRB.CreateLoad(IntptrTy, SlotPtr); Value *TaggedFP = IRB.CreateOr( memtag::getFP(IRB), >From 8591fb38c7e065862a0814792a368e2983b8b10c Mon Sep 17 00:00:00 2001 From: Florian Mayer Date: Mon, 29 Apr 2024 14:45:16 -0700 Subject: [PATCH 2/3] api lvl Created using spr 1.3.4 --- llvm/lib/Target/AArch64/AArch64StackTagging.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/llvm/lib/Target/AArch64/AArch64StackTagging.cpp b/llvm/lib/Target/AArch64/AArch64StackTagging.cpp index 840635315eee04..e38cce94a5cc0b 100644 --- a/llvm/lib/Target/AArch64/AArch64StackTagging.cpp +++ b/llvm/lib/Target/AArch64/AArch64StackTagging.cpp @@ -484,7 +484,7 @@ Instruction *AArch64StackTagging::insertBaseTaggedPointer( Base->setName("basetag"); auto TargetTriple = Triple(M.getTargetTriple()); if (ClRecordStackHistory == instr && TargetTriple.isAndroid() && - TargetTriple.isAArch64() && !TargetTriple.isAndroidVersionLT(35)) { + TargetTriple.isAArch64() && !TargetTriple.isAndroidVersionLT(36)) { constexpr int StackMteSlot = -3; constexpr uint64_t TagMask = 0xFULL << 56; >From 66fbd757608c44b04d64de3f058ce813b14706fe Mon Sep 17 00:00:00 2001 From: Florian Mayer Date: Mon, 29 Apr 2024 16:00:09 -0700 Subject: [PATCH 3/3] hidden Created using spr 1.3.4 --- llvm/lib/Target/AArch64/AArch64StackTagging.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/llvm/lib/Target/AArch64/AArch64StackTagging.cpp b/llvm/lib/Target/AArch64/AArch64StackTagging.cpp index e38cce94a5cc0b..43d82a1234f7af 100644 --- a/llvm/lib/Target/AArch64/AArch64StackTagging.cpp +++ b/llvm/lib/Target/AArch64/AArch64StackTagging.cpp @@ -102,7 +102,7 @@ static cl::opt ClRecordStackHistory( cl::values(clEnumVal(none, "Do not record stack ring history"), clEnumVal(instr, "Insert instructions into the prologue for " "storing into the stack ring buffer")), -cl::Hidden, cl::init(instr)); +cl::Hidden, cl::init(none)); static const Align kTagGranuleSize = Align(16); ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [MTE] add stack frame history buffer (PR #86356)
https://github.com/fmayer updated https://github.com/llvm/llvm-project/pull/86356 >From a64c5d63a4df7f59845291ca0d634466713b1ff8 Mon Sep 17 00:00:00 2001 From: Florian Mayer Date: Fri, 29 Mar 2024 16:53:52 -0700 Subject: [PATCH 1/3] update Created using spr 1.3.4 --- llvm/lib/Target/AArch64/AArch64StackTagging.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/llvm/lib/Target/AArch64/AArch64StackTagging.cpp b/llvm/lib/Target/AArch64/AArch64StackTagging.cpp index a6e236386d5baa..6538abea832907 100644 --- a/llvm/lib/Target/AArch64/AArch64StackTagging.cpp +++ b/llvm/lib/Target/AArch64/AArch64StackTagging.cpp @@ -489,7 +489,6 @@ Instruction *AArch64StackTagging::insertBaseTaggedPointer( auto *IntptrTy = IRB.getIntPtrTy(M.getDataLayout()); Value *SlotPtr = memtag::getAndroidSlotPtr(IRB, StackMteSlot); -SlotPtr->setName("TLS_SLOT_STACK_MTE"); auto *ThreadLong = IRB.CreateLoad(IntptrTy, SlotPtr); Value *TaggedFP = IRB.CreateOr( memtag::getFP(IRB), >From 8591fb38c7e065862a0814792a368e2983b8b10c Mon Sep 17 00:00:00 2001 From: Florian Mayer Date: Mon, 29 Apr 2024 14:45:16 -0700 Subject: [PATCH 2/3] api lvl Created using spr 1.3.4 --- llvm/lib/Target/AArch64/AArch64StackTagging.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/llvm/lib/Target/AArch64/AArch64StackTagging.cpp b/llvm/lib/Target/AArch64/AArch64StackTagging.cpp index 840635315eee04..e38cce94a5cc0b 100644 --- a/llvm/lib/Target/AArch64/AArch64StackTagging.cpp +++ b/llvm/lib/Target/AArch64/AArch64StackTagging.cpp @@ -484,7 +484,7 @@ Instruction *AArch64StackTagging::insertBaseTaggedPointer( Base->setName("basetag"); auto TargetTriple = Triple(M.getTargetTriple()); if (ClRecordStackHistory == instr && TargetTriple.isAndroid() && - TargetTriple.isAArch64() && !TargetTriple.isAndroidVersionLT(35)) { + TargetTriple.isAArch64() && !TargetTriple.isAndroidVersionLT(36)) { constexpr int StackMteSlot = -3; constexpr uint64_t TagMask = 0xFULL << 56; >From 66fbd757608c44b04d64de3f058ce813b14706fe Mon Sep 17 00:00:00 2001 From: Florian Mayer Date: Mon, 29 Apr 2024 16:00:09 -0700 Subject: [PATCH 3/3] hidden Created using spr 1.3.4 --- llvm/lib/Target/AArch64/AArch64StackTagging.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/llvm/lib/Target/AArch64/AArch64StackTagging.cpp b/llvm/lib/Target/AArch64/AArch64StackTagging.cpp index e38cce94a5cc0b..43d82a1234f7af 100644 --- a/llvm/lib/Target/AArch64/AArch64StackTagging.cpp +++ b/llvm/lib/Target/AArch64/AArch64StackTagging.cpp @@ -102,7 +102,7 @@ static cl::opt ClRecordStackHistory( cl::values(clEnumVal(none, "Do not record stack ring history"), clEnumVal(instr, "Insert instructions into the prologue for " "storing into the stack ring buffer")), -cl::Hidden, cl::init(instr)); +cl::Hidden, cl::init(none)); static const Align kTagGranuleSize = Align(16); ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] release/18.x: Reland "[clang-repl] Keep the first llvm::Module empty to avoid invalid memory access. (#89031)" (PR #90544)
vgvassilev wrote: @nikic, I am confused. How is that an abi breaking change? https://github.com/llvm/llvm-project/pull/90544 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [BOLT][BAT] Fix translate for branches added by BOLT (PR #90811)
@@ -48,10 +48,9 @@ static cl::opt InputFilename(cl::Positional, cl::Required, cl::cat(BatDumpCategory)); -static cl::list Translate("translate", -cl::desc("translate addresses using BAT"), -cl::value_desc("addr"), -cl::cat(BatDumpCategory)); +static cl::list +Translate("translate", cl::desc("translate addresses using BAT"), + cl::value_desc("addr[:is_from]"), cl::cat(BatDumpCategory)); maksfb wrote: ```suggestion cl::value_desc("addr[:is_src]"), cl::cat(BatDumpCategory)); ``` https://github.com/llvm/llvm-project/pull/90811 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [BOLT][BAT] Fix translate for branches added by BOLT (PR #90811)
@@ -24,6 +24,32 @@ READ-BAT-CHECK-NOT: BOLT-ERROR: unable to save profile in YAML format for input READ-BAT-CHECK: BOLT-INFO: Parsed 5 BAT entries READ-BAT-CHECK: PERF2BOLT: read 79 aggregated LBR entries +# Check handling of a branch not in BAT (added by BOLT) +RUN: FileCheck --input-file %p/Inputs/blarge_new_bat.preagg.txt --check-prefix PREAGG-CHECK %s +# The branch +PREAGG-CHECK: B 80007b 80004c 483 1 +RUN: llvm-objdump %t.out -d --start-address=0x80007b --stop-address=0x80007d \ +RUN: | FileCheck %s --check-prefix OBJDUMP-CHECK +OBJDUMP-CHECK: jmp +# Confirming it's not in BAT +RUN: llvm-bat-dump %t.out --dump-all | FileCheck %s --check-prefix BAT-DUMP-CHECK +BAT-DUMP-CHECK: Function Address: 0x800040, hash: 0x99e67ed32a203023 +# Containing basic block +BAT-DUMP-CHECK: 0x34 -> 0x32 hash: 0x6c36179f229b0032 +# Branch entry just above +BAT-DUMP-CHECK-NEXT: 0x37 -> 0x35 (branch) +# No entry for that offset +BAT-DUMP-NOT: 0x3b -> maksfb wrote: Is this line intended to be used? Is it needed? https://github.com/llvm/llvm-project/pull/90811 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [BOLT][BAT] Fix translate for branches added by BOLT (PR #90811)
@@ -478,18 +478,34 @@ uint64_t BoltAddressTranslation::translate(uint64_t FuncAddress, return Offset; const MapTy = Iter->second; + if (IsBranchSrc) { +// Try exact lookup first +auto KeyVal = Map.find(Offset); +if (KeyVal != Map.end() && KeyVal->second & BRANCHENTRY) + return KeyVal->second >> 1; + } auto KeyVal = Map.upper_bound(Offset); if (KeyVal == Map.begin()) return Offset; --KeyVal; const uint32_t Val = KeyVal->second >> 1; // dropping BRANCHENTRY bit - // Branch source addresses are translated to the first instruction of the - // source BB to avoid accounting for modifications BOLT may have made in the - // BB regarding deletion/addition of instructions. - if (IsBranchSrc) -return Val; + if (IsBranchSrc) { maksfb wrote: Can we handle the exact match case (from above) here as well to simplify the code? https://github.com/llvm/llvm-project/pull/90811 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [lldb] 2beb507 - Revert "[lldb] Unify CalculateMD5 return types (#90921)"
Author: Jonas Devlieghere Date: 2024-05-03T12:14:36-07:00 New Revision: 2beb507e10a6dbe6387bc67143601a66b0168293 URL: https://github.com/llvm/llvm-project/commit/2beb507e10a6dbe6387bc67143601a66b0168293 DIFF: https://github.com/llvm/llvm-project/commit/2beb507e10a6dbe6387bc67143601a66b0168293.diff LOG: Revert "[lldb] Unify CalculateMD5 return types (#90921)" This reverts commit 2f58b9aae2d6f1aeaecd98766ef31cebc0dcbb5b. Added: Modified: lldb/include/lldb/Target/Platform.h lldb/include/lldb/Target/RemoteAwarePlatform.h lldb/source/Plugins/Platform/MacOSX/PlatformDarwinDevice.cpp lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h lldb/source/Target/Platform.cpp lldb/source/Target/RemoteAwarePlatform.cpp Removed: diff --git a/lldb/include/lldb/Target/Platform.h b/lldb/include/lldb/Target/Platform.h index e05c79cb501bf0..ad9c9dcbe684ba 100644 --- a/lldb/include/lldb/Target/Platform.h +++ b/lldb/include/lldb/Target/Platform.h @@ -649,8 +649,8 @@ class Platform : public PluginInterface { virtual std::string GetPlatformSpecificConnectionInformation() { return ""; } - virtual llvm::ErrorOr - CalculateMD5(const FileSpec _spec); + virtual bool CalculateMD5(const FileSpec _spec, uint64_t , +uint64_t ); virtual uint32_t GetResumeCountForLaunchInfo(ProcessLaunchInfo _info) { return 1; diff --git a/lldb/include/lldb/Target/RemoteAwarePlatform.h b/lldb/include/lldb/Target/RemoteAwarePlatform.h index 0b9d79f9ff0380..d183815e1c8b07 100644 --- a/lldb/include/lldb/Target/RemoteAwarePlatform.h +++ b/lldb/include/lldb/Target/RemoteAwarePlatform.h @@ -58,8 +58,8 @@ class RemoteAwarePlatform : public Platform { Status SetFilePermissions(const FileSpec _spec, uint32_t file_permissions) override; - llvm::ErrorOr - CalculateMD5(const FileSpec _spec) override; + bool CalculateMD5(const FileSpec _spec, uint64_t , +uint64_t ) override; Status GetFileWithUUID(const FileSpec _file, const UUID *uuid, FileSpec _file) override; diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinDevice.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinDevice.cpp index 82156aca8cf159..52777909a1f825 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinDevice.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinDevice.cpp @@ -405,21 +405,17 @@ lldb_private::Status PlatformDarwinDevice::GetSharedModuleWithLocalCache( // when going over the *slow* GDB remote transfer mechanism we first // check the hashes of the files - and only do the actual transfer if // they diff er + uint64_t high_local, high_remote, low_local, low_remote; auto MD5 = llvm::sys::fs::md5_contents(module_cache_spec.GetPath()); if (!MD5) return Status(MD5.getError()); + std::tie(high_local, low_local) = MD5->words(); - Log *log = GetLog(LLDBLog::Platform); - bool requires_transfer = true; - llvm::ErrorOr remote_md5 = - m_remote_platform_sp->CalculateMD5(module_spec.GetFileSpec()); - if (std::error_code ec = remote_md5.getError()) -LLDB_LOG(log, "couldn't get md5 sum from remote: {0}", - ec.message()); - else -requires_transfer = *MD5 != *remote_md5; - if (requires_transfer) { + m_remote_platform_sp->CalculateMD5(module_spec.GetFileSpec(), + low_remote, high_remote); + if (low_local != low_remote || high_local != high_remote) { // bring in the remote file +Log *log = GetLog(LLDBLog::Platform); LLDB_LOGF(log, "[%s] module %s/%s needs to be replaced from remote copy", (IsHost() ? "host" : "remote"), diff --git a/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp b/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp index 4684947ede209f..0dce5add2e3759 100644 --- a/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp +++ b/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp @@ -684,12 +684,12 @@ Status PlatformRemoteGDBServer::RunShellCommand( signo_ptr, command_output, timeout); } -llvm::ErrorOr -PlatformRemoteGDBServer::CalculateMD5(const FileSpec _spec) { +bool PlatformRemoteGDBServer::CalculateMD5(const FileSpec _spec, + uint64_t , uint64_t ) { if
[llvm-branch-commits] [clang] [clang] CTAD alias: fix the transformation for the require-clause expr (PR #90961)
@@ -2744,31 +2744,155 @@ bool hasDeclaredDeductionGuides(DeclarationName Name, DeclContext *DC) { return false; } +unsigned getTemplateDepth(NamedDecl *TemplateParam) { + if (auto *TTP = dyn_cast(TemplateParam)) +return TTP->getDepth(); + if (auto *TTP = dyn_cast(TemplateParam)) +return TTP->getDepth(); + if (auto *NTTP = dyn_cast(TemplateParam)) +return NTTP->getDepth(); + llvm_unreachable("Unhandled template parameter types"); +} + NamedDecl *transformTemplateParameter(Sema , DeclContext *DC, NamedDecl *TemplateParam, MultiLevelTemplateArgumentList , - unsigned NewIndex) { + unsigned NewIndex, unsigned NewDepth) { if (auto *TTP = dyn_cast(TemplateParam)) -return transformTemplateTypeParam(SemaRef, DC, TTP, Args, TTP->getDepth(), +return transformTemplateTypeParam(SemaRef, DC, TTP, Args, NewDepth, NewIndex); if (auto *TTP = dyn_cast(TemplateParam)) return transformTemplateParam(SemaRef, DC, TTP, Args, NewIndex, - TTP->getDepth()); + NewDepth); if (auto *NTTP = dyn_cast(TemplateParam)) return transformTemplateParam(SemaRef, DC, NTTP, Args, NewIndex, - NTTP->getDepth()); + NewDepth); llvm_unreachable("Unhandled template parameter types"); } -Expr *transformRequireClause(Sema , FunctionTemplateDecl *FTD, - llvm::ArrayRef TransformedArgs) { - Expr *RC = FTD->getTemplateParameters()->getRequiresClause(); +// Transform the require-clause of F if any. +// The return result is expected to be the require-clause for the synthesized +// alias deduction guide. +Expr *transformRequireClause( +Sema , FunctionTemplateDecl *F, +TypeAliasTemplateDecl *AliasTemplate, +ArrayRef DeduceResults) { + Expr *RC = F->getTemplateParameters()->getRequiresClause(); if (!RC) return nullptr; + + auto = SemaRef.Context; + LocalInstantiationScope Scope(SemaRef); + + // In the clang AST, constraint nodes are not instantiated at all unless they + // are being evaluated. This means that occurrences of template parameters + // in the require-clause expr have subtle differences compared to occurrences + // in other places, such as function parameters. When transforming the + // require-clause, we must respect these differences, particularly regarding + // the 'depth' information: + // 1) In the transformed require-clause, occurrences of template parameters + // must use the "uninstantiated" depth; + // 2) When substituting on the require-clause expr of the underlying + // deduction guide, we must use the entire set of template argument lists. + // + // It's important to note that we're performing this transformation on an + // *instantiated* AliasTemplate. + + // For 1), if the alias template is nested within a class template, we + // calcualte the 'uninstantiated' depth by adding the substitution level back. + unsigned AdjustDepth = 0; + if (auto *PrimaryTemplate = AliasTemplate->getInstantiatedFromMemberTemplate()) +AdjustDepth = PrimaryTemplate->getTemplateDepth(); + + // We rebuild all template parameters with the uninstantiated depth, and + // build template arguments refer to them. + SmallVector AdjustedAliasTemplateArgs; + + for (auto *TP : *AliasTemplate->getTemplateParameters()) { +// Rebuild any internal references to earlier parameters and reindex +// as we go. +MultiLevelTemplateArgumentList Args; +Args.setKind(TemplateSubstitutionKind::Rewrite); +Args.addOuterTemplateArguments(AdjustedAliasTemplateArgs); +NamedDecl *NewParam = transformTemplateParameter( +SemaRef, AliasTemplate->getDeclContext(), TP, Args, +/*NewIndex=*/AdjustedAliasTemplateArgs.size(), +getTemplateDepth(TP) + AdjustDepth); + +auto NewTemplateArgument = Context.getCanonicalTemplateArgument( mizvekov wrote: Why do we need to canonicalize the argument here? https://github.com/llvm/llvm-project/pull/90961 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] [clang] CTAD alias: fix the transformation for the require-clause expr (PR #90961)
@@ -2744,31 +2744,155 @@ bool hasDeclaredDeductionGuides(DeclarationName Name, DeclContext *DC) { return false; } +unsigned getTemplateDepth(NamedDecl *TemplateParam) { mizvekov wrote: I think this is potentially misleading, as we already have multiple unrelated `getTemplateDepth`, see `Sema.h` / `SemaTemplate.cpp`, `DeclBase.h`, `Expr.h`. https://github.com/llvm/llvm-project/pull/90961 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [libcxx] [libc++][TZDB] Implements time_zone::to_sys. (PR #90901)
https://github.com/mordante updated https://github.com/llvm/llvm-project/pull/90901 >From 775f5459258db3416e90dbe0f8b0ee24f7125e95 Mon Sep 17 00:00:00 2001 From: Mark de Wever Date: Wed, 17 Apr 2024 21:00:22 +0200 Subject: [PATCH] [libc++][TZDB] Implements time_zone::to_sys. This implements the overload with the choose argument and adds this enum. Implements parts of: - P0355 Extending chrono to Calendars and Time Zones --- libcxx/include/__chrono/time_zone.h | 32 libcxx/include/chrono | 4 + libcxx/modules/std/chrono.inc | 3 - .../diagnostics/chrono.nodiscard.verify.cpp | 3 + .../time.zone.timezone/choose.pass.cpp| 37 + .../assert.to_sys_choose.pass.cpp | 41 + .../time.zone.members/to_sys_choose.pass.cpp | 147 ++ 7 files changed, 264 insertions(+), 3 deletions(-) create mode 100644 libcxx/test/libcxx/time/time.zone/time.zone.timezone/choose.pass.cpp create mode 100644 libcxx/test/libcxx/time/time.zone/time.zone.timezone/time.zone.members/assert.to_sys_choose.pass.cpp create mode 100644 libcxx/test/std/time/time.zone/time.zone.timezone/time.zone.members/to_sys_choose.pass.cpp diff --git a/libcxx/include/__chrono/time_zone.h b/libcxx/include/__chrono/time_zone.h index b7ce4ea659a1af..a18c5d5295b7d6 100644 --- a/libcxx/include/__chrono/time_zone.h +++ b/libcxx/include/__chrono/time_zone.h @@ -42,6 +42,8 @@ _LIBCPP_BEGIN_NAMESPACE_STD namespace chrono { +enum class choose { earliest, latest }; + class _LIBCPP_AVAILABILITY_TZDB time_zone { _LIBCPP_HIDE_FROM_ABI time_zone() = default; @@ -96,6 +98,36 @@ class _LIBCPP_AVAILABILITY_TZDB time_zone { return {}; } + template + [[nodiscard]] _LIBCPP_HIDE_FROM_ABI sys_time> + to_sys(const local_time<_Duration>& __time, choose __z) const { +local_info __info = get_info(__time); +switch (__info.result) { +case local_info::unique: +case local_info::nonexistent: // first and second are the same + return sys_time>{__time.time_since_epoch() - __info.first.offset}; + +case local_info::ambiguous: + switch (__z) { + case choose::earliest: +return sys_time>{__time.time_since_epoch() - __info.first.offset}; + + case choose::latest: +return sys_time>{__time.time_since_epoch() - __info.second.offset}; + +// Note a value out of bounds is not specified. + } +} + +// TODO TZDB The standard does not specify anything in these cases. +_LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN( +__info.result != -1, "cannot convert the local time; it would be before the minimum system clock value"); +_LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN( +__info.result != -2, "cannot convert the local time; it would be after the maximum system clock value"); + +return {}; + } + [[nodiscard]] _LIBCPP_HIDE_FROM_ABI const __impl& __implementation() const noexcept { return *__impl_; } private: diff --git a/libcxx/include/chrono b/libcxx/include/chrono index 4b0ea938710bdd..c70b241f086464 100644 --- a/libcxx/include/chrono +++ b/libcxx/include/chrono @@ -774,6 +774,10 @@ class time_zone { template sys_time> to_sys(const local_time& tp) const; + + template + sys_time> +to_sys(const local_time& tp, choose z) const; }; bool operator==(const time_zone& x, const time_zone& y) noexcept; // C++20 strong_ordering operator<=>(const time_zone& x, const time_zone& y) noexcept; // C++20 diff --git a/libcxx/modules/std/chrono.inc b/libcxx/modules/std/chrono.inc index 38e3c4184521b7..9e16f09bd31afb 100644 --- a/libcxx/modules/std/chrono.inc +++ b/libcxx/modules/std/chrono.inc @@ -216,11 +216,8 @@ export namespace std { using std::chrono::local_info; using std::chrono::sys_info; -#if 0 // [time.zone.timezone], class time_zone using std::chrono::choose; -#endif // if 0 - using std::chrono::time_zone; #if 0 diff --git a/libcxx/test/libcxx/diagnostics/chrono.nodiscard.verify.cpp b/libcxx/test/libcxx/diagnostics/chrono.nodiscard.verify.cpp index fea1e4417cc12c..cba7916ff2c646 100644 --- a/libcxx/test/libcxx/diagnostics/chrono.nodiscard.verify.cpp +++ b/libcxx/test/libcxx/diagnostics/chrono.nodiscard.verify.cpp @@ -49,9 +49,12 @@ void test() { { std::chrono::sys_seconds s{}; std::chrono::local_seconds l{}; +std::chrono::choose z = std::chrono::choose::earliest; tz.name(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} tz.get_info(s); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} tz.get_info(l); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} +tz.to_sys(l);// not nodiscard +tz.to_sys(l, z); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
[llvm-branch-commits] [llvm] release/18.x: [AArch64] Remove invalid uabdl patterns. (#89272) (PR #89380)
AtariDreams wrote: I would add "Fixed issue where on AArch64 some patterns would be miscompiled." https://github.com/llvm/llvm-project/pull/89380 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] [clang] CTAD alias: fix the transformation for the require-clause expr (PR #90961)
https://github.com/erichkeane approved this pull request. I think this makes sense, 2 nits, else LGTM. https://github.com/llvm/llvm-project/pull/90961 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] [clang] CTAD alias: fix the transformation for the require-clause expr (PR #90961)
@@ -2744,31 +2744,155 @@ bool hasDeclaredDeductionGuides(DeclarationName Name, DeclContext *DC) { return false; } +unsigned getTemplateDepth(NamedDecl *TemplateParam) { + if (auto *TTP = dyn_cast(TemplateParam)) +return TTP->getDepth(); + if (auto *TTP = dyn_cast(TemplateParam)) +return TTP->getDepth(); + if (auto *NTTP = dyn_cast(TemplateParam)) +return NTTP->getDepth(); + llvm_unreachable("Unhandled template parameter types"); +} + NamedDecl *transformTemplateParameter(Sema , DeclContext *DC, NamedDecl *TemplateParam, MultiLevelTemplateArgumentList , - unsigned NewIndex) { + unsigned NewIndex, unsigned NewDepth) { if (auto *TTP = dyn_cast(TemplateParam)) -return transformTemplateTypeParam(SemaRef, DC, TTP, Args, TTP->getDepth(), +return transformTemplateTypeParam(SemaRef, DC, TTP, Args, NewDepth, NewIndex); if (auto *TTP = dyn_cast(TemplateParam)) return transformTemplateParam(SemaRef, DC, TTP, Args, NewIndex, - TTP->getDepth()); + NewDepth); if (auto *NTTP = dyn_cast(TemplateParam)) return transformTemplateParam(SemaRef, DC, NTTP, Args, NewIndex, - NTTP->getDepth()); + NewDepth); llvm_unreachable("Unhandled template parameter types"); } -Expr *transformRequireClause(Sema , FunctionTemplateDecl *FTD, - llvm::ArrayRef TransformedArgs) { - Expr *RC = FTD->getTemplateParameters()->getRequiresClause(); +// Transform the require-clause of F if any. +// The return result is expected to be the require-clause for the synthesized +// alias deduction guide. +Expr *transformRequireClause( erichkeane wrote: Same question/etc here. https://github.com/llvm/llvm-project/pull/90961 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] [clang] CTAD alias: fix the transformation for the require-clause expr (PR #90961)
@@ -2744,31 +2744,155 @@ bool hasDeclaredDeductionGuides(DeclarationName Name, DeclContext *DC) { return false; } +unsigned getTemplateDepth(NamedDecl *TemplateParam) { erichkeane wrote: are we in an anonymous namespace? Else this should be 'static'. https://github.com/llvm/llvm-project/pull/90961 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] [clang] CTAD alias: fix the transformation for the require-clause expr (PR #90961)
https://github.com/erichkeane edited https://github.com/llvm/llvm-project/pull/90961 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] [clang] CTAD alias: fix the transformation for the require-clause expr (PR #90961)
llvmbot wrote: @llvm/pr-subscribers-clang Author: Haojian Wu (hokein) Changes In the clang AST, constraint nodes are deliberately not instantiated unless they are actively being evaluated. Consequently, occurrences of template parameters in the require-clause expression have a subtle "depth" difference compared to normal occurrences in places, such as function parameters. When transforming the require-clause, we must take this distinction into account. The existing implementation overlooks this consideration. This patch is to rewrite the implementation of the require-clause transformation to address this issue. Fixes #90177 --- Full diff: https://github.com/llvm/llvm-project/pull/90961.diff 3 Files Affected: - (modified) clang/lib/Sema/SemaTemplate.cpp (+138-13) - (added) clang/test/AST/ast-dump-ctad-alias.cpp (+40) - (modified) clang/test/SemaCXX/cxx20-ctad-type-alias.cpp (+68) ``diff diff --git a/clang/lib/Sema/SemaTemplate.cpp b/clang/lib/Sema/SemaTemplate.cpp index 7f49acc36769e9..5f1a44d7850280 100644 --- a/clang/lib/Sema/SemaTemplate.cpp +++ b/clang/lib/Sema/SemaTemplate.cpp @@ -2744,31 +2744,155 @@ bool hasDeclaredDeductionGuides(DeclarationName Name, DeclContext *DC) { return false; } +unsigned getTemplateDepth(NamedDecl *TemplateParam) { + if (auto *TTP = dyn_cast(TemplateParam)) +return TTP->getDepth(); + if (auto *TTP = dyn_cast(TemplateParam)) +return TTP->getDepth(); + if (auto *NTTP = dyn_cast(TemplateParam)) +return NTTP->getDepth(); + llvm_unreachable("Unhandled template parameter types"); +} + NamedDecl *transformTemplateParameter(Sema , DeclContext *DC, NamedDecl *TemplateParam, MultiLevelTemplateArgumentList , - unsigned NewIndex) { + unsigned NewIndex, unsigned NewDepth) { if (auto *TTP = dyn_cast(TemplateParam)) -return transformTemplateTypeParam(SemaRef, DC, TTP, Args, TTP->getDepth(), +return transformTemplateTypeParam(SemaRef, DC, TTP, Args, NewDepth, NewIndex); if (auto *TTP = dyn_cast(TemplateParam)) return transformTemplateParam(SemaRef, DC, TTP, Args, NewIndex, - TTP->getDepth()); + NewDepth); if (auto *NTTP = dyn_cast(TemplateParam)) return transformTemplateParam(SemaRef, DC, NTTP, Args, NewIndex, - NTTP->getDepth()); + NewDepth); llvm_unreachable("Unhandled template parameter types"); } -Expr *transformRequireClause(Sema , FunctionTemplateDecl *FTD, - llvm::ArrayRef TransformedArgs) { - Expr *RC = FTD->getTemplateParameters()->getRequiresClause(); +// Transform the require-clause of F if any. +// The return result is expected to be the require-clause for the synthesized +// alias deduction guide. +Expr *transformRequireClause( +Sema , FunctionTemplateDecl *F, +TypeAliasTemplateDecl *AliasTemplate, +ArrayRef DeduceResults) { + Expr *RC = F->getTemplateParameters()->getRequiresClause(); if (!RC) return nullptr; + + auto = SemaRef.Context; + LocalInstantiationScope Scope(SemaRef); + + // In the clang AST, constraint nodes are not instantiated at all unless they + // are being evaluated. This means that occurrences of template parameters + // in the require-clause expr have subtle differences compared to occurrences + // in other places, such as function parameters. When transforming the + // require-clause, we must respect these differences, particularly regarding + // the 'depth' information: + // 1) In the transformed require-clause, occurrences of template parameters + // must use the "uninstantiated" depth; + // 2) When substituting on the require-clause expr of the underlying + // deduction guide, we must use the entire set of template argument lists. + // + // It's important to note that we're performing this transformation on an + // *instantiated* AliasTemplate. + + // For 1), if the alias template is nested within a class template, we + // calcualte the 'uninstantiated' depth by adding the substitution level back. + unsigned AdjustDepth = 0; + if (auto *PrimaryTemplate = AliasTemplate->getInstantiatedFromMemberTemplate()) +AdjustDepth = PrimaryTemplate->getTemplateDepth(); + + // We rebuild all template parameters with the uninstantiated depth, and + // build template arguments refer to them. + SmallVector AdjustedAliasTemplateArgs; + + for (auto *TP : *AliasTemplate->getTemplateParameters()) { +// Rebuild any internal references to earlier parameters and reindex +// as we go. +MultiLevelTemplateArgumentList Args; +Args.setKind(TemplateSubstitutionKind::Rewrite); +Args.addOuterTemplateArguments(AdjustedAliasTemplateArgs); +NamedDecl *NewParam =
[llvm-branch-commits] [clang] [clang] CTAD alias: fix the transformation for the require-clause expr (PR #90961)
https://github.com/hokein created https://github.com/llvm/llvm-project/pull/90961 In the clang AST, constraint nodes are deliberately not instantiated unless they are actively being evaluated. Consequently, occurrences of template parameters in the require-clause expression have a subtle "depth" difference compared to normal occurrences in places, such as function parameters. When transforming the require-clause, we must take this distinction into account. The existing implementation overlooks this consideration. This patch is to rewrite the implementation of the require-clause transformation to address this issue. Fixes #90177 >From 94d5225d7eb6479cf4f91eb44ccdf253f7ae9a6d Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Fri, 3 May 2024 13:54:06 +0200 Subject: [PATCH] [clang] CTAD alias: refine the transformation for the require-clause expr. In the clang AST, constraint nodes are deliberately not instantiated unless they are actively being evaluated. Consequently, occurrences of template parameters in the require-clause expression have a subtle "depth" difference compared to normal occurrences in place contexts, such as function parameters. When transforming the require-clause, we must take this distinction into account. The existing implementation overlooks this consideration. This patch is to rewrite the implementation of the require-clause transformation to address this issue. --- clang/lib/Sema/SemaTemplate.cpp | 151 +-- clang/test/AST/ast-dump-ctad-alias.cpp | 40 + clang/test/SemaCXX/cxx20-ctad-type-alias.cpp | 68 + 3 files changed, 246 insertions(+), 13 deletions(-) create mode 100644 clang/test/AST/ast-dump-ctad-alias.cpp diff --git a/clang/lib/Sema/SemaTemplate.cpp b/clang/lib/Sema/SemaTemplate.cpp index 7f49acc36769e9..5f1a44d7850280 100644 --- a/clang/lib/Sema/SemaTemplate.cpp +++ b/clang/lib/Sema/SemaTemplate.cpp @@ -2744,31 +2744,155 @@ bool hasDeclaredDeductionGuides(DeclarationName Name, DeclContext *DC) { return false; } +unsigned getTemplateDepth(NamedDecl *TemplateParam) { + if (auto *TTP = dyn_cast(TemplateParam)) +return TTP->getDepth(); + if (auto *TTP = dyn_cast(TemplateParam)) +return TTP->getDepth(); + if (auto *NTTP = dyn_cast(TemplateParam)) +return NTTP->getDepth(); + llvm_unreachable("Unhandled template parameter types"); +} + NamedDecl *transformTemplateParameter(Sema , DeclContext *DC, NamedDecl *TemplateParam, MultiLevelTemplateArgumentList , - unsigned NewIndex) { + unsigned NewIndex, unsigned NewDepth) { if (auto *TTP = dyn_cast(TemplateParam)) -return transformTemplateTypeParam(SemaRef, DC, TTP, Args, TTP->getDepth(), +return transformTemplateTypeParam(SemaRef, DC, TTP, Args, NewDepth, NewIndex); if (auto *TTP = dyn_cast(TemplateParam)) return transformTemplateParam(SemaRef, DC, TTP, Args, NewIndex, - TTP->getDepth()); + NewDepth); if (auto *NTTP = dyn_cast(TemplateParam)) return transformTemplateParam(SemaRef, DC, NTTP, Args, NewIndex, - NTTP->getDepth()); + NewDepth); llvm_unreachable("Unhandled template parameter types"); } -Expr *transformRequireClause(Sema , FunctionTemplateDecl *FTD, - llvm::ArrayRef TransformedArgs) { - Expr *RC = FTD->getTemplateParameters()->getRequiresClause(); +// Transform the require-clause of F if any. +// The return result is expected to be the require-clause for the synthesized +// alias deduction guide. +Expr *transformRequireClause( +Sema , FunctionTemplateDecl *F, +TypeAliasTemplateDecl *AliasTemplate, +ArrayRef DeduceResults) { + Expr *RC = F->getTemplateParameters()->getRequiresClause(); if (!RC) return nullptr; + + auto = SemaRef.Context; + LocalInstantiationScope Scope(SemaRef); + + // In the clang AST, constraint nodes are not instantiated at all unless they + // are being evaluated. This means that occurrences of template parameters + // in the require-clause expr have subtle differences compared to occurrences + // in other places, such as function parameters. When transforming the + // require-clause, we must respect these differences, particularly regarding + // the 'depth' information: + // 1) In the transformed require-clause, occurrences of template parameters + // must use the "uninstantiated" depth; + // 2) When substituting on the require-clause expr of the underlying + // deduction guide, we must use the entire set of template argument lists. + // + // It's important to note that we're performing this transformation on an + // *instantiated* AliasTemplate. + + // For 1), if the alias template is nested