[llvm-branch-commits] [openmp] 01e3eb2 - [OpenMP][Offloading] Fix infinite loop in applyToShadowMapEntries

2022-02-15 Thread Tom Stellard via llvm-branch-commits

Author: Shilei Tian
Date: 2022-02-15T03:02:27-08:00
New Revision: 01e3eb2bd438089ced550ab74de497f2bfa67038

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

LOG: [OpenMP][Offloading] Fix infinite loop in applyToShadowMapEntries

This patch fixes the issue that the for loop in `applyToShadowMapEntries`
is infinite because `Itr` is not incremented in `CB`. Fixes #53727.

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D119471

(cherry picked from commit c27f530d4c6306b2010306131f66e771d6a66594)

Added: 
openmp/libomptarget/test/offloading/bug53727.cpp

Modified: 
openmp/libomptarget/src/omptarget.cpp

Removed: 




diff  --git a/openmp/libomptarget/src/omptarget.cpp 
b/openmp/libomptarget/src/omptarget.cpp
index c8504c8ea5ff9..304091e4f2f1d 100644
--- a/openmp/libomptarget/src/omptarget.cpp
+++ b/openmp/libomptarget/src/omptarget.cpp
@@ -889,6 +889,7 @@ static int targetDataContiguous(ident_t *loc, DeviceTy 
&Device, void *ArgsBase,
   DP("Restoring original host pointer value " DPxMOD
  " for host pointer " DPxMOD "\n",
  DPxPTR(Itr->second.HstPtrVal), DPxPTR(ShadowHstPtrAddr));
+  ++Itr;
   return OFFLOAD_SUCCESS;
 };
 applyToShadowMapEntries(Device, CB, HstPtrBegin, ArgSize, TPR);
@@ -911,6 +912,7 @@ static int targetDataContiguous(ident_t *loc, DeviceTy 
&Device, void *ArgsBase,
   sizeof(void *), AsyncInfo);
   if (Ret != OFFLOAD_SUCCESS)
 REPORT("Copying data to device failed.\n");
+  ++Itr;
   return Ret;
 };
 applyToShadowMapEntries(Device, CB, HstPtrBegin, ArgSize, TPR);

diff  --git a/openmp/libomptarget/test/offloading/bug53727.cpp 
b/openmp/libomptarget/test/offloading/bug53727.cpp
new file mode 100644
index 0..4744024dfec47
--- /dev/null
+++ b/openmp/libomptarget/test/offloading/bug53727.cpp
@@ -0,0 +1,57 @@
+// RUN: %libomptarget-compilexx-and-run-generic
+
+#include 
+#include 
+
+constexpr const int N = 10;
+
+struct T {
+  int a;
+  int *p;
+};
+
+struct S {
+  int b;
+  T t;
+};
+
+int main(int argc, char *argv[]) {
+  S s;
+  s.t.p = new int[N];
+  for (int i = 0; i < N; ++i) {
+s.t.p[i] = i;
+  }
+
+#pragma omp target enter data map(to : s, s.t.p[:N])
+
+#pragma omp target
+  {
+for (int i = 0; i < N; ++i) {
+  s.t.p[i] += i;
+}
+  }
+
+#pragma omp target update from(s.t.p[:N])
+
+  for (int i = 0; i < N; ++i) {
+assert(s.t.p[i] == 2 * i);
+s.t.p[i] += i;
+  }
+
+#pragma omp target update to(s.t.p[:N])
+
+#pragma omp target
+  {
+for (int i = 0; i < N; ++i) {
+  s.t.p[i] += i;
+}
+  }
+
+#pragma omp target exit data map(from : s, s.t.p[:N])
+
+  for (int i = 0; i < N; ++i) {
+assert(s.t.p[i] == 4 * i);
+  }
+
+  return 0;
+}



___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] af19ae5 - Reland "[lldb] Remove non address bits when looking up memory regions"

2022-02-15 Thread Tom Stellard via llvm-branch-commits

Author: David Spickett
Date: 2022-02-15T03:02:27-08:00
New Revision: af19ae529271f9ae96927662d7d876489115fb26

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

LOG: Reland "[lldb] Remove non address bits when looking up memory regions"

(cherry picked from 2937b282188bafb6bdb65ee87c70e9109aa910b7)

This reverts commit 0df522969a7a0128052bd79182c8d58e00556e2f.

Additional checks are added to fix the detection of the last memory region
in GetMemoryRegions or repeating the "memory region" command when the
target has non-address bits.

Normally you keep reading from address 0, looking up each region's end
address until you get LLDB_INVALID_ADDR as the region end address.
(0x)

This is what the remote will return once you go beyond the last mapped region:
[0xfffdf000-0x0001) rw- [stack]
[0x0001-0x) ---

Problem is that when we "fix" the lookup address, we remove some bits
from it. On an AArch64 system we have 48 bit virtual addresses, so when
we fix the end address of the [stack] region the result is 0.
So we loop back to the start.

[0xfffdf000-0x0001) rw- [stack]
[0x-0x0040) ---

To fix this I added an additional check for the last range.
If the end address of the region is different once you apply
FixDataAddress, we are at the last region.

Since the end of the last region will be the last valid mappable
address, plus 1. That 1 will be removed by the ABI plugin.

The only side effect is that on systems with non-address bits, you
won't get that last catch all unmapped region from the max virtual
address up to 0xf...f.

[0xf800-0xfffdf000) ---
[0xfffdf000-0x0001) rw- [stack]


Though in some way this is more correct because that region is not
just unmapped, it's not mappable at all.

No extra testing is needed because this is already covered by
TestMemoryRegion.py, I simply forgot to run it on system that had
both top byte ignore and pointer authentication.

This change has been tested on a qemu VM with top byte ignore,
memory tagging and pointer authentication enabled.

Reviewed By: omjavaid

Differential Revision: https://reviews.llvm.org/D115508

Added: 
lldb/test/API/linux/aarch64/tagged_memory_region/Makefile

lldb/test/API/linux/aarch64/tagged_memory_region/TestAArch64LinuxTaggedMemoryRegion.py
lldb/test/API/linux/aarch64/tagged_memory_region/main.c

Modified: 
lldb/include/lldb/Target/Process.h
lldb/source/Commands/CommandObjectMemory.cpp
lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp
lldb/source/Plugins/Process/Windows/Common/ProcessWindows.h
lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp
lldb/source/Plugins/Process/elf-core/ProcessElfCore.h
lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp
lldb/source/Plugins/Process/mach-core/ProcessMachCore.h
lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp
lldb/source/Plugins/Process/minidump/ProcessMinidump.h
lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp
lldb/source/Plugins/Process/scripted/ScriptedProcess.h
lldb/source/Target/Process.cpp
llvm/docs/ReleaseNotes.rst

Removed: 




diff  --git a/lldb/include/lldb/Target/Process.h 
b/lldb/include/lldb/Target/Process.h
index 12ed1e09227cf..7911dac40b705 100644
--- a/lldb/include/lldb/Target/Process.h
+++ b/lldb/include/lldb/Target/Process.h
@@ -1759,7 +1759,7 @@ class Process : public 
std::enable_shared_from_this,
   ///
   /// If load_addr is within the address space the process has mapped
   /// range_info will be filled in with the start and end of that range as
-  /// well as the permissions for that range and range_info.GetMapped will
+  /// well as the permissions for that range and range_info. GetMapped will
   /// return true.
   ///
   /// If load_addr is outside any mapped region then range_info will have its
@@ -1768,23 +1768,21 @@ class Process : public 
std::enable_shared_from_this,
   /// there are no valid mapped ranges between load_addr and the end of the
   /// process address space.
   ///
-  /// GetMemoryRegionInfo will only return an error if it is unimplemented for
-  /// the current process.
+  /// GetMemoryRegionInfo calls DoGetMemoryRegionInfo. Override that function 
in
+  /// process subclasses.
   ///
   /// \param[in] load_addr
-  /// The load address to query the range_info for.
+  /// The load address to query the range_info for. May include non
+  /// address bits, these will be removed by the the ABI plugin if there is
+  /// one.
   ///
   /// \param[out] ran

[llvm-branch-commits] [openmp] 78f8449 - [OpenMP][libomp] Replace accidental VLA with KMP_ALLOCA

2022-02-15 Thread Tom Stellard via llvm-branch-commits

Author: Jonathan Peyton
Date: 2022-02-15T03:02:27-08:00
New Revision: 78f8449e01f7a397c6ba1cb7e9d0e1e863bbeaa5

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

LOG: [OpenMP][libomp] Replace accidental VLA with KMP_ALLOCA

MSVC does not support variable length arrays. Replace with KMP_ALLOCA
which is already used in the same file for stack-allocated variables.

(cherry picked from commit 6be7c21b57e4a45b012209974ab9038b679134f5)

Added: 


Modified: 
openmp/runtime/src/kmp_affinity.cpp

Removed: 




diff  --git a/openmp/runtime/src/kmp_affinity.cpp 
b/openmp/runtime/src/kmp_affinity.cpp
index 71e8b7fd10eb6..d1f1b6790e2d5 100644
--- a/openmp/runtime/src/kmp_affinity.cpp
+++ b/openmp/runtime/src/kmp_affinity.cpp
@@ -948,7 +948,7 @@ bool kmp_topology_t::filter_hw_subset() {
   bool using_core_effs = false;
   int hw_subset_depth = __kmp_hw_subset->get_depth();
   kmp_hw_t specified[KMP_HW_LAST];
-  int topology_levels[hw_subset_depth];
+  int *topology_levels = (int *)KMP_ALLOCA(sizeof(int) * hw_subset_depth);
   KMP_ASSERT(hw_subset_depth > 0);
   KMP_FOREACH_HW_TYPE(i) { specified[i] = KMP_HW_UNKNOWN; }
   int core_level = get_level(KMP_HW_CORE);



___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] 8f8a31e - [RISCV] Add test case for a vsetvli insertion bug found after D118667.

2022-02-15 Thread Tom Stellard via llvm-branch-commits

Author: Craig Topper
Date: 2022-02-15T03:02:27-08:00
New Revision: 8f8a31ec88b5908870960061dcc24007e7682925

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

LOG: [RISCV] Add test case for a vsetvli insertion bug found after D118667.

We're missing a vsetvli before a vse after a redsum in this test.

This appears to be because the vmv.s.x has a VL of 1, but did not
trigger a vsetvli because it is a scalar move op and any non-zero
VL would work. So it looked at it the predecessors and decided it was
that they all had a non-zero vl. Then the redsum was visited, it
also took the VL from the predecessors since the vmv.s.x and the 4
was found compatible.

Finally we visit the vse and it looks at the BBLocalInfo and sees
that is compatible because it contains a VL of 1 from the vmv.s.x,
the first instruction in the block. BBLocalInfo was not updated
when the vredsum was visited because BBLocalInfo was valid and no
vsetvli was generated.

I think fundamentally the vmv.s.x optimization has the same first
phase and third phase not matching problem that D118667 was trying
to fix for stores.

Differential Revision: https://reviews.llvm.org/D119516

(cherry picked from commit ba9a7ae798053d7cf741143739351b5a4ac29d8b)

Added: 


Modified: 
llvm/test/CodeGen/RISCV/rvv/vsetvli-insert-crossbb.mir

Removed: 




diff  --git a/llvm/test/CodeGen/RISCV/rvv/vsetvli-insert-crossbb.mir 
b/llvm/test/CodeGen/RISCV/rvv/vsetvli-insert-crossbb.mir
index b222360c4c4e7..70ac53052e05c 100644
--- a/llvm/test/CodeGen/RISCV/rvv/vsetvli-insert-crossbb.mir
+++ b/llvm/test/CodeGen/RISCV/rvv/vsetvli-insert-crossbb.mir
@@ -99,6 +99,31 @@
 ret void
   }
 
+  define void @redusum_loop(i32* nocapture noundef readonly %a, i32 noundef 
signext %n, i32* nocapture noundef writeonly %res) #0 {
+  entry:
+br label %vector.body
+
+  vector.body:  ; preds = %vector.body, 
%entry
+%lsr.iv1 = phi i32* [ %scevgep, %vector.body ], [ %a, %entry ]
+%lsr.iv = phi i64 [ %lsr.iv.next, %vector.body ], [ 2048, %entry ]
+%vec.phi = phi <4 x i32> [ zeroinitializer, %entry ], [ %0, %vector.body ]
+%lsr.iv12 = bitcast i32* %lsr.iv1 to <4 x i32>*
+%wide.load = load <4 x i32>, <4 x i32>* %lsr.iv12, align 4
+%0 = add <4 x i32> %wide.load, %vec.phi
+%lsr.iv.next = add nsw i64 %lsr.iv, -4
+%scevgep = getelementptr i32, i32* %lsr.iv1, i64 4
+%1 = icmp eq i64 %lsr.iv.next, 0
+br i1 %1, label %middle.block, label %vector.body
+
+  middle.block: ; preds = %vector.body
+%2 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %0)
+store i32 %2, i32* %res, align 4
+ret void
+  }
+
+  ; Function Attrs: nofree nosync nounwind readnone willreturn
+  declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>)
+
   ; Function Attrs: nounwind readnone
   declare  @llvm.riscv.vadd.nxv1i64.nxv1i64.i64(, , i64) #1
 
@@ -599,3 +624,112 @@ body: |
 
 PseudoRET
 ...
+---
+name:redusum_loop
+alignment:   4
+tracksRegLiveness: true
+registers:
+  - { id: 0, class: gpr }
+  - { id: 1, class: gpr }
+  - { id: 2, class: vr }
+  - { id: 3, class: vr }
+  - { id: 4, class: gpr }
+  - { id: 5, class: gpr }
+  - { id: 6, class: gpr }
+  - { id: 7, class: gpr }
+  - { id: 8, class: gpr }
+  - { id: 9, class: gpr }
+  - { id: 10, class: vr }
+  - { id: 11, class: vr }
+  - { id: 12, class: vr }
+  - { id: 13, class: gpr }
+  - { id: 14, class: vr }
+  - { id: 15, class: vr }
+  - { id: 16, class: vr }
+  - { id: 17, class: vr }
+  - { id: 18, class: gpr }
+  - { id: 19, class: gpr }
+  - { id: 20, class: vr }
+  - { id: 21, class: vr }
+  - { id: 22, class: vr }
+  - { id: 23, class: vr }
+  - { id: 24, class: vr }
+liveins:
+  - { reg: '$x10', virtual-reg: '%6' }
+  - { reg: '$x12', virtual-reg: '%8' }
+frameInfo:
+  maxAlignment:1
+machineFunctionInfo: {}
+body: |
+  ; CHECK-LABEL: name: redusum_loop
+  ; CHECK: bb.0.entry:
+  ; CHECK-NEXT:   successors: %bb.1(0x8000)
+  ; CHECK-NEXT:   liveins: $x10, $x12
+  ; CHECK-NEXT: {{  $}}
+  ; CHECK-NEXT:   [[COPY:%[0-9]+]]:gpr = COPY $x12
+  ; CHECK-NEXT:   [[COPY1:%[0-9]+]]:gpr = COPY $x10
+  ; CHECK-NEXT:   dead $x0 = PseudoVSETIVLI 4, 80, implicit-def $vl, 
implicit-def $vtype
+  ; CHECK-NEXT:   [[PseudoVMV_V_I_M1_:%[0-9]+]]:vr = PseudoVMV_V_I_M1 0, 4, 5, 
implicit $vl, implicit $vtype
+  ; CHECK-NEXT:   [[COPY2:%[0-9]+]]:vr = COPY [[PseudoVMV_V_I_M1_]]
+  ; CHECK-NEXT:   [[COPY3:%[0-9]+]]:vr = COPY [[COPY2]]
+  ; CHECK-NEXT:   [[LUI:%[0-9]+]]:gpr = LUI 1
+  ; CHECK-NEXT:   [[ADDIW:%[0-9]+]]:gpr = ADDIW killed [[LUI]], -2048
+  ; CHECK-NEXT: {{  $}}
+  ; CHECK-NEXT: bb.1.vector.body:
+  ; CHECK-NEXT:   successors: %bb.2(0x0400), %bb.1(0x7c00)
+  ; 

[llvm-branch-commits] [llvm] e22573a - Revert "[RISCV] Fix a vsetvli insertion bug involving loads/stores." and "[RISCC] Add missing words to comment. NFC"

2022-02-15 Thread Tom Stellard via llvm-branch-commits

Author: Craig Topper
Date: 2022-02-15T03:02:27-08:00
New Revision: e22573ab7b2ddd24699f5e645562cf50f0858e33

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

LOG: Revert "[RISCV] Fix a vsetvli insertion bug involving loads/stores." and 
"[RISCC] Add missing words to comment. NFC"

This reverts commit f943c58cae2480755cecdac5be832274f238df93.
and commit 7eb781072744b31a60e82b5a5903471032d4845f.

This introduced a new bug that appears to be easier to hit.

Differential Revision: https://reviews.llvm.org/D119517

(cherry picked from commit f35ac872b8224f771808a9ecd5c4da0fe307ac9c)

Added: 


Modified: 
llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp
llvm/test/CodeGen/RISCV/rvv/vsetvli-insert-crossbb.mir

Removed: 




diff  --git a/llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp 
b/llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp
index 649eb57b325bf..d39e0805a79c2 100644
--- a/llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp
+++ b/llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp
@@ -999,12 +999,6 @@ bool RISCVInsertVSETVLI::needVSETVLIPHI(const VSETVLIInfo 
&Require,
 
 void RISCVInsertVSETVLI::emitVSETVLIs(MachineBasicBlock &MBB) {
   VSETVLIInfo CurInfo;
-  // BBLocalInfo tracks the VL/VTYPE state the same way BBInfo.Change was
-  // calculated in computeIncomingVLVTYPE. We need this to apply
-  // canSkipVSETVLIForLoadStore the same way computeIncomingVLVTYPE did. We
-  // can't include predecessor information in that decision to avoid 
disagreeing
-  // with the global analysis.
-  VSETVLIInfo BBLocalInfo;
   // Only be set if current VSETVLIInfo is from an explicit VSET(I)VLI.
   MachineInstr *PrevVSETVLIMI = nullptr;
 
@@ -1020,7 +1014,6 @@ void RISCVInsertVSETVLI::emitVSETVLIs(MachineBasicBlock 
&MBB) {
   MI.getOperand(3).setIsDead(false);
   MI.getOperand(4).setIsDead(false);
   CurInfo = getInfoForVSETVLI(MI);
-  BBLocalInfo = getInfoForVSETVLI(MI);
   PrevVSETVLIMI = &MI;
   continue;
 }
@@ -1050,22 +1043,12 @@ void RISCVInsertVSETVLI::emitVSETVLIs(MachineBasicBlock 
&MBB) {
 // use the predecessor information.
 assert(BlockInfo[MBB.getNumber()].Pred.isValid() &&
"Expected a valid predecessor state.");
-// Don't use predecessor information if there was an earlier 
instruction
-// in this block that allowed a vsetvli to be skipped for load/store.
-if (!(BBLocalInfo.isValid() &&
-  canSkipVSETVLIForLoadStore(MI, NewInfo, BBLocalInfo)) &&
-needVSETVLI(NewInfo, BlockInfo[MBB.getNumber()].Pred) &&
+if (needVSETVLI(NewInfo, BlockInfo[MBB.getNumber()].Pred) &&
 needVSETVLIPHI(NewInfo, MBB)) {
   insertVSETVLI(MBB, MI, NewInfo, BlockInfo[MBB.getNumber()].Pred);
   CurInfo = NewInfo;
-  BBLocalInfo = NewInfo;
 }
-
-// We must update BBLocalInfo for every vector instruction.
-if (!BBLocalInfo.isValid())
-  BBLocalInfo = NewInfo;
   } else {
-assert(BBLocalInfo.isValid());
 // If this instruction isn't compatible with the previous VL/VTYPE
 // we need to insert a VSETVLI.
 // If this is a unit-stride or strided load/store, we may be able to 
use
@@ -1101,7 +1084,6 @@ void RISCVInsertVSETVLI::emitVSETVLIs(MachineBasicBlock 
&MBB) {
   if (NeedInsertVSETVLI)
 insertVSETVLI(MBB, MI, NewInfo, CurInfo);
   CurInfo = NewInfo;
-  BBLocalInfo = NewInfo;
 }
   }
   PrevVSETVLIMI = nullptr;
@@ -1112,7 +1094,6 @@ void RISCVInsertVSETVLI::emitVSETVLIs(MachineBasicBlock 
&MBB) {
 if (MI.isCall() || MI.isInlineAsm() || MI.modifiesRegister(RISCV::VL) ||
 MI.modifiesRegister(RISCV::VTYPE)) {
   CurInfo = VSETVLIInfo::getUnknown();
-  BBLocalInfo = VSETVLIInfo::getUnknown();
   PrevVSETVLIMI = nullptr;
 }
   }

diff  --git a/llvm/test/CodeGen/RISCV/rvv/vsetvli-insert-crossbb.mir 
b/llvm/test/CodeGen/RISCV/rvv/vsetvli-insert-crossbb.mir
index 70ac53052e05c..c96c6e5a3f4c4 100644
--- a/llvm/test/CodeGen/RISCV/rvv/vsetvli-insert-crossbb.mir
+++ b/llvm/test/CodeGen/RISCV/rvv/vsetvli-insert-crossbb.mir
@@ -592,6 +592,10 @@ body: |
   ; CHECK-NEXT:   [[PseudoVADD_VX_M1_:%[0-9]+]]:vr = PseudoVADD_VX_M1 
[[PseudoVID_V_M1_]], [[PHI]], -1, 6, implicit $vl, implicit $vtype
   ; CHECK-NEXT:   [[MUL:%[0-9]+]]:gpr = MUL [[PHI]], [[SRLI]]
   ; CHECK-NEXT:   [[ADD:%[0-9]+]]:gpr = ADD [[COPY]], [[MUL]]
+  ; FIXME: We insert a SEW=32,LMUL=1/2 VSETVLI here but no SEW=64,LMUL=1
+  ; VSETVLI before the VADD above. This misconfigures the VADD in the case that
+  ; the loop takes its backedge.
+  ; CHECK-NEXT:   dead $x0 = PseudoVSETVLIX0 killed $x0, 87, implicit-def $vl, 
implicit-def $vtype, implicit $vl
   ; CHECK-NEXT:   Pse

[llvm-branch-commits] [llvm] 3b54444 - [RISCV] Insert VSETVLI at the end of a basic block if we didn't produce BlockInfo.Exit.

2022-02-15 Thread Tom Stellard via llvm-branch-commits

Author: Craig Topper
Date: 2022-02-15T03:02:27-08:00
New Revision: 3b50f63157411d2bcf0e195329f7560a6991

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

LOG: [RISCV] Insert VSETVLI at the end of a basic block if we didn't produce 
BlockInfo.Exit.

This is an alternative to D118667 that instead of fixing the store
to match phase 1, it tries to detect the mismatch with the expected
value at the end of the block. This inserts a vsetvli after the vse
to satisfy the requirement of the other basic block.

We still have serious design issues in the pass, that is going to
require some rethinking.

Differential Revision: https://reviews.llvm.org/D119518

(cherry picked from commit 541c9ba842256023611e5a6c5f01e01c40688044)

Added: 


Modified: 
llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp
llvm/test/CodeGen/RISCV/rvv/vsetvli-insert-crossbb.mir

Removed: 




diff  --git a/llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp 
b/llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp
index d39e0805a79c2..6c4d2682bcd8c 100644
--- a/llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp
+++ b/llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp
@@ -334,6 +334,10 @@ class VSETVLIInfo {
 return false;
   }
 
+  bool operator!=(const VSETVLIInfo &Other) const {
+return !(*this == Other);
+  }
+
   // Calculate the VSETVLIInfo visible to a block assuming this and Other are
   // both predecessors.
   VSETVLIInfo intersect(const VSETVLIInfo &Other) const {
@@ -1096,6 +1100,17 @@ void RISCVInsertVSETVLI::emitVSETVLIs(MachineBasicBlock 
&MBB) {
   CurInfo = VSETVLIInfo::getUnknown();
   PrevVSETVLIMI = nullptr;
 }
+
+// If we reach the end of the block and our current info doesn't match the
+// expected info, insert a vsetvli to correct.
+if (MI.isTerminator()) {
+  const VSETVLIInfo &ExitInfo = BlockInfo[MBB.getNumber()].Exit;
+  if (CurInfo.isValid() && ExitInfo.isValid() && !ExitInfo.isUnknown() &&
+  CurInfo != ExitInfo) {
+insertVSETVLI(MBB, MI, ExitInfo, CurInfo);
+CurInfo = ExitInfo;
+  }
+}
   }
 }
 

diff  --git a/llvm/test/CodeGen/RISCV/rvv/vsetvli-insert-crossbb.mir 
b/llvm/test/CodeGen/RISCV/rvv/vsetvli-insert-crossbb.mir
index c96c6e5a3f4c4..1cb41692a8cc8 100644
--- a/llvm/test/CodeGen/RISCV/rvv/vsetvli-insert-crossbb.mir
+++ b/llvm/test/CodeGen/RISCV/rvv/vsetvli-insert-crossbb.mir
@@ -592,12 +592,10 @@ body: |
   ; CHECK-NEXT:   [[PseudoVADD_VX_M1_:%[0-9]+]]:vr = PseudoVADD_VX_M1 
[[PseudoVID_V_M1_]], [[PHI]], -1, 6, implicit $vl, implicit $vtype
   ; CHECK-NEXT:   [[MUL:%[0-9]+]]:gpr = MUL [[PHI]], [[SRLI]]
   ; CHECK-NEXT:   [[ADD:%[0-9]+]]:gpr = ADD [[COPY]], [[MUL]]
-  ; FIXME: We insert a SEW=32,LMUL=1/2 VSETVLI here but no SEW=64,LMUL=1
-  ; VSETVLI before the VADD above. This misconfigures the VADD in the case that
-  ; the loop takes its backedge.
   ; CHECK-NEXT:   dead $x0 = PseudoVSETVLIX0 killed $x0, 87, implicit-def $vl, 
implicit-def $vtype, implicit $vl
   ; CHECK-NEXT:   PseudoVSE32_V_MF2 killed [[PseudoVADD_VX_M1_]], killed 
[[ADD]], -1, 5, implicit $vl, implicit $vtype
   ; CHECK-NEXT:   [[ADDI:%[0-9]+]]:gpr = ADDI [[PHI]], 1
+  ; CHECK-NEXT:   dead $x0 = PseudoVSETVLIX0 killed $x0, 88, implicit-def $vl, 
implicit-def $vtype, implicit $vl
   ; CHECK-NEXT:   BLTU [[ADDI]], [[COPY1]], %bb.1
   ; CHECK-NEXT:   PseudoBR %bb.2
   ; CHECK-NEXT: {{  $}}



___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [lldb] 89fb25f - [lldb] [Commands] Implement "thread siginfo"

2022-02-15 Thread Tom Stellard via llvm-branch-commits

Author: Michał Górny
Date: 2022-02-15T03:02:28-08:00
New Revision: 89fb25f481a5c829498c408bad54c8640ccc6233

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

LOG: [lldb] [Commands] Implement "thread siginfo"

Differential Revision: https://reviews.llvm.org/D118473

(cherry picked from commit 287ce6b51675aee43870bebfff68bb144d1ab90e)

Added: 
lldb/test/Shell/Commands/Inputs/sigchld.c
lldb/test/Shell/Commands/command-thread-siginfo.test

Modified: 
lldb/source/Commands/CommandObjectThread.cpp

Removed: 




diff  --git a/lldb/source/Commands/CommandObjectThread.cpp 
b/lldb/source/Commands/CommandObjectThread.cpp
index 137aaa81c61a0..f6042937a4ff1 100644
--- a/lldb/source/Commands/CommandObjectThread.cpp
+++ b/lldb/source/Commands/CommandObjectThread.cpp
@@ -1320,6 +1320,53 @@ class CommandObjectThreadException : public 
CommandObjectIterateOverThreads {
   }
 };
 
+class CommandObjectThreadSiginfo : public CommandObjectIterateOverThreads {
+public:
+  CommandObjectThreadSiginfo(CommandInterpreter &interpreter)
+  : CommandObjectIterateOverThreads(
+interpreter, "thread siginfo",
+"Display the current siginfo object for a thread. Defaults to "
+"the current thread.",
+"thread siginfo",
+eCommandRequiresProcess | eCommandTryTargetAPILock |
+eCommandProcessMustBeLaunched | eCommandProcessMustBePaused) {}
+
+  ~CommandObjectThreadSiginfo() override = default;
+
+  void
+  HandleArgumentCompletion(CompletionRequest &request,
+   OptionElementVector &opt_element_vector) override {
+CommandCompletions::InvokeCommonCompletionCallbacks(
+GetCommandInterpreter(), CommandCompletions::eThreadIndexCompletion,
+request, nullptr);
+  }
+
+  bool HandleOneThread(lldb::tid_t tid, CommandReturnObject &result) override {
+ThreadSP thread_sp =
+m_exe_ctx.GetProcessPtr()->GetThreadList().FindThreadByID(tid);
+if (!thread_sp) {
+  result.AppendErrorWithFormat("thread no longer exists: 0x%" PRIx64 "\n",
+   tid);
+  return false;
+}
+
+Stream &strm = result.GetOutputStream();
+if (!thread_sp->GetDescription(strm, eDescriptionLevelFull, false, false)) 
{
+  result.AppendErrorWithFormat("error displaying info for thread: 
\"%d\"\n",
+   thread_sp->GetIndexID());
+  return false;
+}
+ValueObjectSP exception_object_sp = thread_sp->GetSiginfoValue();
+if (exception_object_sp)
+  exception_object_sp->Dump(strm);
+else
+  strm.Printf("(no siginfo)\n");
+strm.PutChar('\n');
+
+return true;
+  }
+};
+
 // CommandObjectThreadReturn
 #define LLDB_OPTIONS_thread_return
 #include "CommandOptions.inc"
@@ -2293,6 +2340,8 @@ 
CommandObjectMultiwordThread::CommandObjectMultiwordThread(
  CommandObjectSP(new CommandObjectThreadInfo(interpreter)));
   LoadSubCommand("exception", CommandObjectSP(new CommandObjectThreadException(
   interpreter)));
+  LoadSubCommand("siginfo",
+ CommandObjectSP(new CommandObjectThreadSiginfo(interpreter)));
   LoadSubCommand("step-in",
  CommandObjectSP(new CommandObjectThreadStepWithTypeAndScope(
  interpreter, "thread step-in",

diff  --git a/lldb/test/Shell/Commands/Inputs/sigchld.c 
b/lldb/test/Shell/Commands/Inputs/sigchld.c
new file mode 100644
index 0..ba8c5ef45365b
--- /dev/null
+++ b/lldb/test/Shell/Commands/Inputs/sigchld.c
@@ -0,0 +1,31 @@
+#include 
+#include 
+#include 
+#include 
+#include 
+
+void handler(int signo) {
+  printf("SIGCHLD\n");
+}
+
+int main() {
+  void *ret = signal(SIGINT, handler);
+  assert (ret != SIG_ERR);
+
+  pid_t child_pid = fork();
+  assert (child_pid != -1);
+
+  if (child_pid == 0) {
+sleep(1);
+_exit(14);
+  }
+
+  printf("signo = %d\n", SIGCHLD);
+  printf("code = %d\n", CLD_EXITED);
+  printf("child_pid = %d\n", child_pid);
+  printf("uid = %d\n", getuid());
+  pid_t waited = wait(NULL);
+  assert(waited == child_pid);
+
+  return 0;
+}

diff  --git a/lldb/test/Shell/Commands/command-thread-siginfo.test 
b/lldb/test/Shell/Commands/command-thread-siginfo.test
new file mode 100644
index 0..92829f3dcb0c4
--- /dev/null
+++ b/lldb/test/Shell/Commands/command-thread-siginfo.test
@@ -0,0 +1,19 @@
+# REQUIRES: system-linux
+# RUN: %clang_host -g %S/Inputs/sigchld.c -o %t
+# RUN: %lldb %t -b -s %s | FileCheck %s
+
+process launch -s
+process handle SIGCHLD -s true
+process continue
+# CHECK: signo = [[SIGNO:[0-9]+]]
+# CHECK: code = [[CODE:[0-9]+]]
+# CHECK: child_pid = [[PID:[0-9]+]]
+# CHECK: uid = [[UID:[0-9]+]]
+# CHECK: stop reason = signal SIGCHLD
+threa

[llvm-branch-commits] [llvm] 2eed911 - Revert "[RISCV] Enable shrink wrap by default"

2022-02-15 Thread Tom Stellard via llvm-branch-commits

Author: Dimitry Andric
Date: 2022-02-15T03:25:33-08:00
New Revision: 2eed91114f3276bacfe14f98ff49f4bb6494dd3b

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

LOG: Revert "[RISCV] Enable shrink wrap by default"

This reverts commit 5ebdb07e7eb366c20fa2d914e07a4d380975f266.

Enabling shrink wrap by default can cause assertions or crashes, and
these should first be investigated and fixed. For now, reverting the
change so it can be cherry-picked into 14.0.0 is the safest choice.

(cherry picked from commit 7af3d4ab3d5da07256e1a7a0438e7308e14b9fd5)

Added: 


Modified: 
llvm/lib/Target/RISCV/RISCVFrameLowering.cpp
llvm/lib/Target/RISCV/RISCVFrameLowering.h
llvm/test/CodeGen/RISCV/ctlz-cttz-ctpop.ll
llvm/test/CodeGen/RISCV/double-br-fcmp.ll
llvm/test/CodeGen/RISCV/double-stack-spill-restore.ll
llvm/test/CodeGen/RISCV/float-br-fcmp.ll
llvm/test/CodeGen/RISCV/frame-info.ll
llvm/test/CodeGen/RISCV/half-br-fcmp.ll
llvm/test/CodeGen/RISCV/rv32zbb.ll
llvm/test/CodeGen/RISCV/rv64zbb.ll
llvm/test/CodeGen/RISCV/shrinkwrap.ll

Removed: 




diff  --git a/llvm/lib/Target/RISCV/RISCVFrameLowering.cpp 
b/llvm/lib/Target/RISCV/RISCVFrameLowering.cpp
index ad003404d793e..f3cc7d3fb46fa 100644
--- a/llvm/lib/Target/RISCV/RISCVFrameLowering.cpp
+++ b/llvm/lib/Target/RISCV/RISCVFrameLowering.cpp
@@ -1116,14 +1116,6 @@ bool RISCVFrameLowering::restoreCalleeSavedRegisters(
   return true;
 }
 
-bool RISCVFrameLowering::enableShrinkWrapping(const MachineFunction &MF) const 
{
-  // Keep the conventional code flow when not optimizing.
-  if (MF.getFunction().hasOptNone())
-return false;
-
-  return true;
-}
-
 bool RISCVFrameLowering::canUseAsPrologue(const MachineBasicBlock &MBB) const {
   MachineBasicBlock *TmpMBB = const_cast(&MBB);
   const MachineFunction *MF = MBB.getParent();

diff  --git a/llvm/lib/Target/RISCV/RISCVFrameLowering.h 
b/llvm/lib/Target/RISCV/RISCVFrameLowering.h
index 1e94e34acf2f1..bc3ace786272d 100644
--- a/llvm/lib/Target/RISCV/RISCVFrameLowering.h
+++ b/llvm/lib/Target/RISCV/RISCVFrameLowering.h
@@ -65,8 +65,6 @@ class RISCVFrameLowering : public TargetFrameLowering {
   bool canUseAsPrologue(const MachineBasicBlock &MBB) const override;
   bool canUseAsEpilogue(const MachineBasicBlock &MBB) const override;
 
-  bool enableShrinkWrapping(const MachineFunction &MF) const override;
-
   bool isSupportedStackID(TargetStackID::Value ID) const override;
   TargetStackID::Value getStackIDForScalableVectors() const override;
 

diff  --git a/llvm/test/CodeGen/RISCV/ctlz-cttz-ctpop.ll 
b/llvm/test/CodeGen/RISCV/ctlz-cttz-ctpop.ll
index 89592c6ecbb29..d5de71d7e42db 100644
--- a/llvm/test/CodeGen/RISCV/ctlz-cttz-ctpop.ll
+++ b/llvm/test/CodeGen/RISCV/ctlz-cttz-ctpop.ll
@@ -167,10 +167,10 @@ define i16 @test_cttz_i16(i16 %a) nounwind {
 define i32 @test_cttz_i32(i32 %a) nounwind {
 ; RV32I-LABEL: test_cttz_i32:
 ; RV32I:   # %bb.0:
-; RV32I-NEXT:beqz a0, .LBB2_2
-; RV32I-NEXT:  # %bb.1: # %cond.false
 ; RV32I-NEXT:addi sp, sp, -16
 ; RV32I-NEXT:sw ra, 12(sp) # 4-byte Folded Spill
+; RV32I-NEXT:beqz a0, .LBB2_2
+; RV32I-NEXT:  # %bb.1: # %cond.false
 ; RV32I-NEXT:addi a1, a0, -1
 ; RV32I-NEXT:not a0, a0
 ; RV32I-NEXT:and a0, a0, a1
@@ -194,20 +194,21 @@ define i32 @test_cttz_i32(i32 %a) nounwind {
 ; RV32I-NEXT:addi a1, a1, 257
 ; RV32I-NEXT:call __mulsi3@plt
 ; RV32I-NEXT:srli a0, a0, 24
-; RV32I-NEXT:lw ra, 12(sp) # 4-byte Folded Reload
-; RV32I-NEXT:addi sp, sp, 16
-; RV32I-NEXT:ret
+; RV32I-NEXT:j .LBB2_3
 ; RV32I-NEXT:  .LBB2_2:
 ; RV32I-NEXT:li a0, 32
+; RV32I-NEXT:  .LBB2_3: # %cond.end
+; RV32I-NEXT:lw ra, 12(sp) # 4-byte Folded Reload
+; RV32I-NEXT:addi sp, sp, 16
 ; RV32I-NEXT:ret
 ;
 ; RV64I-LABEL: test_cttz_i32:
 ; RV64I:   # %bb.0:
+; RV64I-NEXT:addi sp, sp, -16
+; RV64I-NEXT:sd ra, 8(sp) # 8-byte Folded Spill
 ; RV64I-NEXT:sext.w a1, a0
 ; RV64I-NEXT:beqz a1, .LBB2_2
 ; RV64I-NEXT:  # %bb.1: # %cond.false
-; RV64I-NEXT:addi sp, sp, -16
-; RV64I-NEXT:sd ra, 8(sp) # 8-byte Folded Spill
 ; RV64I-NEXT:addiw a1, a0, -1
 ; RV64I-NEXT:not a0, a0
 ; RV64I-NEXT:and a0, a0, a1
@@ -231,11 +232,12 @@ define i32 @test_cttz_i32(i32 %a) nounwind {
 ; RV64I-NEXT:addiw a1, a1, 257
 ; RV64I-NEXT:call __muldi3@plt
 ; RV64I-NEXT:srliw a0, a0, 24
-; RV64I-NEXT:ld ra, 8(sp) # 8-byte Folded Reload
-; RV64I-NEXT:addi sp, sp, 16
-; RV64I-NEXT:ret
+; RV64I-NEXT:j .LBB2_3
 ; RV64I-NEXT:  .LBB2_2:
 ; RV64I-NEXT:li a0, 32
+; RV64I-NEXT:  .LBB2_3: # %cond.end
+; RV64I-NEXT:ld ra, 8(sp) # 8-byte Folded Reload
+; RV64I-NEXT:addi sp, sp, 16
 ; RV64I-NEXT:ret
 ;
 ; RV32ZBB-LABEL: test_cttz_i32:
@@ -254,10 +2

[llvm-branch-commits] [llvm] 6029d33 - Exit reads.

2022-02-15 Thread Florian Hahn via llvm-branch-commits

Author: Florian Hahn
Date: 2022-02-15T15:10:07Z
New Revision: 6029d33b407191aa1341ca0ce855523e7c2d6409

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

LOG: Exit reads.

Added: 


Modified: 
llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp

Removed: 




diff  --git a/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp 
b/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
index 8739ddce91606..d75f6f2d97e38 100644
--- a/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
+++ b/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
@@ -100,9 +100,6 @@ STATISTIC(NumFastStores, "Number of stores deleted");
 STATISTIC(NumFastOther, "Number of other instrs removed");
 STATISTIC(NumCompletePartials, "Number of stores dead by later partials");
 STATISTIC(NumModifiedStores, "Number of stores modified");
-STATISTIC(NumCFGChecks, "Number of stores modified");
-STATISTIC(NumCFGTries, "Number of stores modified");
-STATISTIC(NumCFGSuccess, "Number of stores modified");
 STATISTIC(NumGetDomMemoryDefPassed,
   "Number of times a valid candidate is returned from 
getDomMemoryDef");
 STATISTIC(NumDomMemDefChecks,
@@ -763,6 +760,9 @@ struct DSEState {
   DenseMap InvisibleToCallerAfterRet;
   // Keep track of blocks with throwing instructions not modeled in MemorySSA.
   SmallPtrSet ThrowingBlocks;
+
+  SmallPtrSet ExitReads;
+
   // Post-order numbers for each basic block. Used to figure out if memory
   // accesses are executed before another access.
   DenseMap PostOrderNumbers;
@@ -771,6 +771,8 @@ struct DSEState {
   /// basic block.
   MapVector IOLs;
 
+  MemorySSAUpdater Updater;
+
   // Class contains self-reference, make sure it's not copied/moved.
   DSEState(const DSEState &) = delete;
   DSEState &operator=(const DSEState &) = delete;
@@ -779,7 +781,8 @@ struct DSEState {
PostDominatorTree &PDT, const TargetLibraryInfo &TLI,
const LoopInfo &LI)
   : F(F), AA(AA), EI(DT, LI), BatchAA(AA, &EI), MSSA(MSSA), DT(DT),
-PDT(PDT), TLI(TLI), DL(F.getParent()->getDataLayout()), LI(LI) {
+PDT(PDT), TLI(TLI), DL(F.getParent()->getDataLayout()), LI(LI),
+Updater(&MSSA) {
 // Collect blocks with throwing instructions not modeled in MemorySSA and
 // alloc-like objects.
 unsigned PO = 0;
@@ -805,6 +808,23 @@ struct DSEState {
 
 // Collect whether there is any irreducible control flow in the function.
 ContainsIrreducibleLoops = mayContainIrreducibleControl(F, &LI);
+
+LLVMContext &Ctx = F.getContext();
+Type *I8Ty = IntegerType::get(Ctx, 8);
+
+GlobalVariable *Ext = nullptr;
+for (BasicBlock *E : PDT.roots()) {
+  if (!Ext)
+Ext = new GlobalVariable(
+*F.getParent(), I8Ty, false, GlobalValue::ExternalLinkage, nullptr,
+"", nullptr, GlobalValue::NotThreadLocal, None, true);
+  auto *Term = E->getTerminator();
+  auto *LI = new LoadInst(I8Ty, Ext, "", Term);
+  auto *MemUse = cast(
+  Updater.createMemoryAccessInBB(LI, nullptr, E, MemorySSA::End));
+  Updater.insertUse(MemUse);
+  ExitReads.insert(LI);
+}
   }
 
   /// Return 'OW_Complete' if a store to the 'KillingLoc' location (by \p
@@ -1150,7 +1170,10 @@ struct DSEState {
 if (auto *CB = dyn_cast(UseInst))
   if (CB->onlyAccessesInaccessibleMemory())
 return false;
-
+auto *LI = dyn_cast(UseInst);
+if (LI && ExitReads.count(LI)) {
+  return !isInvisibleToCallerAfterRet(getUnderlyingObject(DefLoc.Ptr));
+}
 return isRefSet(BatchAA.getModRefInfo(UseInst, DefLoc));
   }
 
@@ -1289,6 +1312,7 @@ struct DSEState {
   if (any_of(Current->uses(), [this, &KillingLoc, StartAccess](Use &U) {
 if (auto *UseOrDef = dyn_cast(U.getUser()))
   return !MSSA.dominates(StartAccess, UseOrDef) &&
+ !ExitReads.count(UseOrDef->getMemoryInst()) &&
  isReadClobber(KillingLoc, UseOrDef->getMemoryInst());
 return false;
   })) {
@@ -1490,69 +1514,6 @@ struct DSEState {
   }
 }
 
-// For accesses to locations visible after the function returns, make sure
-// that the location is dead (=overwritten) along all paths from
-// MaybeDeadAccess to the exit.
-if (!isInvisibleToCallerAfterRet(KillingUndObj)) {
-  SmallPtrSet KillingBlocks;
-  for (Instruction *KD : KillingDefs)
-KillingBlocks.insert(KD->getParent());
-  assert(!KillingBlocks.empty() &&
- "Expected at least a single killing block");
-
-  // Find the common post-dominator of all killing blocks.
-  BasicBlock *CommonPred = *KillingBlocks.begin();
-  for (BasicBlock *BB : llvm::drop_begin(KillingBlocks)) {
-if (!CommonPred)
-  break;
-CommonP

[llvm-branch-commits] [libcxx] 6277e34 - [libc++] Disable back-deployment CI on the release branch

2022-02-15 Thread Louis Dionne via llvm-branch-commits

Author: Louis Dionne
Date: 2022-02-15T11:51:11-05:00
New Revision: 6277e34840ebd7cab1e856ec56b90b995655c493

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

LOG: [libc++] Disable back-deployment CI on the release branch

As explained in the comment, we don't have macOS 10.15 builders anymore
in the fleet. Enabling those tests on the release branch would require
cherry-picking too many changes from `main`.

Added: 


Modified: 
libcxx/utils/ci/buildkite-pipeline.yml

Removed: 




diff  --git a/libcxx/utils/ci/buildkite-pipeline.yml 
b/libcxx/utils/ci/buildkite-pipeline.yml
index c5c56bb997dfd..6b5137bf30e70 100644
--- a/libcxx/utils/ci/buildkite-pipeline.yml
+++ b/libcxx/utils/ci/buildkite-pipeline.yml
@@ -598,34 +598,37 @@ steps:
   limit: 2
 timeout_in_minutes: 120
 
-  # Test back-deployment to older Apple platforms
-  - label: "Apple back-deployment macosx10.9"
-command: "libcxx/utils/ci/run-buildbot apple-system-backdeployment-10.9"
-artifact_paths:
-  - "**/test-results.xml"
-agents:
-  queue: "libcxx-builders"
-  os: "macos10.15" # TODO: For now, we're running the back-deployment 
tests for 10.9 on 10.15, because we don't have proper 10.9 machines
-  arch: "x86_64"
-retry:
-  automatic:
-- exit_status: -1  # Agent was lost
-  limit: 2
-timeout_in_minutes: 120
-
-  - label: "Apple back-deployment macosx10.15"
-command: "libcxx/utils/ci/run-buildbot apple-system-backdeployment-10.15"
-artifact_paths:
-  - "**/test-results.xml"
-agents:
-  queue: "libcxx-builders"
-  os: "macos10.15"
-  arch: "x86_64"
-retry:
-  automatic:
-- exit_status: -1  # Agent was lost
-  limit: 2
-timeout_in_minutes: 120
+  # Those are disabled on the release/14.x branch because we don't have macOS 
10.15 builders anymore
+  # in the fleet. Enabling those tests on the release branch would require 
cherry-picking too many
+  # changes from `main`.
+  # # Test back-deployment to older Apple platforms
+  # - label: "Apple back-deployment macosx10.9"
+  #   command: "libcxx/utils/ci/run-buildbot apple-system-backdeployment-10.9"
+  #   artifact_paths:
+  # - "**/test-results.xml"
+  #   agents:
+  # queue: "libcxx-builders"
+  # os: "macos10.15" # TODO: For now, we're running the back-deployment 
tests for 10.9 on 10.15, because we don't have proper 10.9 machines
+  # arch: "x86_64"
+  #   retry:
+  # automatic:
+  #   - exit_status: -1  # Agent was lost
+  # limit: 2
+  #   timeout_in_minutes: 120
+
+  # - label: "Apple back-deployment macosx10.15"
+  #   command: "libcxx/utils/ci/run-buildbot apple-system-backdeployment-10.15"
+  #   artifact_paths:
+  # - "**/test-results.xml"
+  #   agents:
+  # queue: "libcxx-builders"
+  # os: "macos10.15"
+  # arch: "x86_64"
+  #   retry:
+  # automatic:
+  #   - exit_status: -1  # Agent was lost
+  # limit: 2
+  #   timeout_in_minutes: 120
 
   - label: "AArch64"
 command: "libcxx/utils/ci/run-buildbot aarch64"



___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] b2ca48a - ReleaseNotes: add notes for binary utilities

2022-02-15 Thread Fangrui Song via llvm-branch-commits

Author: Fangrui Song
Date: 2022-02-15T09:18:48-08:00
New Revision: b2ca48a8412270e323ac8441772d0d69190a8417

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

LOG: ReleaseNotes: add notes for binary utilities

For the release/14.x branch.

Reviewed By: alexander-shaposhnikov, jhenderson

Differential Revision: https://reviews.llvm.org/D119611

Added: 


Modified: 
llvm/docs/ReleaseNotes.rst

Removed: 




diff  --git a/llvm/docs/ReleaseNotes.rst b/llvm/docs/ReleaseNotes.rst
index 32536eae9e54..e67eb4b39ddf 100644
--- a/llvm/docs/ReleaseNotes.rst
+++ b/llvm/docs/ReleaseNotes.rst
@@ -191,7 +191,39 @@ Changes to the LLVM tools
   `-name-whitelist` is marked as deprecated and to be removed in future
   releases.
 
+* llvm-ar now supports ``--thin`` for creating a thin archive. The modifier
+  ``T`` has a 
diff erent meaning in some ar implementations.
+  (`D116979 `_)
+* llvm-ar now supports reading big archives for XCOFF.
+  (`D111889 `_)
+* llvm-nm now demangles Rust symbols.
+  (`D111937 `_)
+* llvm-objcopy's ELF port now avoids reordering section headers to preserve 
``st_shndx`` fields of dynamic symbols.
+  (`D107653 `_)
+* llvm-objcopy now supports ``--update-section`` for ELF and Mach-O.
+  (`D112116 `_)
+  (`D117281 `_)
+* llvm-objcopy now supports ``--subsystem`` for PE/COFF.
+  (`D116556 `_)
+* llvm-objcopy now supports mips64le relocations for ELF.
+  (`D115635 `_)
+* llvm-objcopy ``--rename-section`` now renames relocation sections together 
with their targets.
+  (`D110352 `_)
+* llvm-objdump ``--symbolize-operands`` now supports PowerPC.
+  (`D114492 `_)
+* llvm-objdump ``-p`` now dumps PE header.
+  (`D113356 `_)
+* llvm-objdump ``-R`` now supports ELF position-dependent executables.
+  (`D110595 `_)
+* llvm-objdump ``-T`` now prints symbol versions.
+  (`D108097 `_)
 * llvm-readobj: Improved printing of symbols in Windows unwind data.
+* llvm-readobj now supports ``--elf-output-style=JSON`` for JSON output and
+  ``--pretty-print`` for pretty printing of this output.
+  (`D114225 `_)
+* llvm-readobj now supports several dump styles (``--needed-libs, --relocs, 
--syms``) for XCOFF.
+* llvm-symbolizer now supports `--debuginfod 
`.
+  (`D113717 `_)
 
 Changes to LLDB
 -



___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] 062111f - InferAddressSpaces: Fix assert on inferred source for inttoptr/ptrtoint

2022-02-15 Thread Tom Stellard via llvm-branch-commits

Author: Matt Arsenault
Date: 2022-02-15T10:42:16-08:00
New Revision: 062111fe8073de55c0f00fe04847e986781d1cad

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

LOG: InferAddressSpaces: Fix assert on inferred source for inttoptr/ptrtoint

If we had some source value we could infer an address space from that
went through a ptrtoint/inttoptr pair, this would fail since bitcast
can't change the address space.

Fixes issue 53665.

(cherry picked from commit 52fbb786a638ecc7349641b45b62a5abafffdf75)

Added: 
llvm/test/Transforms/InferAddressSpaces/AMDGPU/issue53665.ll

Modified: 
llvm/lib/Transforms/Scalar/InferAddressSpaces.cpp

Removed: 




diff  --git a/llvm/lib/Transforms/Scalar/InferAddressSpaces.cpp 
b/llvm/lib/Transforms/Scalar/InferAddressSpaces.cpp
index 8f5933b7bd71a..ddc747a2ca297 100644
--- a/llvm/lib/Transforms/Scalar/InferAddressSpaces.cpp
+++ b/llvm/lib/Transforms/Scalar/InferAddressSpaces.cpp
@@ -655,10 +655,13 @@ Value 
*InferAddressSpacesImpl::cloneInstructionWithNewAddressSpace(
   case Instruction::IntToPtr: {
 assert(isNoopPtrIntCastPair(cast(I), *DL, TTI));
 Value *Src = cast(I->getOperand(0))->getOperand(0);
-assert(Src->getType()->getPointerAddressSpace() == NewAddrSpace);
-if (Src->getType() != NewPtrType)
-  return new BitCastInst(Src, NewPtrType);
-return Src;
+if (Src->getType() == NewPtrType)
+  return Src;
+
+// If we had a no-op inttoptr/ptrtoint pair, we may still have inferred a
+// source address space from a generic pointer source need to insert a cast
+// back.
+return CastInst::CreatePointerBitCastOrAddrSpaceCast(Src, NewPtrType);
   }
   default:
 llvm_unreachable("Unexpected opcode");

diff  --git a/llvm/test/Transforms/InferAddressSpaces/AMDGPU/issue53665.ll 
b/llvm/test/Transforms/InferAddressSpaces/AMDGPU/issue53665.ll
new file mode 100644
index 0..fcc1f56affbb6
--- /dev/null
+++ b/llvm/test/Transforms/InferAddressSpaces/AMDGPU/issue53665.ll
@@ -0,0 +1,54 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
+; RUN: opt -S -mtriple=amdgcn-amd-amdhsa -infer-address-spaces -o - %s | 
FileCheck %s
+; https://github.com/llvm/llvm-project/issues/53665
+
+define i32 @addrspacecast_ptrtoint_inttoptr(i8 addrspace(1)* %arg) {
+; CHECK-LABEL: @addrspacecast_ptrtoint_inttoptr(
+; CHECK-NEXT:  bb:
+; CHECK-NEXT:[[TMP0:%.*]] = bitcast i8 addrspace(1)* [[ARG:%.*]] to i32 
addrspace(1)*
+; CHECK-NEXT:[[LOAD:%.*]] = load i32, i32 addrspace(1)* [[TMP0]], align 4
+; CHECK-NEXT:ret i32 [[LOAD]]
+;
+bb:
+  %asc = addrspacecast i8 addrspace(1)* %arg to i8*
+  %p2i = ptrtoint i8* %asc to i64
+  %i2p = inttoptr i64 %p2i to i32*
+  %load = load i32, i32* %i2p
+  ret i32 %load
+}
+
+define i32 @assumed_ptrtoint_inttoptr(i8* %arg) {
+bb:
+  %is.priv = call i1 @llvm.amdgcn.is.private(i8* %arg)
+  %not.is.priv = xor i1 %is.priv, -1
+  %is.shared = call i1 @llvm.amdgcn.is.shared(i8* %arg)
+  %not.is.shared = xor i1 %is.shared, -1
+  %and = and i1 %not.is.priv, %not.is.shared
+  tail call void @llvm.assume(i1 %and)
+  %p2i = ptrtoint i8* %arg to i64
+  %i2p = inttoptr i64 %p2i to i32*
+  %load = load i32, i32* %i2p
+  ret i32 %load
+}
+
+define i32 @addrspacecast_ptrtoint_inttptr_nontrivial(i8 addrspace(3)* %arg) {
+; CHECK-LABEL: @addrspacecast_ptrtoint_inttptr_nontrivial(
+; CHECK-NEXT:  bb:
+; CHECK-NEXT:[[TMP0:%.*]] = bitcast i8 addrspace(3)* [[ARG:%.*]] to i32 
addrspace(3)*
+; CHECK-NEXT:[[LOAD:%.*]] = load i32, i32 addrspace(3)* [[TMP0]], align 4
+; CHECK-NEXT:ret i32 [[LOAD]]
+;
+bb:
+  %asc = addrspacecast i8 addrspace(3)* %arg to i8*
+  %p2i = ptrtoint i8* %asc to i64
+  %i2p = inttoptr i64 %p2i to i32*
+  %load = load i32, i32* %i2p
+  ret i32 %load
+}
+
+declare void @llvm.assume(i1 noundef) #0
+declare i1 @llvm.amdgcn.is.shared(i8* nocapture) #1
+declare i1 @llvm.amdgcn.is.private(i8* nocapture) #1
+
+attributes #0 = { inaccessiblememonly nofree nosync nounwind willreturn }
+attributes #1 = { nounwind readnone speculatable willreturn }



___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] ea97fc6 - [OpenMP][FIX] The `llvm.amdgcn.s.barrier` is actually not aligned

2022-02-15 Thread Tom Stellard via llvm-branch-commits

Author: Johannes Doerfert
Date: 2022-02-15T10:42:40-08:00
New Revision: ea97fc6b564ec6a843337a550a2209b653cffceb

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

LOG: [OpenMP][FIX] The `llvm.amdgcn.s.barrier` is actually not aligned

If we assume `llvm.amdgcn.s.barrier` is aligned we may remove it and
cause OpenMP GPU applications on the AMD GPU to be stuck or wrongly
synchronized.

Reported by Carlo Bertolli.

(cherry picked from commit ede248e614bb2c232b7b1815829eb3d5c1aab1e4)

Added: 


Modified: 
llvm/lib/Transforms/IPO/OpenMPOpt.cpp
llvm/test/Transforms/OpenMP/barrier_removal.ll

Removed: 




diff  --git a/llvm/lib/Transforms/IPO/OpenMPOpt.cpp 
b/llvm/lib/Transforms/IPO/OpenMPOpt.cpp
index 2d765fb6ce6d0..520b6ebf9e74f 100644
--- a/llvm/lib/Transforms/IPO/OpenMPOpt.cpp
+++ b/llvm/lib/Transforms/IPO/OpenMPOpt.cpp
@@ -1458,7 +1458,6 @@ struct OpenMPOpt {
 case Intrinsic::nvvm_barrier0_and:
 case Intrinsic::nvvm_barrier0_or:
 case Intrinsic::nvvm_barrier0_popc:
-case Intrinsic::amdgcn_s_barrier:
   return true;
 default:
   break;

diff  --git a/llvm/test/Transforms/OpenMP/barrier_removal.ll 
b/llvm/test/Transforms/OpenMP/barrier_removal.ll
index 8c7cca8053e93..7de421f728f10 100644
--- a/llvm/test/Transforms/OpenMP/barrier_removal.ll
+++ b/llvm/test/Transforms/OpenMP/barrier_removal.ll
@@ -66,8 +66,9 @@ define void @pos_empty_6() {
   call i32 @llvm.nvvm.barrier0.popc(i32 0)
   ret void
 }
-define void @pos_empty_7() {
-; CHECK-LABEL: define {{[^@]+}}@pos_empty_7() {
+define void @neg_empty_7() {
+; CHECK-LABEL: define {{[^@]+}}@neg_empty_7() {
+; CHECK-NEXT:call void @llvm.amdgcn.s.barrier()
 ; CHECK-NEXT:ret void
 ;
   call void @llvm.amdgcn.s.barrier()
@@ -211,6 +212,7 @@ define void @neg_mem() {
 
 define void @pos_multiple() {
 ; CHECK-LABEL: define {{[^@]+}}@pos_multiple() {
+; CHECK-NEXT:call void @llvm.amdgcn.s.barrier()
 ; CHECK-NEXT:ret void
 ;
   call void @llvm.nvvm.barrier0()
@@ -233,7 +235,7 @@ define void @pos_multiple() {
 !3 = !{void ()* @pos_empty_4, !"kernel", i32 1}
 !4 = !{void ()* @pos_empty_5, !"kernel", i32 1}
 !5 = !{void ()* @pos_empty_6, !"kernel", i32 1}
-!6 = !{void ()* @pos_empty_7, !"kernel", i32 1}
+!6 = !{void ()* @neg_empty_7, !"kernel", i32 1}
 !7 = !{void ()* @pos_constant_loads, !"kernel", i32 1}
 !8 = !{void ()* @neg_loads, !"kernel", i32 1}
 !9 = !{void ()* @pos_priv_mem, !"kernel", i32 1}
@@ -254,7 +256,7 @@ define void @pos_multiple() {
 ; CHECK: [[META5:![0-9]+]] = !{void ()* @pos_empty_4, !"kernel", i32 1}
 ; CHECK: [[META6:![0-9]+]] = !{void ()* @pos_empty_5, !"kernel", i32 1}
 ; CHECK: [[META7:![0-9]+]] = !{void ()* @pos_empty_6, !"kernel", i32 1}
-; CHECK: [[META8:![0-9]+]] = !{void ()* @pos_empty_7, !"kernel", i32 1}
+; CHECK: [[META8:![0-9]+]] = !{void ()* @neg_empty_7, !"kernel", i32 1}
 ; CHECK: [[META9:![0-9]+]] = !{void ()* @pos_constant_loads, !"kernel", i32 1}
 ; CHECK: [[META10:![0-9]+]] = !{void ()* @neg_loads, !"kernel", i32 1}
 ; CHECK: [[META11:![0-9]+]] = !{void ()* @pos_priv_mem, !"kernel", i32 1}



___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [lld] e493f08 - [lld-macho] Fill out release notes for 14.x

2022-02-15 Thread Jez Ng via llvm-branch-commits

Author: Jez Ng
Date: 2022-02-15T14:21:01-05:00
New Revision: e493f08f8222b3a36186331a0d5486b4407ed830

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

LOG: [lld-macho] Fill out release notes for 14.x

Differential Revision: https://reviews.llvm.org/D119811

Added: 


Modified: 
lld/docs/ReleaseNotes.rst

Removed: 




diff  --git a/lld/docs/ReleaseNotes.rst b/lld/docs/ReleaseNotes.rst
index ed4a374d579a3..3601a968bd77b 100644
--- a/lld/docs/ReleaseNotes.rst
+++ b/lld/docs/ReleaseNotes.rst
@@ -118,10 +118,85 @@ MinGW Improvements
 * ``--heap`` is now handled.
   (`D118405 `_)
 
-MachO Improvements
---
-
-* Item 1.
+Mach-O Improvements
+---
+
+* The ``ld64.lld.darwinnew`` symlink has been removed. Use ``ld64.lld`` to
+  invoke the Mach-O backend from now on. Moreover, the symlink
+  ``ld64.lld.darwinold`` -- and the old Mach-O LLD code that it pointed to --
+  have been removed. (`D114842 `_)
+* The "cannot export hidden symbol" error has been downgraded to a warning.
+  (`D107011 `_)
+* Common bitcode symbols are now supported.
+  (`D107027 `_)
+* Weak references in bitcode are now supported.
+  (`D115949 `_)
+* Thunk insertion now works more reliably.
+  (`D108897 `_,
+   `D108924 `_,
+   `D109079  `_,
+   `D116705 `_)
+* ``-ObjC`` now loads archive members before the symbol resolution phase.
+  (`D108781 `_)
+* ``-oso_prefix`` is now supported.
+  (`D112291 `_)
+* Properly encode binaries with zero exported symbols. Tools like
+  ``codesign_allocate`` no longer choke on those binaries.
+  (`D112589 `_)
+* We no longer treat architecture mismatches as a fatal error. Use
+  ``-arch_errors_fatal`` if that behavior is still desired.
+  (`D113082 `_)
+* Several performance improvements were done to speed LLD up on projects with
+  a lot of framework flags and library lookups. Large Swift-based projects
+  will benefit significantly.
+  (`D113073 `_,
+   `D113063 `_,
+   `D113153 `_,
+   `D113235 `_)
+* Several memory-reduction optimizations were done to reduce LLD's RSS
+  footprint.
+  (`D113813 `_,
+   `D113818 `_)
+* Symbol patterns from ``-[un]exported_symbols_list`` are now processed in
+  parallel. (`D113820 `_)
+* ``.weak_def_can_be_hidden`` symbols can now be exported.
+  (`D113167 `_)
+* ``-S`` -- to omit debug info -- is now handled.
+  (`D112594 `_)
+* ``-v`` now writes to stderr instead of stdout.
+  (`D113020 `_)
+* Private externs with GOT relocations are now marked as LOCAL in the indirect
+  symbol table. This allows ``strip -x`` to remove more symbols.
+  (`D111852 `_)
+* We no longer generate bogus addresses when ``__TEXT,__gcc_except_tab`` is
+  renamed. (`D113582 `_)
+* Unreferenced weak dylib symbols no longer trigger fetches from an archive.
+  (`D115092 `_)
+* ``$ld$hide`` symbols are now supported.
+  (`D115775 `_)
+* Symbols imported via `-weak_framework` are now properly marked as weak refs.
+  (`D114397 `_)
+* ``--warn-dylib-install-name`` and ``--no-warn-dylib-install-name`` were added
+  to toggle LLD-specific warnings around the use of ``-install_name``.
+  (`D113534 `_)
+* Passing both ``--icf=all`` and ``-no_deduplicate`` no longer results in a
+  warning. (`D110672 `_)
+* ICF now deduplicates functions with (identical) unwind info too.
+  (`D109946 `_)
+* We now support ordering sections based on call graph profile data.
+  (`D112164 `_)
+* Map file output now proceeds in parallel with output of the binary.
+  (`D117069 `_)
+* The map file now contains dead-stripped symbols too.
+  (`D114737  `_)
+* Multiple TLV sections with 
diff erent alignments are now handled properly.
+  (`D1

[llvm-branch-commits] [libcxx] 7fdca71 - [libc++] Guard much of std::ranges under _LIBCPP_HAS_NO_INCOMPLETE_RANGES.

2022-02-15 Thread Louis Dionne via llvm-branch-commits

Author: Arthur O'Dwyer
Date: 2022-02-15T15:14:02-05:00
New Revision: 7fdca71be63aa2abad2bff099c6754938a2fe4fc

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

LOG: [libc++] Guard much of std::ranges under _LIBCPP_HAS_NO_INCOMPLETE_RANGES.

The logic here is that we are disabling *only* things in `std::ranges::`.
Everything in `std::` is permitted, including `default_sentinel`, 
`contiguous_iterator`,
`common_iterator`, `projected`, `swappable`, and so on. Then, we include
anything from `std::ranges::` that is required in order to make those things
work: `ranges::swap`, `ranges::swap_ranges`, `input_range`, `ranges::begin`,
`ranges::iter_move`, and so on. But then that's all. Everything else (including
notably all of the "views" and the `std::views` namespace itself) is still
locked up behind `_LIBCPP_HAS_NO_INCOMPLETE_RANGES`.

Originally reviewed as https://reviews.llvm.org/D118736.

(cherry picked from commit 53406fb691db38b21decf233e091f648f8317b2d)

Differential Revision: https://reviews.llvm.org/D119853

Added: 
libcxx/test/libcxx/ranges/has-no-incomplete-ranges.compile.pass.cpp

Modified: 
libcxx/include/__algorithm/in_in_out_result.h
libcxx/include/__algorithm/in_out_result.h
libcxx/include/__filesystem/directory_iterator.h
libcxx/include/__filesystem/recursive_directory_iterator.h
libcxx/include/__functional/ranges_operations.h
libcxx/include/__iterator/advance.h
libcxx/include/__iterator/distance.h
libcxx/include/__iterator/insert_iterator.h
libcxx/include/__iterator/iter_move.h
libcxx/include/__iterator/iter_swap.h
libcxx/include/__iterator/next.h
libcxx/include/__iterator/prev.h
libcxx/include/__memory/concepts.h
libcxx/include/__memory/ranges_construct_at.h
libcxx/include/__memory/ranges_uninitialized_algorithms.h
libcxx/include/__ranges/all.h
libcxx/include/__ranges/common_view.h
libcxx/include/__ranges/concepts.h
libcxx/include/__ranges/copyable_box.h
libcxx/include/__ranges/counted.h
libcxx/include/__ranges/dangling.h
libcxx/include/__ranges/data.h
libcxx/include/__ranges/drop_view.h
libcxx/include/__ranges/empty.h
libcxx/include/__ranges/empty_view.h
libcxx/include/__ranges/enable_borrowed_range.h
libcxx/include/__ranges/enable_view.h
libcxx/include/__ranges/iota_view.h
libcxx/include/__ranges/join_view.h
libcxx/include/__ranges/non_propagating_cache.h
libcxx/include/__ranges/owning_view.h
libcxx/include/__ranges/range_adaptor.h
libcxx/include/__ranges/ref_view.h
libcxx/include/__ranges/reverse_view.h
libcxx/include/__ranges/single_view.h
libcxx/include/__ranges/size.h
libcxx/include/__ranges/subrange.h
libcxx/include/__ranges/take_view.h
libcxx/include/__ranges/transform_view.h
libcxx/include/__ranges/view_interface.h
libcxx/include/ranges
libcxx/include/span
libcxx/include/string_view

libcxx/test/libcxx/algorithms/specialized.algorithms/special.mem.concepts/nothrow_forward_iterator.compile.pass.cpp

libcxx/test/libcxx/algorithms/specialized.algorithms/special.mem.concepts/nothrow_input_iterator.compile.pass.cpp

libcxx/test/libcxx/algorithms/specialized.algorithms/special.mem.concepts/nothrow_sentinel_for.compile.pass.cpp
libcxx/test/libcxx/ranges/range.access/end.incomplete_type.pass.cpp

libcxx/test/libcxx/ranges/range.utility.helpers/different_from.compile.pass.cpp
libcxx/test/libcxx/ranges/range.utility.helpers/has_arrow.compile.pass.cpp
libcxx/test/std/algorithms/algorithms.results/in_in_result.pass.cpp
libcxx/test/std/containers/views/span.cons/deduct.pass.cpp

libcxx/test/std/iterators/iterator.primitives/range.iter.ops/range.iter.ops.advance/constraints.verify.cpp

libcxx/test/std/iterators/iterator.primitives/range.iter.ops/range.iter.ops.advance/iterator_count.pass.cpp

libcxx/test/std/iterators/iterator.primitives/range.iter.ops/range.iter.ops.advance/iterator_count_sentinel.pass.cpp

libcxx/test/std/iterators/iterator.primitives/range.iter.ops/range.iter.ops.advance/iterator_sentinel.pass.cpp

libcxx/test/std/iterators/iterator.primitives/range.iter.ops/range.iter.ops.distance/iterator_sentinel.pass.cpp

libcxx/test/std/iterators/iterator.primitives/range.iter.ops/range.iter.ops.distance/lwg3664.pass.cpp

libcxx/test/std/iterators/iterator.primitives/range.iter.ops/range.iter.ops.next/constraints.compile.pass.cpp

libcxx/test/std/iterators/iterator.primitives/range.iter.ops/range.iter.ops.next/iterator.pass.cpp

libcxx/test/std/iterators/iterator.primitives/range.iter.ops/range.iter.ops.next/iterator_count.pass.cpp

libcxx/test/std/iterators/iterator.primitives/range.iter.ops/range.iter.ops.next/iterator_count_sentinel.pass.cpp

libcxx/test/std/iterators/iterator.primitives/range.iter.ops/

[llvm-branch-commits] [libcxx] dfc24b8 - [libc++][NFC] Work around false positive ODR violations from ASan.

2022-02-15 Thread Louis Dionne via llvm-branch-commits

Author: Konstantin Varlamov
Date: 2022-02-15T15:16:41-05:00
New Revision: dfc24b8522ba9943e20bc4162d42d6b49bf85214

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

LOG: [libc++][NFC] Work around false positive ODR violations from ASan.

This works around a known issue in ASan. ASan doesn't instrument weak
symbols. Because instrumentation increases object size, the binary can
end up with two versions of the same object, one instrumented and one
not instrumented, with different sizes, which ASan will report as an ODR
violation. In libc++, this affects typeinfo for `std::bad_function_call`
which is emitted as a weak symbol in the test executable and as a strong
symbol in the shared library.

The main open issue for ASan appears to be
https://github.com/google/sanitizers/issues/1017.

Differential Revision: https://reviews.llvm.org/D119410

(cherry picked from commit 10953974ed6b61247fd4b070b3a6e390e02d0edb)

Added: 


Modified: 
libcxx/cmake/caches/Generic-asan.cmake

Removed: 




diff  --git a/libcxx/cmake/caches/Generic-asan.cmake 
b/libcxx/cmake/caches/Generic-asan.cmake
index cf919765c3a29..a86b34748550b 100644
--- a/libcxx/cmake/caches/Generic-asan.cmake
+++ b/libcxx/cmake/caches/Generic-asan.cmake
@@ -1 +1,3 @@
 set(LLVM_USE_SANITIZER "Address" CACHE STRING "")
+# This is a temporary (hopefully) workaround for an ASan issue (see 
https://llvm.org/D119410).
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mllvm -asan-use-private-alias=1" 
CACHE INTERNAL "")



___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [libcxx] 199e05e - [libc++] Add missing UNSUPPORTED for the has-no-incomplete-ranges test

2022-02-15 Thread Louis Dionne via llvm-branch-commits

Author: Louis Dionne
Date: 2022-02-15T15:16:03-05:00
New Revision: 199e05e34bb8beb1cafce3a086932a32c493fa13

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

LOG: [libc++] Add missing UNSUPPORTED for the has-no-incomplete-ranges test

This wasn't caught because we don't test the combination of no-filesystem
and no-experimental-features in the CI.

(cherry picked from commit 7dad5f84f1b8a7aafd5a27ce2889bd72a1e54002)

Added: 


Modified: 
libcxx/test/libcxx/ranges/has-no-incomplete-ranges.compile.pass.cpp

Removed: 




diff  --git 
a/libcxx/test/libcxx/ranges/has-no-incomplete-ranges.compile.pass.cpp 
b/libcxx/test/libcxx/ranges/has-no-incomplete-ranges.compile.pass.cpp
index a131f87ae1e4d..0d151073ca481 100644
--- a/libcxx/test/libcxx/ranges/has-no-incomplete-ranges.compile.pass.cpp
+++ b/libcxx/test/libcxx/ranges/has-no-incomplete-ranges.compile.pass.cpp
@@ -7,6 +7,7 @@
 
//===--===//
 
 // UNSUPPORTED: c++03, c++11, c++14, c++17
+// UNSUPPORTED: libcpp-has-no-filesystem-library
 // REQUIRES: libcpp-has-no-incomplete-ranges
 
 // Test that _LIBCPP_HAS_NO_INCOMPLETE_RANGES disables the std::ranges 
namespace.



___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [libcxx] 2fc17e9 - [libc++] Temporarily silence failing debug mode test

2022-02-15 Thread Louis Dionne via llvm-branch-commits

Author: Louis Dionne
Date: 2022-02-15T15:50:01-05:00
New Revision: 2fc17e919f0cc6d6ca7ce189f0dc0c7bd82344c2

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

LOG: [libc++] Temporarily silence failing debug mode test

Also, fix the actual code so that the test would pass if we fixed the
issue that the method is instantiated in the dylib, and hence the debug
assertion will never fire except if the debug mode is enabled when the
dylib is being compiled.

(cherry picked from commit 5c53afe5aac0d295a9345cd439c6caf3ac5eb8ba)

Added: 


Modified: 
libcxx/include/string

libcxx/test/libcxx/strings/basic.string/string.modifiers/insert_iter_char_db1.pass.cpp

Removed: 




diff  --git a/libcxx/include/string b/libcxx/include/string
index 01cff902e07db..fd6a7424c815f 100644
--- a/libcxx/include/string
+++ b/libcxx/include/string
@@ -2897,6 +2897,10 @@ template 
 typename basic_string<_CharT, _Traits, _Allocator>::iterator
 basic_string<_CharT, _Traits, _Allocator>::insert(const_iterator __pos, 
value_type __c)
 {
+_LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(&__pos) == this,
+ "string::insert(iterator, character) called with an 
iterator not"
+ " referring to this string");
+
 size_type __ip = static_cast(__pos - begin());
 size_type __sz = size();
 size_type __cap = capacity();

diff  --git 
a/libcxx/test/libcxx/strings/basic.string/string.modifiers/insert_iter_char_db1.pass.cpp
 
b/libcxx/test/libcxx/strings/basic.string/string.modifiers/insert_iter_char_db1.pass.cpp
index c6a81ebfa65ae..ac05b69cf5561 100644
--- 
a/libcxx/test/libcxx/strings/basic.string/string.modifiers/insert_iter_char_db1.pass.cpp
+++ 
b/libcxx/test/libcxx/strings/basic.string/string.modifiers/insert_iter_char_db1.pass.cpp
@@ -14,6 +14,12 @@
 
 // ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
 
+// TODO: Since string::insert(iter, char) is intantiated in the dylib, this 
test doesn't
+//   actually work if the dylib hasn't been built with debug assertions 
enabled.
+//   Until we overhaul the debug mode, mark this test as unsupported to 
avoid
+//   spurious CI failures.
+// REQUIRES: never-run
+
 #include 
 
 #include "test_macros.h"
@@ -24,7 +30,8 @@ int main(int, char**)
 typedef std::string S;
 S s;
 S s2;
-TEST_LIBCPP_ASSERT_FAILURE(s.insert(s2.begin(), '1'), "Attempted to 
subtract incompatible iterators");
+TEST_LIBCPP_ASSERT_FAILURE(s.insert(s2.begin(), '1'),
+"string::insert(iterator, character) called with an iterator not 
referring to this string");
 
 return 0;
 }



___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [lld] edf6447 - [ELF][PPC64] Fix assertion failure for branches to hidden undefined weak for -no-pie

2022-02-15 Thread Fangrui Song via llvm-branch-commits

Author: Fangrui Song
Date: 2022-02-15T12:58:24-08:00
New Revision: edf64474d66286a7f5578a033d1c3ccb31f2a2a7

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

LOG: [ELF][PPC64] Fix assertion failure for branches to hidden undefined weak 
for -no-pie

Reported by Stefan Pintilie in D119773.

For a branch to a hidden undefined weak symbol, there is an
`assert(sym->getVA());` failure in PPC64LongBranchTargetSection::writeTo for a
-no-pie link. The root cause is that we unnecessarily create the thunk for the
-no-pie link.

Fix this by changing the condition to just `s.isUndefined()`. See the inline
comment.

Rename ppc64-weak-undef-call.s to ppc64-undefined-weak.s to be consistent with
other architectures.

Reviewed By: sfertile, stefanp

Differential Revision: https://reviews.llvm.org/D119787

(cherry picked from commit 53b59fdc52bf6c8bf15ce7c146d2cebe338f34a7)

Added: 
lld/test/ELF/ppc64-undefined-weak.s
lld/test/ELF/ppc64-undefined.s

Modified: 
lld/ELF/Arch/PPC64.cpp

Removed: 
lld/test/ELF/ppc64-weak-undef-call-shared.s
lld/test/ELF/ppc64-weak-undef-call.s



diff  --git a/lld/ELF/Arch/PPC64.cpp b/lld/ELF/Arch/PPC64.cpp
index c083484f42804..7d051c43af0d3 100644
--- a/lld/ELF/Arch/PPC64.cpp
+++ b/lld/ELF/Arch/PPC64.cpp
@@ -1380,9 +1380,10 @@ bool PPC64::needsThunk(RelExpr expr, RelType type, const 
InputFile *file,
   if (type == R_PPC64_REL24_NOTOC && (s.stOther >> 5) > 1)
 return true;
 
-  // If a symbol is a weak undefined and we are compiling an executable
-  // it doesn't need a range-extending thunk since it can't be called.
-  if (s.isUndefWeak() && !config->shared)
+  // An undefined weak symbol not in a PLT does not need a thunk. If it is
+  // hidden, its binding has been converted to local, so we just check
+  // isUndefined() here. A undefined non-weak symbol has been errored.
+  if (s.isUndefined())
 return false;
 
   // If the offset exceeds the range of the branch type then it will need

diff  --git a/lld/test/ELF/ppc64-undefined-weak.s 
b/lld/test/ELF/ppc64-undefined-weak.s
new file mode 100644
index 0..7b1be5e36dd32
--- /dev/null
+++ b/lld/test/ELF/ppc64-undefined-weak.s
@@ -0,0 +1,40 @@
+# REQUIRES: ppc
+
+# RUN: llvm-mc -filetype=obj -triple=powerpc64le %s -o %t.o
+# RUN: ld.lld %t.o -o %t
+# RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck %s --check-prefix=PDE
+# RUN: ld.lld -pie %t.o -o %t
+# RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck %s --check-prefix=PIC
+# RUN: ld.lld -shared %t.o -o %t.so
+# RUN: llvm-objdump -d --no-show-raw-insn %t.so | FileCheck %s 
--check-prefix=PIC
+
+# RUN: llvm-mc -filetype=obj -triple=powerpc64 %s -o %t.o
+# RUN: ld.lld %t.o -o %t
+# RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck %s --check-prefix=PDE
+
+## Branches to an undefined weak symbol need a thunk iff a dynamic relocation 
is
+## produced. undefweak2 is hidden and does not need a dynamic relocation, so we
+## suppress the thunk. undefweak1 needs a thunk iff -pie or -shared.
+
+# PDE-LABEL: <_start>:
+# PDE-NEXT:bl {{.*}} <_start>
+# PDE-NEXT:nop
+# PDE-NEXT:bl {{.*}} <_start+0x8>
+# PDE-NEXT:nop
+
+# PIC-LABEL: <_start>:
+# PIC-NEXT:bl {{.*}} <__plt_undefweak1>
+# PIC-NEXT:ld 2, 24(1)
+# PIC-NEXT:bl {{.*}} <_start+0x8>
+# PIC-NEXT:nop
+
+.text
+.global _start
+_start:
+  bl undefweak1
+  nop
+  bl undefweak2
+  nop
+
+.weak undefweak1, undefweak2
+.hidden undefweak2

diff  --git a/lld/test/ELF/ppc64-undefined.s b/lld/test/ELF/ppc64-undefined.s
new file mode 100644
index 0..c9c2a7564f95f
--- /dev/null
+++ b/lld/test/ELF/ppc64-undefined.s
@@ -0,0 +1,11 @@
+# REQUIRES: ppc
+
+# RUN: llvm-mc -filetype=obj -triple=powerpc64le %s -o %t.o
+# RUN: not ld.lld %t.o -o /dev/null 2>&1 | FileCheck %s --check-prefix=ERR
+
+# ERR: error: undefined symbol: undef
+
+.global _start
+_start:
+  bl undef
+  nop

diff  --git a/lld/test/ELF/ppc64-weak-undef-call-shared.s 
b/lld/test/ELF/ppc64-weak-undef-call-shared.s
deleted file mode 100644
index 244f72f995737..0
--- a/lld/test/ELF/ppc64-weak-undef-call-shared.s
+++ /dev/null
@@ -1,21 +0,0 @@
-# REQUIRES: ppc
-
-# RUN: llvm-mc -filetype=obj -triple=powerpc64le-unknown-linux %s -o %t.o
-# RUN: ld.lld -shared %t.o -o %t.so
-# RUN: llvm-readobj --symbols -r --dyn-syms %t.so | FileCheck %s
-
-# RUN: llvm-mc -filetype=obj -triple=powerpc64-unknown-linux %s -o %t.o
-# RUN: ld.lld -shared %t.o -o %t.so
-# RUN: llvm-readobj --symbols -r --dyn-syms %t.so | FileCheck %s
-
-.section".toc","aw"
-.quad weakfunc
-// CHECK-NOT: R_PPC64_RELATIVE
-
-.text
-.Lfoo:
-  bl weakfunc
-  nop
-// CHECK-NOT: R_PPC64_REL24
-
-.weak weakfunc

diff  --git a/lld/test/ELF/ppc64-weak-undef-call.s 
b/lld/test/ELF/ppc64-weak-undef-call.s
deleted file mode

[llvm-branch-commits] [libcxx] fc2dbf9 - [libc++] Mark test as unsupported with apple-clang

2022-02-15 Thread Louis Dionne via llvm-branch-commits

Author: Louis Dionne
Date: 2022-02-15T16:15:11-05:00
New Revision: fc2dbf90d12a4e34b6d06264ce2ff6b8b94aac8e

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

LOG: [libc++] Mark test as unsupported with apple-clang

This is to avoid spurious test failures in case apple-clang-14 doesn't
support _BitInt.

(cherry picked from commit 87b218b42b14e392aa0363a413d440b77bf04bd4)

Added: 


Modified: 
libcxx/test/libcxx/atomics/bit-int.verify.cpp

Removed: 




diff  --git a/libcxx/test/libcxx/atomics/bit-int.verify.cpp 
b/libcxx/test/libcxx/atomics/bit-int.verify.cpp
index cf3cf97566606..fb080965740a3 100644
--- a/libcxx/test/libcxx/atomics/bit-int.verify.cpp
+++ b/libcxx/test/libcxx/atomics/bit-int.verify.cpp
@@ -12,7 +12,7 @@
 // disable them for now until their behavior can be designed better later.
 // See https://reviews.llvm.org/D84049 for details.
 
-// UNSUPPORTED: apple-clang-12, apple-clang-13
+// UNSUPPORTED: apple-clang-12, apple-clang-13, apple-clang-14
 // UNSUPPORTED: clang-12, clang-13
 
 // UNSUPPORTED: c++03



___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits