[llvm-branch-commits] [llvm] 92c89fe - Revert "[Legalizer] Check full condition for UMIN and UMAX just like the code…"

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

Author: AtariDreams
Date: 2024-05-28T12:25:31-04:00
New Revision: 92c89fe87fbecafa208de688dff4bfcc760d4e35

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

LOG: Revert "[Legalizer] Check full condition for UMIN and UMAX just like the 
code…"

This reverts commit 70bf1396517be14a92bc69dcb0bf44179c937d93.

Added: 


Modified: 
llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp

Removed: 




diff  --git a/llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp 
b/llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp
index c04f7208c61f2..d8b0f52ecf9e3 100644
--- a/llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp
+++ b/llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp
@@ -3972,7 +3972,7 @@ LegalizerHelper::lower(MachineInstr &MI, unsigned 
TypeIdx, LLT LowerHintTy) {
 // target can override this with custom lowering and calling the
 // implementation functions.
 LLT Ty = MRI.getType(MI.getOperand(0).getReg());
-if (LI.isLegalOrCustom({G_UMIN, Ty}) && LI.isLegalOrCustom({G_UMAX, Ty}))
+if (LI.isLegalOrCustom({G_UMIN, Ty}))
   return lowerAddSubSatToMinMax(MI);
 return lowerAddSubSatToAddoSubo(MI);
   }



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


[llvm-branch-commits] [clang] [clang] fix printing of canonical template template parameters take 2 (PR #93448)

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


@@ -292,6 +292,14 @@ void TemplateName::Profile(llvm::FoldingSetNodeID &ID) {
 
 void TemplateName::print(raw_ostream &OS, const PrintingPolicy &Policy,
  Qualified Qual) const {
+  auto handleCanonicalTTP = [](TemplateDecl *TD, raw_ostream &OS) {

cor3ntin wrote:

Shouldn't that be "anonymous" rather than canonical (even if canonical implies 
anonymous)

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


[llvm-branch-commits] [lld] ad28187 - Revert "[lld] Support thumb PLTs (#86223)"

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

Author: Mehdi Amini
Date: 2024-05-28T19:46:04-06:00
New Revision: ad28187f5490e4d58fee8764340e7d58602ea4c6

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

LOG: Revert "[lld] Support thumb PLTs (#86223)"

This reverts commit 760c2aa55f0c5f56bed944328b23aa3f2f764346.

Added: 


Modified: 
lld/ELF/Arch/ARM.cpp
lld/ELF/Config.h
lld/ELF/InputFiles.cpp

Removed: 
lld/test/ELF/armv8-thumb-plt-reloc.s



diff  --git a/lld/ELF/Arch/ARM.cpp b/lld/ELF/Arch/ARM.cpp
index 3e0efe540e1bf..687f9499009d5 100644
--- a/lld/ELF/Arch/ARM.cpp
+++ b/lld/ELF/Arch/ARM.cpp
@@ -231,71 +231,36 @@ static void writePltHeaderLong(uint8_t *buf) {
 // The default PLT header requires the .got.plt to be within 128 Mb of the
 // .plt in the positive direction.
 void ARM::writePltHeader(uint8_t *buf) const {
-  if (config->armThumbPLTs) {
-// The instruction sequence for thumb:
-//
-// 0: b500  push{lr}
-// 2: f8df e008 ldr.w   lr, [pc, #0x8]  @ 0xe 
-// 6: 44fe  add lr, pc
-// 8: f85e ff08 ldr pc, [lr, #8]!
-// e:   .word   .got.plt - .plt - 16
-//
-// At 0x8, we want to jump to .got.plt, the -16 accounts for 8 bytes from
-// `pc` in the add instruction and 8 bytes for the `lr` adjustment.
-//
-uint64_t offset = in.gotPlt->getVA() - in.plt->getVA() - 16;
-assert(llvm::isUInt<32>(offset) && "This should always fit into a 32-bit 
offset");
-write16(buf + 0, 0xb500);
-// Split into two halves to support endianness correctly.
-write16(buf + 2, 0xf8df);
-write16(buf + 4, 0xe008);
-write16(buf + 6, 0x44fe);
-// Split into two halves to support endianness correctly.
-write16(buf + 8, 0xf85e);
-write16(buf + 10, 0xff08);
-write32(buf + 12, offset);
-
-memcpy(buf + 16, trapInstr.data(), 4);  // Pad to 32-byte boundary
-memcpy(buf + 20, trapInstr.data(), 4);
-memcpy(buf + 24, trapInstr.data(), 4);
-memcpy(buf + 28, trapInstr.data(), 4);
-  } else {
-// Use a similar sequence to that in writePlt(), the 
diff erence is the
-// calling conventions mean we use lr instead of ip. The PLT entry is
-// responsible for saving lr on the stack, the dynamic loader is 
responsible
-// for reloading it.
-const uint32_t pltData[] = {
-0xe52de004, // L1: str lr, [sp,#-4]!
-0xe28fe600, // add lr, pc,  #0x0NN0 &(.got.plt - L1 - 4)
-0xe28eea00, // add lr, lr,  #0x000NN000 &(.got.plt - L1 - 4)
-0xe5bef000, // ldr pc, [lr, #0x0NNN] &(.got.plt -L1 - 4)
-};
-
-uint64_t offset = in.gotPlt->getVA() - in.plt->getVA() - 4;
-if (!llvm::isUInt<27>(offset)) {
-  // We cannot encode the Offset, use the long form.
-  writePltHeaderLong(buf);
-  return;
-}
-write32(buf + 0, pltData[0]);
-write32(buf + 4, pltData[1] | ((offset >> 20) & 0xff));
-write32(buf + 8, pltData[2] | ((offset >> 12) & 0xff));
-write32(buf + 12, pltData[3] | (offset & 0xfff));
-memcpy(buf + 16, trapInstr.data(), 4); // Pad to 32-byte boundary
-memcpy(buf + 20, trapInstr.data(), 4);
-memcpy(buf + 24, trapInstr.data(), 4);
-memcpy(buf + 28, trapInstr.data(), 4);
+  // Use a similar sequence to that in writePlt(), the 
diff erence is the calling
+  // conventions mean we use lr instead of ip. The PLT entry is responsible for
+  // saving lr on the stack, the dynamic loader is responsible for reloading
+  // it.
+  const uint32_t pltData[] = {
+  0xe52de004, // L1: str lr, [sp,#-4]!
+  0xe28fe600, // add lr, pc,  #0x0NN0 &(.got.plt - L1 - 4)
+  0xe28eea00, // add lr, lr,  #0x000NN000 &(.got.plt - L1 - 4)
+  0xe5bef000, // ldr pc, [lr, #0x0NNN] &(.got.plt -L1 - 4)
+  };
+
+  uint64_t offset = in.gotPlt->getVA() - in.plt->getVA() - 4;
+  if (!llvm::isUInt<27>(offset)) {
+// We cannot encode the Offset, use the long form.
+writePltHeaderLong(buf);
+return;
   }
+  write32(buf + 0, pltData[0]);
+  write32(buf + 4, pltData[1] | ((offset >> 20) & 0xff));
+  write32(buf + 8, pltData[2] | ((offset >> 12) & 0xff));
+  write32(buf + 12, pltData[3] | (offset & 0xfff));
+  memcpy(buf + 16, trapInstr.data(), 4); // Pad to 32-byte boundary
+  memcpy(buf + 20, trapInstr.data(), 4);
+  memcpy(buf + 24, trapInstr.data(), 4);
+  memcpy(buf + 28, trapInstr.data(), 4);
 }
 
 void ARM::addPltHeaderSymbols(InputSection &isec) const {
-  if (config->armThumbPLTs) {
-addSyntheticLocal("$t", STT_NOTYPE, 0, 0, isec);
-addSyntheticLocal("$d", STT_NOTYPE, 12, 0, isec);
-  } else {
-addSyntheticLocal("$a", STT_NOTYPE, 0, 0, isec);
-addSyntheticLocal("$d", STT_NOTYPE, 16, 0, isec);
-  }
+  addSyntheticLocal("$a", STT_NOTYPE, 0, 0, isec);
+  addSyntheticLocal

[llvm-branch-commits] [clang] b054716 - Revert "[Support] Remove terminfo dependency (#92865)"

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

Author: Michael Buch
Date: 2024-05-29T16:11:31+01:00
New Revision: b054716c51465ca82c87934e7f9970128a3f3562

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

LOG: Revert "[Support] Remove terminfo dependency (#92865)"

This reverts commit 6bf450c7a60fa62c642e39836566da94bb9bbc91.

Added: 
llvm/cmake/modules/FindTerminfo.cmake
llvm/utils/gn/build/libs/terminfo/BUILD.gn
llvm/utils/gn/build/libs/terminfo/enable.gni

Modified: 
clang/cmake/caches/Fuchsia-stage2.cmake
clang/cmake/caches/Fuchsia.cmake
clang/cmake/caches/VectorEngine.cmake
clang/utils/analyzer/entrypoint.py
compiler-rt/cmake/config-ix.cmake
compiler-rt/lib/sanitizer_common/symbolizer/scripts/build_symbolizer.sh
compiler-rt/lib/xray/tests/CMakeLists.txt
lldb/docs/resources/build.rst
lldb/source/Core/CMakeLists.txt
llvm/CMakeLists.txt
llvm/cmake/config-ix.cmake
llvm/cmake/modules/LLVMConfig.cmake.in
llvm/docs/ReleaseNotes.rst
llvm/include/llvm/Config/config.h.cmake
llvm/lib/Support/CMakeLists.txt
llvm/lib/Support/Unix/Process.inc
llvm/utils/gn/README.rst
llvm/utils/gn/secondary/llvm/include/llvm/Config/BUILD.gn
llvm/utils/gn/secondary/llvm/lib/Support/BUILD.gn
llvm/utils/gn/secondary/llvm/tools/llvm-config/BUILD.gn
utils/bazel/.bazelrc
utils/bazel/llvm-project-overlay/llvm/include/llvm/Config/config.h
utils/bazel/llvm_configs/config.h.cmake

Removed: 




diff  --git a/clang/cmake/caches/Fuchsia-stage2.cmake 
b/clang/cmake/caches/Fuchsia-stage2.cmake
index 66e764968e85ce..d5546e20873b3c 100644
--- a/clang/cmake/caches/Fuchsia-stage2.cmake
+++ b/clang/cmake/caches/Fuchsia-stage2.cmake
@@ -19,6 +19,7 @@ set(LLVM_ENABLE_LLD ON CACHE BOOL "")
 set(LLVM_ENABLE_LTO ON CACHE BOOL "")
 set(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR ON CACHE BOOL "")
 set(LLVM_ENABLE_PLUGINS OFF CACHE BOOL "")
+set(LLVM_ENABLE_TERMINFO OFF CACHE BOOL "")
 set(LLVM_ENABLE_UNWIND_TABLES OFF CACHE BOOL "")
 set(LLVM_ENABLE_Z3_SOLVER OFF CACHE BOOL "")
 set(LLVM_ENABLE_ZLIB ON CACHE BOOL "")

diff  --git a/clang/cmake/caches/Fuchsia.cmake 
b/clang/cmake/caches/Fuchsia.cmake
index 4d3af3ad3f4031..30a3b9116a461f 100644
--- a/clang/cmake/caches/Fuchsia.cmake
+++ b/clang/cmake/caches/Fuchsia.cmake
@@ -12,6 +12,7 @@ set(LLVM_ENABLE_DIA_SDK OFF CACHE BOOL "")
 set(LLVM_ENABLE_LIBEDIT OFF CACHE BOOL "")
 set(LLVM_ENABLE_LIBXML2 OFF CACHE BOOL "")
 set(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR ON CACHE BOOL "")
+set(LLVM_ENABLE_TERMINFO OFF CACHE BOOL "")
 set(LLVM_ENABLE_UNWIND_TABLES OFF CACHE BOOL "")
 set(LLVM_ENABLE_Z3_SOLVER OFF CACHE BOOL "")
 set(LLVM_ENABLE_ZLIB OFF CACHE BOOL "")
@@ -33,6 +34,7 @@ set(_FUCHSIA_BOOTSTRAP_PASSTHROUGH
   LibXml2_ROOT
   LLVM_ENABLE_CURL
   LLVM_ENABLE_HTTPLIB
+  LLVM_ENABLE_TERMINFO
   LLVM_ENABLE_LIBEDIT
   CURL_ROOT
   OpenSSL_ROOT
@@ -45,6 +47,11 @@ set(_FUCHSIA_BOOTSTRAP_PASSTHROUGH
   CURSES_LIBRARIES
   PANEL_LIBRARIES
 
+  # Deprecated
+  Terminfo_ROOT
+
+  Terminfo_LIBRARIES
+
   # Deprecated
   LibEdit_ROOT
 

diff  --git a/clang/cmake/caches/VectorEngine.cmake 
b/clang/cmake/caches/VectorEngine.cmake
index b429fb0997d7a0..2f968a21cc407e 100644
--- a/clang/cmake/caches/VectorEngine.cmake
+++ b/clang/cmake/caches/VectorEngine.cmake
@@ -13,7 +13,9 @@
 #   ninja
 #
 
-# Disable ZLIB, and ZSTD for VE since there is no pre-compiled libraries.
+# Disable TERMINFO, ZLIB, and ZSTD for VE since there is no pre-compiled
+# libraries.
+set(LLVM_ENABLE_TERMINFO OFF CACHE BOOL "")
 set(LLVM_ENABLE_ZLIB OFF CACHE BOOL "")
 set(LLVM_ENABLE_ZSTD OFF CACHE BOOL "")
 

diff  --git a/clang/utils/analyzer/entrypoint.py 
b/clang/utils/analyzer/entrypoint.py
index 4deb42db0a0b1f..ff877060bad69e 100644
--- a/clang/utils/analyzer/entrypoint.py
+++ b/clang/utils/analyzer/entrypoint.py
@@ -54,7 +54,7 @@ def is_cmake_needed():
 "cmake -G Ninja -DCMAKE_BUILD_TYPE=Release "
 "-DCMAKE_INSTALL_PREFIX=/analyzer -DLLVM_TARGETS_TO_BUILD=X86 "
 '-DLLVM_ENABLE_PROJECTS="clang;openmp" -DLLVM_BUILD_RUNTIME=OFF '
-"-DCLANG_ENABLE_ARCMT=OFF "
+"-DLLVM_ENABLE_TERMINFO=OFF -DCLANG_ENABLE_ARCMT=OFF "
 "-DCLANG_ENABLE_STATIC_ANALYZER=ON"
 )
 

diff  --git a/compiler-rt/cmake/config-ix.cmake 
b/compiler-rt/cmake/config-ix.cmake
index bddaa37579fd7b..42edbe15edafb5 100644
--- a/compiler-rt/cmake/config-ix.cmake
+++ b/compiler-rt/cmake/config-ix.cmake
@@ -182,6 +182,21 @@ check_library_exists(m pow "" COMPILER_RT_HAS_LIBM)
 check_library_exists(pthread pthread_create "" COMPILER_RT_HAS_LIBPTHREAD)
 check_library_exists(execinfo backtrace "" COMPILER_RT_HAS_LIBEXECINFO)
 
+# Look for terminfo library, used in unittests that depend on LLVMSupport.
+if(LLVM_ENABLE_TERMINFO STREQUAL FORCE_ON)
+  set(MAYBE_REQUIRED REQUIRED)
+else()
+  set(MAYBE_REQUIRED)

[llvm-branch-commits] [llvm] Bump version to 18.1.7 (PR #93723)

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

llvmbot wrote:




@llvm/pr-subscribers-testing-tools

Author: Tom Stellard (tstellar)


Changes



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


2 Files Affected:

- (modified) llvm/CMakeLists.txt (+1-1) 
- (modified) llvm/utils/lit/lit/__init__.py (+1-1) 


``diff
diff --git a/llvm/CMakeLists.txt b/llvm/CMakeLists.txt
index 26b7b01bb1f8d..51278943847aa 100644
--- a/llvm/CMakeLists.txt
+++ b/llvm/CMakeLists.txt
@@ -22,7 +22,7 @@ if(NOT DEFINED LLVM_VERSION_MINOR)
   set(LLVM_VERSION_MINOR 1)
 endif()
 if(NOT DEFINED LLVM_VERSION_PATCH)
-  set(LLVM_VERSION_PATCH 6)
+  set(LLVM_VERSION_PATCH 7)
 endif()
 if(NOT DEFINED LLVM_VERSION_SUFFIX)
   set(LLVM_VERSION_SUFFIX)
diff --git a/llvm/utils/lit/lit/__init__.py b/llvm/utils/lit/lit/__init__.py
index d8b0e3bd1c69e..5003d78ce5218 100644
--- a/llvm/utils/lit/lit/__init__.py
+++ b/llvm/utils/lit/lit/__init__.py
@@ -2,7 +2,7 @@
 
 __author__ = "Daniel Dunbar"
 __email__ = "[email protected]"
-__versioninfo__ = (18, 1, 6)
+__versioninfo__ = (18, 1, 7)
 __version__ = ".".join(str(v) for v in __versioninfo__) + "dev"
 
 __all__ = []

``




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


[llvm-branch-commits] [mlir] 4757e13 - Revert "[mlir][spirv] Add integration test for `vector.interleave` and `vecto…"

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

Author: Mehdi Amini
Date: 2024-05-29T14:28:05-06:00
New Revision: 4757e13b449c6d4ffa6d5088628c9de64d79e223

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

LOG: Revert "[mlir][spirv] Add integration test for `vector.interleave` and 
`vecto…"

This reverts commit c9c244423ffb8071bb838c3606052e12af537047.

Added: 


Modified: 
mlir/lib/Conversion/GPUToSPIRV/GPUToSPIRVPass.cpp

Removed: 
mlir/test/mlir-vulkan-runner/vector-interleave.mlir
mlir/test/mlir-vulkan-runner/vector-shuffle.mlir



diff  --git a/mlir/lib/Conversion/GPUToSPIRV/GPUToSPIRVPass.cpp 
b/mlir/lib/Conversion/GPUToSPIRV/GPUToSPIRVPass.cpp
index 53e73ec0d81bf..1d1db913e3df2 100644
--- a/mlir/lib/Conversion/GPUToSPIRV/GPUToSPIRVPass.cpp
+++ b/mlir/lib/Conversion/GPUToSPIRV/GPUToSPIRVPass.cpp
@@ -18,7 +18,6 @@
 #include "mlir/Conversion/GPUToSPIRV/GPUToSPIRV.h"
 #include "mlir/Conversion/MemRefToSPIRV/MemRefToSPIRV.h"
 #include "mlir/Conversion/SCFToSPIRV/SCFToSPIRV.h"
-#include "mlir/Conversion/VectorToSPIRV/VectorToSPIRV.h"
 #include "mlir/Dialect/Func/IR/FuncOps.h"
 #include "mlir/Dialect/GPU/IR/GPUDialect.h"
 #include "mlir/Dialect/SPIRV/IR/SPIRVDialect.h"
@@ -133,7 +132,6 @@ void GPUToSPIRVPass::runOnOperation() {
 mlir::arith::populateArithToSPIRVPatterns(typeConverter, patterns);
 populateMemRefToSPIRVPatterns(typeConverter, patterns);
 populateFuncToSPIRVPatterns(typeConverter, patterns);
-populateVectorToSPIRVPatterns(typeConverter, patterns);
 
 if (failed(applyFullConversion(gpuModule, *target, std::move(patterns
   return signalPassFailure();

diff  --git a/mlir/test/mlir-vulkan-runner/vector-interleave.mlir 
b/mlir/test/mlir-vulkan-runner/vector-interleave.mlir
deleted file mode 100644
index 2f5c319e2f5c5..0
--- a/mlir/test/mlir-vulkan-runner/vector-interleave.mlir
+++ /dev/null
@@ -1,53 +0,0 @@
-// RUN: mlir-vulkan-runner %s \
-// RUN:  --shared-libs=%vulkan-runtime-wrappers,%mlir_runner_utils \
-// RUN:  --entry-point-result=void | FileCheck %s
-
-// CHECK: [0, 2, 1, 3]
-module attributes {
-  gpu.container_module,
-  spirv.target_env = #spirv.target_env<
-#spirv.vce, 
#spirv.resource_limits<>>
-} {
-  gpu.module @kernels {
-gpu.func @kernel_vector_interleave(%arg0 : memref<2xi32>, %arg1 : 
memref<2xi32>, %arg2 : memref<4xi32>)
-  kernel attributes { spirv.entry_point_abi = 
#spirv.entry_point_abi} {
-  %c0 = arith.constant 0 : index
-  %vec0 = vector.load %arg0[%c0] : memref<2xi32>, vector<2xi32>
-  %vec1 = vector.load %arg1[%c0] : memref<2xi32>, vector<2xi32>
-  %result = vector.interleave %vec0, %vec1 : vector<2xi32> -> vector<4xi32>
-  vector.store %result, %arg2[%c0] : memref<4xi32>, vector<4xi32>
-  gpu.return
-}
-  }
-
-  func.func @main() {
-// Allocate 3 buffers.
-%buf0 = memref.alloc() : memref<2xi32>
-%buf1 = memref.alloc() : memref<2xi32>
-%buf2 = memref.alloc() : memref<4xi32>
-
-%idx0 = arith.constant 0 : index
-%idx1 = arith.constant 1 : index
-%idx4 = arith.constant 4 : index
-
-// Initialize input buffer.
-%buf0_vals = arith.constant dense<[0, 1]> : vector<2xi32>
-%buf1_vals = arith.constant dense<[2, 3]> : vector<2xi32>
-vector.store %buf0_vals, %buf0[%idx0] : memref<2xi32>, vector<2xi32>
-vector.store %buf1_vals, %buf1[%idx0] : memref<2xi32>, vector<2xi32>
-
-// Initialize output buffer.
-%value0 = arith.constant 0 : i32
-%buf3 = memref.cast %buf2 : memref<4xi32> to memref
-call @fillResource1DInt(%buf3, %value0) : (memref, i32) -> ()
-
-gpu.launch_func @kernels::@kernel_vector_interleave
-blocks in (%idx4, %idx1, %idx1) threads in (%idx1, %idx1, %idx1)
-args(%buf0 : memref<2xi32>, %buf1 : memref<2xi32>, %buf2 : 
memref<4xi32>)
-%buf4 = memref.cast %buf3 : memref to memref<*xi32>
-call @printMemrefI32(%buf4) : (memref<*xi32>) -> ()
-return
-  }
-  func.func private @fillResource1DInt(%0 : memref, %1 : i32)
-  func.func private @printMemrefI32(%ptr : memref<*xi32>)
-}

diff  --git a/mlir/test/mlir-vulkan-runner/vector-shuffle.mlir 
b/mlir/test/mlir-vulkan-runner/vector-shuffle.mlir
deleted file mode 100644
index e29e054ccd46b..0
--- a/mlir/test/mlir-vulkan-runner/vector-shuffle.mlir
+++ /dev/null
@@ -1,53 +0,0 @@
-// RUN: mlir-vulkan-runner %s \
-// RUN:  --shared-libs=%vulkan-runtime-wrappers,%mlir_runner_utils \
-// RUN:  --entry-point-result=void | FileCheck %s
-
-// CHECK: [2, 1, 3]
-module attributes {
-  gpu.container_module,
-  spirv.target_env = #spirv.target_env<
-#spirv.vce, 
#spirv.resource_limits<>>
-} {
-  gpu.module @kernels {
-gpu.func @kernel_vector_shuffle(%arg0 : memref<2xi32>, %arg1 : 
memref<2xi32>, %arg2 : memref<3xi32>)
-  kernel attributes { spirv.entry_poin

[llvm-branch-commits] [lldb] 9f72683 - Revert "[lldb][lldb-dap] Cleanup breakpoint filters. (#87550)"

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

Author: gulfemsavrun
Date: 2024-05-29T13:44:48-07:00
New Revision: 9f72683d223dd8b05ba5efc7590fbb9c725d55c1

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

LOG: Revert "[lldb][lldb-dap] Cleanup breakpoint filters. (#87550)"

This reverts commit cfb209b92a26f16ed7413b32da20fc436eff8c58.

Added: 


Modified: 
lldb/include/lldb/API/SBDebugger.h
lldb/include/lldb/Symbol/TypeSystem.h
lldb/source/API/SBDebugger.cpp
lldb/source/Symbol/TypeSystem.cpp
lldb/tools/lldb-dap/DAP.cpp
lldb/tools/lldb-dap/DAP.h
lldb/tools/lldb-dap/lldb-dap.cpp

Removed: 




diff  --git a/lldb/include/lldb/API/SBDebugger.h 
b/lldb/include/lldb/API/SBDebugger.h
index 84ea9c0f772e1..af19b1faf3bf5 100644
--- a/lldb/include/lldb/API/SBDebugger.h
+++ b/lldb/include/lldb/API/SBDebugger.h
@@ -57,8 +57,6 @@ class LLDB_API SBDebugger {
 
   static const char *GetBroadcasterClass();
 
-  static bool SupportsLanguage(lldb::LanguageType language);
-
   lldb::SBBroadcaster GetBroadcaster();
 
   /// Get progress data from a SBEvent whose type is eBroadcastBitProgress.

diff  --git a/lldb/include/lldb/Symbol/TypeSystem.h 
b/lldb/include/lldb/Symbol/TypeSystem.h
index 7d48f9b316138..b4025c173a186 100644
--- a/lldb/include/lldb/Symbol/TypeSystem.h
+++ b/lldb/include/lldb/Symbol/TypeSystem.h
@@ -209,7 +209,6 @@ class TypeSystem : public PluginInterface,
   // TypeSystems can support more than one language
   virtual bool SupportsLanguage(lldb::LanguageType language) = 0;
 
-  static bool SupportsLanguageStatic(lldb::LanguageType language);
   // Type Completion
 
   virtual bool GetCompleteType(lldb::opaque_compiler_type_t type) = 0;

diff  --git a/lldb/source/API/SBDebugger.cpp b/lldb/source/API/SBDebugger.cpp
index 29da7d33dd80b..7ef0d6efd4aaa 100644
--- a/lldb/source/API/SBDebugger.cpp
+++ b/lldb/source/API/SBDebugger.cpp
@@ -1742,7 +1742,3 @@ bool SBDebugger::InterruptRequested()   {
 return m_opaque_sp->InterruptRequested();
   return false;
 }
-
-bool SBDebugger::SupportsLanguage(lldb::LanguageType language) {
-  return TypeSystem::SupportsLanguageStatic(language);
-}

diff  --git a/lldb/source/Symbol/TypeSystem.cpp 
b/lldb/source/Symbol/TypeSystem.cpp
index 5d56d9b1829da..4956f10a0b0a7 100644
--- a/lldb/source/Symbol/TypeSystem.cpp
+++ b/lldb/source/Symbol/TypeSystem.cpp
@@ -335,14 +335,3 @@ TypeSystemMap::GetTypeSystemForLanguage(lldb::LanguageType 
language,
   }
   return GetTypeSystemForLanguage(language);
 }
-
-bool TypeSystem::SupportsLanguageStatic(lldb::LanguageType language) {
-  if (language == eLanguageTypeUnknown)
-return false;
-
-  LanguageSet languages =
-  PluginManager::GetAllTypeSystemSupportedLanguagesForTypes();
-  if (languages.Empty())
-return false;
-  return languages[language];
-}

diff  --git a/lldb/tools/lldb-dap/DAP.cpp b/lldb/tools/lldb-dap/DAP.cpp
index 807d27c2c869d..d419f821999e6 100644
--- a/lldb/tools/lldb-dap/DAP.cpp
+++ b/lldb/tools/lldb-dap/DAP.cpp
@@ -32,7 +32,14 @@ namespace lldb_dap {
 DAP g_dap;
 
 DAP::DAP()
-: broadcaster("lldb-dap"), exception_breakpoints(),
+: broadcaster("lldb-dap"),
+  exception_breakpoints(
+  {{"cpp_catch", "C++ Catch", lldb::eLanguageTypeC_plus_plus},
+   {"cpp_throw", "C++ Throw", lldb::eLanguageTypeC_plus_plus},
+   {"objc_catch", "Objective-C Catch", lldb::eLanguageTypeObjC},
+   {"objc_throw", "Objective-C Throw", lldb::eLanguageTypeObjC},
+   {"swift_catch", "Swift Catch", lldb::eLanguageTypeSwift},
+   {"swift_throw", "Swift Throw", lldb::eLanguageTypeSwift}}),
   focus_tid(LLDB_INVALID_THREAD_ID), stop_at_entry(false), 
is_attach(false),
   enable_auto_variable_summaries(false),
   enable_synthetic_child_debugging(false),
@@ -58,32 +65,8 @@ DAP::DAP()
 
 DAP::~DAP() = default;
 
-void DAP::PopulateExceptionBreakpoints() {
-  exception_breakpoints = {};
-  if (debugger.SupportsLanguage(lldb::eLanguageTypeC_plus_plus)) {
-exception_breakpoints->emplace_back("cpp_catch", "C++ Catch",
-lldb::eLanguageTypeC_plus_plus);
-exception_breakpoints->emplace_back("cpp_throw", "C++ Throw",
-lldb::eLanguageTypeC_plus_plus);
-  }
-  if (debugger.SupportsLanguage(lldb::eLanguageTypeObjC)) {
-exception_breakpoints->emplace_back("objc_catch", "Objective-C Catch",
-lldb::eLanguageTypeObjC);
-exception_breakpoints->emplace_back("objc_throw", "Objective-C Throw",
-lldb::eLanguageTypeObjC);
-  }
-  if (debugger.SupportsLanguage(lldb::eLanguageTypeSwift)) {
-exception_breakpoints->emplace_back("swift_catch", "Swift Catch",
-lldb::eLanguageType

[llvm-branch-commits] [lld] [llvm] release/18.x: [lld] Fix -ObjC load behavior with LTO (#92162) (PR #92478)

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

https://github.com/AtariDreams reopened 
https://github.com/llvm/llvm-project/pull/92478
___
llvm-branch-commits mailing list
[email protected]
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)

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

https://github.com/AtariDreams reopened 
https://github.com/llvm/llvm-project/pull/91038
___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [BOLT] Detect .warm split functions as cold fragments (PR #93759)

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

llvmbot wrote:




@llvm/pr-subscribers-bolt

Author: Amir Ayupov (aaupov)


Changes

CDSplit splits functions up to three ways: main fragment with no suffix,
and fragments with .cold and .warm suffixes.

Add .warm suffix to the regex used to recognize split fragments.

Test Plan: updated register-fragments-bolt-symbols.s


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


3 Files Affected:

- (modified) bolt/include/bolt/Rewrite/RewriteInstance.h (+4) 
- (modified) bolt/lib/Rewrite/RewriteInstance.cpp (+3-7) 
- (modified) bolt/test/X86/register-fragments-bolt-symbols.s (+13-1) 


``diff
diff --git a/bolt/include/bolt/Rewrite/RewriteInstance.h 
b/bolt/include/bolt/Rewrite/RewriteInstance.h
index 64113bd026012..d8d62badcc377 100644
--- a/bolt/include/bolt/Rewrite/RewriteInstance.h
+++ b/bolt/include/bolt/Rewrite/RewriteInstance.h
@@ -21,6 +21,7 @@
 #include "llvm/Object/ELFObjectFile.h"
 #include "llvm/Object/ObjectFile.h"
 #include "llvm/Support/Error.h"
+#include "llvm/Support/Regex.h"
 #include 
 #include 
 #include 
@@ -596,6 +597,9 @@ class RewriteInstance {
 
   NameResolver NR;
 
+  // Regex object matching split function names.
+  const Regex ColdFragment{"(.*)\\.(cold|warm)(\\.[0-9]+)?"};
+
   friend class RewriteInstanceDiff;
 };
 
diff --git a/bolt/lib/Rewrite/RewriteInstance.cpp 
b/bolt/lib/Rewrite/RewriteInstance.cpp
index 4b4913dd7a16c..fb920ebbeafc4 100644
--- a/bolt/lib/Rewrite/RewriteInstance.cpp
+++ b/bolt/lib/Rewrite/RewriteInstance.cpp
@@ -55,7 +55,6 @@
 #include "llvm/Support/Error.h"
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Support/ManagedStatic.h"
-#include "llvm/Support/Regex.h"
 #include "llvm/Support/Timer.h"
 #include "llvm/Support/ToolOutputFile.h"
 #include "llvm/Support/raw_ostream.h"
@@ -945,9 +944,6 @@ void RewriteInstance::discoverFileObjects() {
   BinaryFunction *PreviousFunction = nullptr;
   unsigned AnonymousId = 0;
 
-  // Regex object for matching cold fragments.
-  const Regex ColdFragment(".*\\.cold(\\.[0-9]+)?");
-
   const auto SortedSymbolsEnd =
   LastSymbol == SortedSymbols.end() ? LastSymbol : std::next(LastSymbol);
   for (auto Iter = SortedSymbols.begin(); Iter != SortedSymbolsEnd; ++Iter) {
@@ -1460,10 +1456,10 @@ void RewriteInstance::registerFragments() {
 for (StringRef Name : Function.getNames()) {
   StringRef BaseName = NR.restore(Name);
   const bool IsGlobal = BaseName == Name;
-  const size_t ColdSuffixPos = BaseName.find(".cold");
-  if (ColdSuffixPos == StringRef::npos)
+  SmallVector Matches;
+  if (!ColdFragment.match(BaseName, &Matches))
 continue;
-  StringRef ParentName = BaseName.substr(0, ColdSuffixPos);
+  StringRef ParentName = Matches[1];
   const BinaryData *BD = BC->getBinaryDataByName(ParentName);
   const uint64_t NumPossibleLocalParents =
   NR.getUniquifiedNameCount(ParentName);
diff --git a/bolt/test/X86/register-fragments-bolt-symbols.s 
b/bolt/test/X86/register-fragments-bolt-symbols.s
index 90c402b2234d7..d4f39b7acf134 100644
--- a/bolt/test/X86/register-fragments-bolt-symbols.s
+++ b/bolt/test/X86/register-fragments-bolt-symbols.s
@@ -3,8 +3,20 @@
 # RUN: llvm-mc --filetype=obj --triple x86_64-unknown-unknown 
%S/cdsplit-symbol-names.s -o %t.main.o
 # RUN: llvm-mc --filetype=obj --triple x86_64-unknown-unknown %s -o %t.chain.o
 # RUN: link_fdata %S/cdsplit-symbol-names.s %t.main.o %t.fdata
-# RUN: sed -i 's|chain|chain/2|g' %t.fdata
 # RUN: llvm-strip --strip-unneeded %t.main.o
+
+## Check warm fragment name matching (produced by cdsplit)
+# RUN: %clang %cflags %t.main.o -o %t.warm.exe -Wl,-q
+# RUN: llvm-bolt %t.warm.exe -o %t.warm.bolt --split-functions 
--split-strategy=cdsplit \
+# RUN:   --call-scale=2 --data=%t.fdata --reorder-blocks=ext-tsp --enable-bat
+# RUN: link_fdata %s %t.warm.bolt %t.preagg.warm PREAGGWARM
+# PREAGGWARM: B X:0 #chain.warm# 1 0
+# RUN: perf2bolt %t.warm.bolt -p %t.preagg.warm --pa -o %t.warm.fdata -w 
%t.warm.yaml \
+# RUN:   -v=1 | FileCheck %s --check-prefix=CHECK-BOLT-WARM
+
+# CHECK-BOLT-WARM: marking chain.warm/1(*2) as a fragment of chain
+
+# RUN: sed -i 's|chain|chain/2|g' %t.fdata
 # RUN: llvm-objcopy --localize-symbol=chain %t.main.o
 # RUN: %clang %cflags %t.chain.o %t.main.o -o %t.exe -Wl,-q
 # RUN: llvm-bolt %t.exe -o %t.bolt --split-functions --split-strategy=randomN \

``




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


[llvm-branch-commits] [BOLT][BAT] Add support for three-way split functions (PR #93760)

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

llvmbot wrote:




@llvm/pr-subscribers-bolt

Author: Amir Ayupov (aaupov)


Changes

In three-way split functions, if only .warm fragment is present, BAT
incorrectly overwrites the map for .warm fragment by empty .cold
fragment.

Test Plan: updated register-fragments-bolt-symbols.s


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


2 Files Affected:

- (modified) bolt/lib/Profile/BoltAddressTranslation.cpp (+2) 
- (modified) bolt/test/X86/register-fragments-bolt-symbols.s (+4) 


``diff
diff --git a/bolt/lib/Profile/BoltAddressTranslation.cpp 
b/bolt/lib/Profile/BoltAddressTranslation.cpp
index cdfca2b9871ac..7740862c33f04 100644
--- a/bolt/lib/Profile/BoltAddressTranslation.cpp
+++ b/bolt/lib/Profile/BoltAddressTranslation.cpp
@@ -129,6 +129,8 @@ void BoltAddressTranslation::write(const BinaryContext &BC, 
raw_ostream &OS) {
 LLVM_DEBUG(dbgs() << " Cold part\n");
 for (const FunctionFragment &FF :
  Function.getLayout().getSplitFragments()) {
+  if (FF.empty())
+continue;
   ColdPartSource.emplace(FF.getAddress(), Function.getOutputAddress());
   Map.clear();
   for (const BinaryBasicBlock *const BB : FF)
diff --git a/bolt/test/X86/register-fragments-bolt-symbols.s 
b/bolt/test/X86/register-fragments-bolt-symbols.s
index d4f39b7acf134..ebcf3f31f3766 100644
--- a/bolt/test/X86/register-fragments-bolt-symbols.s
+++ b/bolt/test/X86/register-fragments-bolt-symbols.s
@@ -13,8 +13,12 @@
 # PREAGGWARM: B X:0 #chain.warm# 1 0
 # RUN: perf2bolt %t.warm.bolt -p %t.preagg.warm --pa -o %t.warm.fdata -w 
%t.warm.yaml \
 # RUN:   -v=1 | FileCheck %s --check-prefix=CHECK-BOLT-WARM
+# RUN: FileCheck %s --input-file %t.warm.fdata --check-prefix=CHECK-FDATA-WARM
+# RUN: FileCheck %s --input-file %t.warm.yaml --check-prefix=CHECK-YAML-WARM
 
 # CHECK-BOLT-WARM: marking chain.warm/1(*2) as a fragment of chain
+# CHECK-FDATA-WARM: chain
+# CHECK-YAML-WARM: chain
 
 # RUN: sed -i 's|chain|chain/2|g' %t.fdata
 # RUN: llvm-objcopy --localize-symbol=chain %t.main.o

``




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


[llvm-branch-commits] [clang] [clang] text ast-dumper: dump TemplateName for TST and DTST (PR #93766)

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

llvmbot wrote:




@llvm/pr-subscribers-clang

Author: Matheus Izvekov (mizvekov)


Changes

Implement AST text dumping of the TemplateName for TemplateSpecializationType 
and DeducedTemplateSpecializationType.

---

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


12 Files Affected:

- (modified) clang/include/clang/AST/TemplateName.h (+4) 
- (modified) clang/include/clang/AST/TextNodeDumper.h (+2-1) 
- (modified) clang/lib/AST/TextNodeDumper.cpp (+32-11) 
- (modified) clang/test/AST/ast-dump-ctad-alias.cpp (+5-1) 
- (modified) clang/test/AST/ast-dump-template-decls.cpp (+10-4) 
- (modified) clang/test/AST/ast-dump-template-name.cpp (+6) 
- (modified) clang/test/AST/ast-dump-using-template.cpp (+13-5) 
- (modified) clang/test/Import/builtin-template/test.cpp (+2-9) 
- (modified) clang/test/SemaTemplate/aggregate-deduction-candidate.cpp (+2-2) 
- (modified) clang/test/SemaTemplate/deduction-guide.cpp (+13-9) 
- (modified) clang/test/SemaTemplate/make_integer_seq.cpp (+36-14) 
- (modified) clang/test/SemaTemplate/type_pack_element.cpp (+24-10) 


``diff
diff --git a/clang/include/clang/AST/TemplateName.h 
b/clang/include/clang/AST/TemplateName.h
index 876be463c71d0..7aedc086ab7d0 100644
--- a/clang/include/clang/AST/TemplateName.h
+++ b/clang/include/clang/AST/TemplateName.h
@@ -360,6 +360,10 @@ class TemplateName {
   static TemplateName getFromVoidPointer(void *Ptr) {
 return TemplateName(Ptr);
   }
+
+  /// Structural equality.
+  bool operator==(TemplateName Other) const { return Storage == Other.Storage; 
}
+  bool operator!=(TemplateName Other) const { return !operator==(Other); }
 };
 
 /// Insertion operator for diagnostics.  This allows sending TemplateName's
diff --git a/clang/include/clang/AST/TextNodeDumper.h 
b/clang/include/clang/AST/TextNodeDumper.h
index 63fa16c9ec47c..caa33abd99e47 100644
--- a/clang/include/clang/AST/TextNodeDumper.h
+++ b/clang/include/clang/AST/TextNodeDumper.h
@@ -214,7 +214,8 @@ class TextNodeDumper
   void dumpNestedNameSpecifier(const NestedNameSpecifier *NNS);
   void dumpConceptReference(const ConceptReference *R);
   void dumpTemplateArgument(const TemplateArgument &TA);
-  void dumpTemplateName(TemplateName TN);
+  void dumpBareTemplateName(TemplateName TN);
+  void dumpTemplateName(TemplateName TN, StringRef Label = {});
 
   void dumpDeclRef(const Decl *D, StringRef Label = {});
 
diff --git a/clang/lib/AST/TextNodeDumper.cpp b/clang/lib/AST/TextNodeDumper.cpp
index a0eedc71ea220..0e0e0a86f5cfc 100644
--- a/clang/lib/AST/TextNodeDumper.cpp
+++ b/clang/lib/AST/TextNodeDumper.cpp
@@ -1126,7 +1126,32 @@ void TextNodeDumper::VisitIntegralTemplateArgument(const 
TemplateArgument &TA) {
   dumpTemplateArgument(TA);
 }
 
-void TextNodeDumper::dumpTemplateName(TemplateName TN) {
+void TextNodeDumper::dumpTemplateName(TemplateName TN, StringRef Label) {
+  AddChild(Label, [=] {
+{
+  llvm::SmallString<128> Str;
+  {
+llvm::raw_svector_ostream SS(Str);
+TN.print(SS, PrintPolicy);
+  }
+  OS << " '" << Str << "'";
+
+  if (TemplateName CanonTN = Context->getCanonicalTemplateName(TN);
+  CanonTN != TN) {
+llvm::SmallString<128> CanonStr;
+{
+  llvm::raw_svector_ostream SS(CanonStr);
+  CanonTN.print(SS, PrintPolicy);
+}
+if (CanonStr != Str)
+  OS << ":'" << CanonStr << "'";
+  }
+}
+dumpBareTemplateName(TN);
+  });
+}
+
+void TextNodeDumper::dumpBareTemplateName(TemplateName TN) {
   switch (TN.getKind()) {
   case TemplateName::Template:
 AddChild([=] { Visit(TN.getAsTemplateDecl()); });
@@ -1143,7 +1168,7 @@ void TextNodeDumper::dumpTemplateName(TemplateName TN) {
 if (QTN->hasTemplateKeyword())
   OS << " keyword";
 dumpNestedNameSpecifier(QTN->getQualifier());
-dumpTemplateName(QTN->getUnderlyingTemplate());
+dumpBareTemplateName(QTN->getUnderlyingTemplate());
 return;
   }
   case TemplateName::DependentTemplate: {
@@ -1162,7 +1187,7 @@ void TextNodeDumper::dumpTemplateName(TemplateName TN) {
 if (const TemplateTemplateParmDecl *P = STS->getParameter())
   AddChild("parameter", [=] { Visit(P); });
 dumpDeclRef(STS->getAssociatedDecl(), "associated");
-AddChild("replacement", [=] { dumpTemplateName(STS->getReplacement()); });
+dumpTemplateName(STS->getReplacement(), "replacement");
 return;
   }
   // FIXME: Implement these.
@@ -1182,14 +1207,14 @@ void TextNodeDumper::dumpTemplateName(TemplateName TN) {
 void TextNodeDumper::VisitTemplateTemplateArgument(const TemplateArgument &TA) 
{
   OS << " template";
   dumpTemplateArgument(TA);
-  dumpTemplateName(TA.getAsTemplate());
+  dumpBareTemplateName(TA.getAsTemplate());
 }
 
 void TextNodeDumper::VisitTemplateExpansionTemplateArgument(
 const TemplateArgument &TA) {
   OS << " template expansion";
   dumpTemplateArgument(TA);
-  dumpTemplateName(TA.getAsTemplateOrTem

[llvm-branch-commits] [clang] a35c320 - Revert "[DebugInfo] Add flag to only emit referenced member functions (#87018)"

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

Author: Mehdi Amini
Date: 2024-05-29T22:47:35-06:00
New Revision: a35c320e18ba2abad17eab0ed162c4115601a828

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

LOG: Revert "[DebugInfo] Add flag to only emit referenced member functions 
(#87018)"

This reverts commit bfabc958c7c0d7ddc15f23383d9da836e8c6093f.

Added: 


Modified: 
clang/include/clang/Basic/DebugOptions.def
clang/include/clang/Driver/Options.td
clang/lib/CodeGen/CGDebugInfo.cpp
clang/lib/Driver/ToolChains/Clang.cpp
clang/test/Driver/debug-options.c

Removed: 
clang/test/CodeGenCXX/debug-info-incomplete-types.cpp



diff  --git a/clang/include/clang/Basic/DebugOptions.def 
b/clang/include/clang/Basic/DebugOptions.def
index bc96d5dfdf890..b94f6aef9ac60 100644
--- a/clang/include/clang/Basic/DebugOptions.def
+++ b/clang/include/clang/Basic/DebugOptions.def
@@ -68,8 +68,6 @@ BENIGN_DEBUGOPT(NoInlineLineTables, 1, 0) ///< Whether debug 
info should contain
   ///< inline line tables.
 
 DEBUGOPT(DebugStrictDwarf, 1, 1) ///< Whether or not to use strict DWARF info.
-DEBUGOPT(DebugOmitUnreferencedMethods, 1, 0) ///< Omit unreferenced member
-///< functions in type debug info.
 
 /// Control the Assignment Tracking debug info feature.
 BENIGN_ENUM_DEBUGOPT(AssignmentTrackingMode, AssignmentTrackingOpts, 2,

diff  --git a/clang/include/clang/Driver/Options.td 
b/clang/include/clang/Driver/Options.td
index f64d7c60783e9..4119e69c85540 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -4345,10 +4345,6 @@ defm strict_dwarf : BoolOption<"g", "strict-dwarf",
   "the specified version, avoiding features from later versions.">,
   NegFlag, BothFlags<[], [ClangOption, CLOption, DXCOption]>>,
   Group;
-defm omit_unreferenced_methods : BoolGOption<"omit-unreferenced-methods",
-  CodeGenOpts<"DebugOmitUnreferencedMethods">, DefaultFalse,
-  NegFlag,
-  PosFlag, BothFlags<[], [ClangOption, CLOption, 
DXCOption]>>;
 defm column_info : BoolOption<"g", "column-info",
   CodeGenOpts<"DebugColumnInfo">, DefaultTrue,
   NegFlag,

diff  --git a/clang/lib/CodeGen/CGDebugInfo.cpp 
b/clang/lib/CodeGen/CGDebugInfo.cpp
index 5f6f911c7a6d6..9d7107abf8a6f 100644
--- a/clang/lib/CodeGen/CGDebugInfo.cpp
+++ b/clang/lib/CodeGen/CGDebugInfo.cpp
@@ -2836,7 +2836,7 @@ CGDebugInfo::CreateTypeDefinition(const RecordType *Ty) {
 
   // Collect data fields (including static variables and any initializers).
   CollectRecordFields(RD, DefUnit, EltTys, FwdDecl);
-  if (CXXDecl && !CGM.getCodeGenOpts().DebugOmitUnreferencedMethods)
+  if (CXXDecl)
 CollectCXXMemberFunctions(CXXDecl, DefUnit, EltTys, FwdDecl);
 
   LexicalBlockStack.pop_back();

diff  --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index 4e1c52462e584..97e451cfe2acb 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -45,7 +45,6 @@
 #include "llvm/ADT/StringExtras.h"
 #include "llvm/BinaryFormat/Magic.h"
 #include "llvm/Config/llvm-config.h"
-#include "llvm/Frontend/Debug/Options.h"
 #include "llvm/Object/ObjectFile.h"
 #include "llvm/Option/ArgList.h"
 #include "llvm/Support/CodeGen.h"
@@ -4643,7 +4642,6 @@ renderDebugOptions(const ToolChain &TC, const Driver &D, 
const llvm::Triple &T,
   Args.addOptInFlag(CmdArgs, options::OPT_fforce_dwarf_frame,
 options::OPT_fno_force_dwarf_frame);
 
-  bool EnableTypeUnits = false;
   if (Args.hasFlag(options::OPT_fdebug_types_section,
options::OPT_fno_debug_types_section, false)) {
 if (!(T.isOSBinFormatELF() || T.isOSBinFormatWasm())) {
@@ -4654,24 +4652,11 @@ renderDebugOptions(const ToolChain &TC, const Driver 
&D, const llvm::Triple &T,
 } else if (checkDebugInfoOption(
Args.getLastArg(options::OPT_fdebug_types_section), Args, D,
TC)) {
-  EnableTypeUnits = true;
   CmdArgs.push_back("-mllvm");
   CmdArgs.push_back("-generate-type-units");
 }
   }
 
-  if (const Arg *A =
-  Args.getLastArg(options::OPT_gomit_unreferenced_methods,
-  options::OPT_gno_omit_unreferenced_methods))
-(void)checkDebugInfoOption(A, Args, D, TC);
-  if (Args.hasFlag(options::OPT_gomit_unreferenced_methods,
-   options::OPT_gno_omit_unreferenced_methods, false) &&
-  (DebugInfoKind == llvm::codegenoptions::DebugInfoConstructor ||
-   DebugInfoKind == llvm::codegenoptions::LimitedDebugInfo) &&
-  !EnableTypeUnits) {
-CmdArgs.push_back("-gomit-unreferenced-methods");
-  }
-
   // To avoid join/split of directory+filename, the integrated assembler 
prefers
   // the director

[llvm-branch-commits] [mlir] 52ef986 - Revert "[MLIR][Python] add ctype python binding support for bf16 (#92489)"

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

Author: Mehdi Amini
Date: 2024-05-29T23:20:35-06:00
New Revision: 52ef9864abecea0cf8d20e7eaf49c256248af5f7

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

LOG: Revert "[MLIR][Python] add ctype python binding support for bf16 (#92489)"

This reverts commit 89801c74c3e25f5a1eaa3999863be398f6a82abb.

Added: 


Modified: 
mlir/python/mlir/runtime/np_to_memref.py
mlir/python/requirements.txt
mlir/test/python/execution_engine.py

Removed: 




diff  --git a/mlir/python/mlir/runtime/np_to_memref.py 
b/mlir/python/mlir/runtime/np_to_memref.py
index 882b2751921bf..f6b706f9bc8ae 100644
--- a/mlir/python/mlir/runtime/np_to_memref.py
+++ b/mlir/python/mlir/runtime/np_to_memref.py
@@ -7,12 +7,6 @@
 import numpy as np
 import ctypes
 
-try:
-import ml_dtypes
-except ModuleNotFoundError:
-# The third-party ml_dtypes provides some optional low precision 
data-types for NumPy.
-ml_dtypes = None
-
 
 class C128(ctypes.Structure):
 """A ctype representation for MLIR's Double Complex."""
@@ -32,12 +26,6 @@ class F16(ctypes.Structure):
 _fields_ = [("f16", ctypes.c_int16)]
 
 
-class BF16(ctypes.Structure):
-"""A ctype representation for MLIR's BFloat16."""
-
-_fields_ = [("bf16", ctypes.c_int16)]
-
-
 # 
https://stackoverflow.com/questions/26921836/correct-way-to-test-for-numpy-dtype
 def as_ctype(dtp):
 """Converts dtype to ctype."""
@@ -47,8 +35,6 @@ def as_ctype(dtp):
 return C64
 if dtp == np.dtype(np.float16):
 return F16
-if ml_dtypes is not None and dtp == ml_dtypes.bfloat16:
-return BF16
 return np.ctypeslib.as_ctypes_type(dtp)
 
 
@@ -60,11 +46,6 @@ def to_numpy(array):
 return array.view("complex64")
 if array.dtype == F16:
 return array.view("float16")
-assert not (
-array.dtype == BF16 and ml_dtypes is None
-), f"bfloat16 requires the ml_dtypes package, please run:\n\npip install 
ml_dtypes\n"
-if array.dtype == BF16:
-return array.view("bfloat16")
 return array
 
 

diff  --git a/mlir/python/requirements.txt b/mlir/python/requirements.txt
index 6ec63e43adf89..acd6dbb25edaf 100644
--- a/mlir/python/requirements.txt
+++ b/mlir/python/requirements.txt
@@ -1,4 +1,3 @@
 numpy>=1.19.5, <=1.26
 pybind11>=2.9.0, <=2.10.3
-PyYAML>=5.3.1, <=6.0.1
-ml_dtypes   # provides several NumPy dtype extensions, including the bf16
\ No newline at end of file
+PyYAML>=5.3.1, <=6.0.1
\ No newline at end of file

diff  --git a/mlir/test/python/execution_engine.py 
b/mlir/test/python/execution_engine.py
index 8125bf3fb8fc9..e8b47007a8907 100644
--- a/mlir/test/python/execution_engine.py
+++ b/mlir/test/python/execution_engine.py
@@ -5,7 +5,6 @@
 from mlir.passmanager import *
 from mlir.execution_engine import *
 from mlir.runtime import *
-from ml_dtypes import bfloat16
 
 
 # Log everything to stderr and flush so that we have a unified stream to match
@@ -522,45 +521,6 @@ def testComplexUnrankedMemrefAdd():
 run(testComplexUnrankedMemrefAdd)
 
 
-# Test bf16 memrefs
-# CHECK-LABEL: TEST: testBF16Memref
-def testBF16Memref():
-with Context():
-module = Module.parse(
-"""
-module  {
-  func.func @main(%arg0: memref<1xbf16>,
-  %arg1: memref<1xbf16>) attributes { 
llvm.emit_c_interface } {
-%0 = arith.constant 0 : index
-%1 = memref.load %arg0[%0] : memref<1xbf16>
-memref.store %1, %arg1[%0] : memref<1xbf16>
-return
-  }
-} """
-)
-
-arg1 = np.array([0.5]).astype(bfloat16)
-arg2 = np.array([0.0]).astype(bfloat16)
-
-arg1_memref_ptr = ctypes.pointer(
-ctypes.pointer(get_ranked_memref_descriptor(arg1))
-)
-arg2_memref_ptr = ctypes.pointer(
-ctypes.pointer(get_ranked_memref_descriptor(arg2))
-)
-
-execution_engine = ExecutionEngine(lowerToLLVM(module))
-execution_engine.invoke("main", arg1_memref_ptr, arg2_memref_ptr)
-
-# test to-numpy utility
-# CHECK: [0.5]
-npout = ranked_memref_to_numpy(arg2_memref_ptr[0])
-log(npout)
-
-
-run(testBF16Memref)
-
-
 #  Test addition of two 2d_memref
 # CHECK-LABEL: TEST: testDynamicMemrefAdd2D
 def testDynamicMemrefAdd2D():



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


[llvm-branch-commits] [clang] [clang] text ast-dumper: dump TemplateName for TST and DTST (PR #93766)

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

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

LGTM!

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


[llvm-branch-commits] [llvm] [MTE] add stack frame history buffer (PR #86356)

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

mikaelholmen wrote:

Hello @fmayer !

If I compile this patch with UBSan (-DLLVM_USE_SANITIZER='Undefined') and run 
tests, I see the following for many many lit tests:
```
../include/llvm/Support/CommandLine.h:601:13: runtime error: load of value 2, 
which is not a valid value for type 'const RecordStackHistoryMode'
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior 
../include/llvm/Support/CommandLine.h:601:13 in 
```
Can e.g. be seen with
```
llc -verify-machineinstrs -o - test/CodeGen/AArch64/ldst-unscaledimm.ll 
-mtriple=aarch64-linux-gnu
```
if you compiled llc with UBSan.

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


[llvm-branch-commits] [lld] [llvm] release/18.x: [lld] Fix -ObjC load behavior with LTO (#92162) (PR #92478)

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

https://github.com/AtariDreams updated 
https://github.com/llvm/llvm-project/pull/92478

>From b5c3494c41e9b453a81ad730ccd464958f194675 Mon Sep 17 00:00:00 2001
From: Nuri Amari 
Date: Wed, 15 May 2024 09:21:02 -0700
Subject: [PATCH] [lld] Fix -ObjC load behavior with LTO (#92162)

When -ObjC is passed, the linker must force load any object files that
contain special sections that store Objective-C / Swift information that
is used at runtime.

This should work regadless if input files are bitcode or native, but it
was not working with bitcode. This is because the sections that identify
an object file that should be loaded were inconsistent when dealing with
a native file vs bitcode file. In particular, bitcode files were not
searched for `__TEXT,__swift` prefixed sections, while native files
were.

This means LLD wasn't loading certain bitcode files and forcing the user
to introduce --force-load to their linker invocation for that archive.

Co-authored-by: Nuri Amari 
---
 lld/test/MachO/objc.s | 23 ---
 llvm/lib/Bitcode/Reader/BitcodeReader.cpp |  3 ++-
 2 files changed, 22 insertions(+), 4 deletions(-)

diff --git a/lld/test/MachO/objc.s b/lld/test/MachO/objc.s
index e7074141f0113..dbb9f1df27571 100644
--- a/lld/test/MachO/objc.s
+++ b/lld/test/MachO/objc.s
@@ -5,12 +5,14 @@
 # RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin 
%t/has-objc-category.s -o %t/has-objc-category.o
 # RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin 
%t/has-objc-symbol-and-category.s -o %t/has-objc-symbol-and-category.o
 # RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/has-swift.s -o 
%t/has-swift.o
+# RUN: llvm-as %t/has-swift-ir-loaded.ll -o %t/has-swift-ir-loaded.o
+# RUN: llvm-as %t/has-swift-ir-not-loaded.ll -o %t/has-swift-ir-not-loaded.o
 # RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/has-swift-proto.s 
-o %t/has-swift-proto.o
 # RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/no-objc.s -o 
%t/no-objc.o
 ## Make sure we don't mis-parse a 32-bit file as 64-bit
 # RUN: llvm-mc -filetype=obj -triple=armv7-apple-watchos %t/no-objc.s -o 
%t/wrong-arch.o
-# RUN: llvm-ar rcs %t/libHasSomeObjC.a %t/no-objc.o %t/has-objc-symbol.o 
%t/has-objc-category.o %t/has-swift.o %t/has-swift-proto.o %t/wrong-arch.o
-# RUN: llvm-ar rcs %t/libHasSomeObjC2.a %t/no-objc.o 
%t/has-objc-symbol-and-category.o %t/has-swift.o %t/has-swift-proto.o 
%t/wrong-arch.o
+# RUN: llvm-ar rcs %t/libHasSomeObjC.a %t/no-objc.o %t/has-objc-symbol.o 
%t/has-objc-category.o %t/has-swift.o %t/has-swift-proto.o 
%t/has-swift-ir-loaded.o %t/has-swift-ir-not-loaded.o %t/wrong-arch.o
+# RUN: llvm-ar rcs %t/libHasSomeObjC2.a %t/no-objc.o 
%t/has-objc-symbol-and-category.o %t/has-swift.o %t/has-swift-proto.o 
%t/has-swift-ir-loaded.o %t/has-swift-ir-not-loaded.o %t/wrong-arch.o
 
 # RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/test.s -o %t/test.o
 
@@ -20,7 +22,7 @@
 # RUN: %lld -lSystem %t/test.o -o %t/test -L%t -lHasSomeObjC2 -ObjC
 # RUN: llvm-objdump --section-headers --syms %t/test | FileCheck %s 
--check-prefix=OBJC
 
-# RUN: %no-fatal-warnings-lld -lSystem %t/test.o -o %t/test --start-lib 
%t/no-objc.o %t/has-objc-symbol.o %t/has-objc-category.o %t/has-swift.o 
%t/has-swift-proto.o %t/wrong-arch.o --end-lib -ObjC 2>&1 \
+# RUN: %no-fatal-warnings-lld -lSystem %t/test.o -o %t/test --start-lib 
%t/no-objc.o %t/has-objc-symbol.o %t/has-objc-category.o %t/has-swift.o 
%t/has-swift-proto.o %t/has-swift-ir-loaded.o %t/has-swift-ir-not-loaded.o 
%t/wrong-arch.o --end-lib -ObjC 2>&1 \
 # RUN: | FileCheck -check-prefix=WARNING %s
 # RUN: llvm-objdump --section-headers --syms %t/test | FileCheck %s 
--check-prefix=OBJC
 
@@ -36,6 +38,7 @@
 # OBJC-NEXT:4 has_objc_symbol {{.*}}  DATA
 # OBJC-EMPTY:
 # OBJC-NEXT:  SYMBOL TABLE:
+# OBJC-DAG:   g O __TEXT,__swift _foo
 # OBJC-DAG:   g F __TEXT,__text _main
 # OBJC-DAG:   g F __TEXT,__text _OBJC_CLASS_$_MyObject
 # OBJC-DAG:   g O __TEXT,__swift5_fieldmd $s7somelib4Blah_pMF
@@ -100,6 +103,20 @@ _has_dup:
 .section __TEXT,__swift
 .quad 0x1234
 
+#--- has-swift-ir-loaded.ll
+target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128"
+target triple = "x86_64-apple-darwin"
+
+@foo = global i64 1234, section "__TEXT,__swift"
[email protected] = appending global [1 x ptr] [ptr @foo]
+
+#--- has-swift-ir-not-loaded.ll
+target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128"
+target triple = "x86_64-apple-darwin"
+
+@bar = global i64 1234
[email protected] = appending global [1 x ptr] [ptr @bar]
+
 #--- has-swift-proto.s
 .section __TEXT,__swift5_fieldmd
 .globl $s7somelib4Blah_pMF
diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp 
b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
index a027d0c21ba0b..db1bd457f83d1 100644
--- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
+++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
@@ -294,7 +294,8 @@ static Expected 
hasObjCCategoryInModule(BitstreamCursor &Stream) {
 return error("I

[llvm-branch-commits] [llvm] [Support] Add SipHash-based 16/64-bit ptrauth stable hash. (PR #93902)

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

llvmbot wrote:




@llvm/pr-subscribers-llvm-support

Author: Ahmed Bougacha (ahmedbougacha)


Changes

Based on the SipHash reference implementation:
  https://github.com/veorq/SipHash
which has very graciously been licensed under our llvm license (Apache-2.0 WITH 
LLVM-exception) by Jean-Philippe Aumasson.

This lightly modifies it to fit into libSupport, and wraps it for the two main 
interfaces we're interested in (16/64-bit).

This intentionally doesn't expose a raw interface beyond that to encourage 
others to carefully consider their use.
Beyond that, I'm ambivalent about naming this ptrauth, siphash, stablehash, or 
which combination of the three (which is what this patch does for the symbols, 
but keeping SipHash for the file, for other potential usage.) 

The exact algorithm is the little-endian interpretation of the non-doubled 
(i.e. 64-bit) result of applying a SipHash-2-4 using a specific key value which 
can be found in the source.

By "stable" we mean that the result of this hash algorithm will the same across 
different compiler versions and target platforms.

The 16-bit variant is used extensively for the AArch64 ptrauth ABI, because 
AArch64 can efficiently load a 16-bit immediate into the high bits of a 
register without disturbing the remainder of the value, which serves as a nice 
blend operation.

16 bits is also sufficiently compact to not inflate a loader relocation. We 
disallow zero to guarantee a different discriminator from the places in the ABI 
that use a constant zero.

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


5 Files Affected:

- (added) llvm/include/llvm/Support/SipHash.h (+47) 
- (modified) llvm/lib/Support/CMakeLists.txt (+1) 
- (added) llvm/lib/Support/SipHash.cpp (+174) 
- (modified) llvm/unittests/Support/CMakeLists.txt (+1) 
- (added) llvm/unittests/Support/SipHashTest.cpp (+43) 


``diff
diff --git a/llvm/include/llvm/Support/SipHash.h 
b/llvm/include/llvm/Support/SipHash.h
new file mode 100644
index 0..fcc29c00da185
--- /dev/null
+++ b/llvm/include/llvm/Support/SipHash.h
@@ -0,0 +1,47 @@
+//===--- SipHash.h - An ABI-stable string SipHash ---*- C++ 
-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+//
+// A family of ABI-stable string hash algorithms based on SipHash, currently
+// used to compute ptrauth discriminators.
+//
+//===--===//
+
+#ifndef LLVM_SUPPORT_SIPHASH_H
+#define LLVM_SUPPORT_SIPHASH_H
+
+#include 
+
+namespace llvm {
+class StringRef;
+
+/// Compute a stable 64-bit hash of the given string.
+///
+/// The exact algorithm is the little-endian interpretation of the
+/// non-doubled (i.e. 64-bit) result of applying a SipHash-2-4 using
+/// a specific key value which can be found in the source.
+///
+/// By "stable" we mean that the result of this hash algorithm will
+/// the same across different compiler versions and target platforms.
+uint64_t getPointerAuthStableSipHash64(StringRef S);
+
+/// Compute a stable non-zero 16-bit hash of the given string.
+///
+/// This computes the full getPointerAuthStableSipHash64, but additionally
+/// truncates it down to a non-zero 16-bit value.
+///
+/// We use a 16-bit discriminator because ARM64 can efficiently load
+/// a 16-bit immediate into the high bits of a register without disturbing
+/// the remainder of the value, which serves as a nice blend operation.
+/// 16 bits is also sufficiently compact to not inflate a loader relocation.
+/// We disallow zero to guarantee a different discriminator from the places
+/// in the ABI that use a constant zero.
+uint64_t getPointerAuthStableSipHash16(StringRef S);
+
+} // end namespace llvm
+
+#endif
diff --git a/llvm/lib/Support/CMakeLists.txt b/llvm/lib/Support/CMakeLists.txt
index be4badc09efa5..aa37b812791ff 100644
--- a/llvm/lib/Support/CMakeLists.txt
+++ b/llvm/lib/Support/CMakeLists.txt
@@ -222,6 +222,7 @@ add_llvm_component_library(LLVMSupport
   SHA1.cpp
   SHA256.cpp
   Signposts.cpp
+  SipHash.cpp
   SmallPtrSet.cpp
   SmallVector.cpp
   SourceMgr.cpp
diff --git a/llvm/lib/Support/SipHash.cpp b/llvm/lib/Support/SipHash.cpp
new file mode 100644
index 0..dbd60fb73ebb5
--- /dev/null
+++ b/llvm/lib/Support/SipHash.cpp
@@ -0,0 +1,174 @@
+//===--- StableHash.cpp - An ABI-stable string hash 
---===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+//
+//  This file implements an ABI-stable string hash based on 

[llvm-branch-commits] [clang] [clang] Define ptrauth_string_discriminator builtin. (PR #93903)

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

llvmbot wrote:




@llvm/pr-subscribers-clang

Author: Ahmed Bougacha (ahmedbougacha)


Changes

This exposes the ABI-stable hash function that allows computing a 16-bit 
discriminator from a constant string.

This allows manually matching the implicit string discriminators computed in 
the ABI (e.g., from mangled names for vtable pointer/entry signing), as well as 
enabling the use of interesting discriminators when manually annotating 
specific pointers with the __ptrauth qualifier.

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


7 Files Affected:

- (modified) clang/include/clang/Basic/Builtins.td (+6) 
- (modified) clang/include/clang/Basic/DiagnosticSemaKinds.td (+2) 
- (modified) clang/lib/AST/ExprConstant.cpp (+7) 
- (modified) clang/lib/Headers/ptrauth.h (+17) 
- (modified) clang/lib/Sema/SemaChecking.cpp (+20) 
- (modified) clang/test/CodeGen/ptrauth-intrinsics.c (+13) 
- (modified) clang/test/Sema/ptrauth-intrinsics-macro.c (+5) 


``diff
diff --git a/clang/include/clang/Basic/Builtins.td 
b/clang/include/clang/Basic/Builtins.td
index 11982af3fa609..836697632a3bc 100644
--- a/clang/include/clang/Basic/Builtins.td
+++ b/clang/include/clang/Basic/Builtins.td
@@ -4411,6 +4411,12 @@ def PtrauthAuth : Builtin {
   let Prototype = "void*(void*,int,void*)";
 }
 
+def PtrauthStringDiscriminator : Builtin {
+  let Spellings = ["__builtin_ptrauth_string_discriminator"];
+  let Attributes = [NoThrow, Const, Constexpr];
+  let Prototype = "size_t(char const*)";
+}
+
 // OpenCL v2.0 s6.13.16, s9.17.3.5 - Pipe functions.
 // We need the generic prototype, since the packet type could be anything.
 def ReadPipe : OCLPipeLangBuiltin {
diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td 
b/clang/include/clang/Basic/DiagnosticSemaKinds.td
index f15cba63624ea..64add46248c69 100644
--- a/clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -928,6 +928,8 @@ def warn_ptrauth_sign_null_pointer :
 def warn_ptrauth_auth_null_pointer :
   Warning<"authenticating a null pointer will almost certainly trap">,
   InGroup;
+def err_ptrauth_string_not_literal : Error<
+  "argument must be a string literal%select{| of char type}0">;
 
 /// main()
 // static main() is not an error in C, just in C++.
diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp
index f1aa19e4409e1..eafecfb5fe5b1 100644
--- a/clang/lib/AST/ExprConstant.cpp
+++ b/clang/lib/AST/ExprConstant.cpp
@@ -58,6 +58,7 @@
 #include "llvm/ADT/StringExtras.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/SaveAndRestore.h"
+#include "llvm/Support/SipHash.h"
 #include "llvm/Support/TimeProfiler.h"
 #include "llvm/Support/raw_ostream.h"
 #include 
@@ -12583,6 +12584,12 @@ bool IntExprEvaluator::VisitBuiltinCallExpr(const 
CallExpr *E,
   case Builtin::BI__builtin_expect_with_probability:
 return Visit(E->getArg(0));
 
+  case Builtin::BI__builtin_ptrauth_string_discriminator: {
+auto literal = cast(E->getArg(0)->IgnoreParenImpCasts());
+auto result = getPointerAuthStableSipHash16(literal->getString());
+return Success(result, E);
+  }
+
   case Builtin::BI__builtin_ffs:
   case Builtin::BI__builtin_ffsl:
   case Builtin::BI__builtin_ffsll: {
diff --git a/clang/lib/Headers/ptrauth.h b/clang/lib/Headers/ptrauth.h
index 036665d75a91b..3e58af1802084 100644
--- a/clang/lib/Headers/ptrauth.h
+++ b/clang/lib/Headers/ptrauth.h
@@ -135,6 +135,17 @@ typedef __UINTPTR_TYPE__ ptrauth_generic_signature_t;
 #define ptrauth_auth_data(__value, __old_key, __old_data)  
\
   __builtin_ptrauth_auth(__value, __old_key, __old_data)
 
+/* Compute a constant discriminator from the given string.
+
+   The result can be used as the second argument to
+   ptrauth_blend_discriminator or the third argument to the
+   __ptrauth qualifier.  It has type size_t.
+
+   The argument must be a string literal.
+   A call to this function is an integer constant expression. */
+#define ptrauth_string_discriminator(__string) 
\
+  __builtin_ptrauth_string_discriminator(__string)
+
 /* Compute a signature for the given pair of pointer-sized values.
The order of the arguments is significant.
 
@@ -196,6 +207,12 @@ typedef __UINTPTR_TYPE__ ptrauth_generic_signature_t;
 __value;   
\
   })
 
+#define ptrauth_string_discriminator(__string) 
\
+  ({   
\
+(void)__string;
\
+((ptrauth_extra_data_t)0); 
\
+  })
+
 #define ptrauth_sign_generic_data(__value, __data) 
\
   ({   
\
 (void)__value; 

[llvm-branch-commits] [clang] [clang] Define ptrauth_sign_constant builtin. (PR #93904)

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

llvmbot wrote:



@llvm/pr-subscribers-clang-codegen

@llvm/pr-subscribers-backend-x86

Author: Ahmed Bougacha (ahmedbougacha)


Changes

This is a constant-expression equivalent to __builtin_ptrauth_sign, allowing 
its usage in global initializers, but requiring constant pointers and 
discriminators.

---

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


14 Files Affected:

- (modified) clang/include/clang/Basic/Builtins.td (+6) 
- (modified) clang/include/clang/Basic/DiagnosticSemaKinds.td (+7) 
- (modified) clang/include/clang/CodeGen/CodeGenABITypes.h (+6) 
- (modified) clang/lib/AST/ExprConstant.cpp (+1) 
- (modified) clang/lib/CodeGen/CGBuiltin.cpp (+3) 
- (modified) clang/lib/CodeGen/CGExprConstant.cpp (+62) 
- (added) clang/lib/CodeGen/CGPointerAuth.cpp (+77) 
- (modified) clang/lib/CodeGen/CMakeLists.txt (+1) 
- (modified) clang/lib/CodeGen/CodeGenModule.h (+5) 
- (modified) clang/lib/Headers/ptrauth.h (+25) 
- (modified) clang/lib/Sema/SemaChecking.cpp (+114-14) 
- (added) clang/test/CodeGen/ptrauth-intrinsic-sign-constant.c (+20) 
- (modified) clang/test/Sema/ptrauth-intrinsics-macro.c (+4) 
- (modified) clang/test/Sema/ptrauth.c (+29) 


``diff
diff --git a/clang/include/clang/Basic/Builtins.td 
b/clang/include/clang/Basic/Builtins.td
index 836697632a3bc..557b70172fc08 100644
--- a/clang/include/clang/Basic/Builtins.td
+++ b/clang/include/clang/Basic/Builtins.td
@@ -4393,6 +4393,12 @@ def PtrauthSignUnauthenticated : Builtin {
   let Prototype = "void*(void*,int,void*)";
 }
 
+def PtrauthSignConstant : Builtin {
+  let Spellings = ["__builtin_ptrauth_sign_constant"];
+  let Attributes = [CustomTypeChecking, NoThrow, Const, Constexpr];
+  let Prototype = "void*(void*,int,void*)";
+}
+
 def PtrauthSignGenericData : Builtin {
   let Spellings = ["__builtin_ptrauth_sign_generic_data"];
   let Attributes = [CustomTypeChecking, NoThrow, Const];
diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td 
b/clang/include/clang/Basic/DiagnosticSemaKinds.td
index 64add46248c69..753e775ce0968 100644
--- a/clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -922,6 +922,13 @@ def err_ptrauth_value_bad_type :
   Error<"%select{signed value|extra discriminator|blended pointer|blended "
 "integer}0 must have %select{pointer|integer|pointer or integer}1 "
 "type; type here is %2">;
+def err_ptrauth_bad_constant_pointer :
+  Error<"argument to ptrauth_sign_constant must refer to a global variable "
+"or function">;
+def err_ptrauth_bad_constant_discriminator :
+  Error<"discriminator argument to ptrauth_sign_constant must be a constant "
+"integer, the address of the global variable where the result "
+"will be stored, or a blend of the two">;
 def warn_ptrauth_sign_null_pointer :
   Warning<"signing a null pointer will yield a non-null pointer">,
   InGroup;
diff --git a/clang/include/clang/CodeGen/CodeGenABITypes.h 
b/clang/include/clang/CodeGen/CodeGenABITypes.h
index fda0855dc8683..8c62d8597ecbe 100644
--- a/clang/include/clang/CodeGen/CodeGenABITypes.h
+++ b/clang/include/clang/CodeGen/CodeGenABITypes.h
@@ -104,6 +104,12 @@ llvm::Type *convertTypeForMemory(CodeGenModule &CGM, 
QualType T);
 unsigned getLLVMFieldNumber(CodeGenModule &CGM,
 const RecordDecl *RD, const FieldDecl *FD);
 
+/// Return a signed constant pointer.
+llvm::Constant *getConstantSignedPointer(CodeGenModule &CGM,
+ llvm::Constant *pointer,
+ unsigned key,
+ llvm::Constant *storageAddress,
+ llvm::Constant *otherDiscriminator);
 /// Given the language and code-generation options that Clang was configured
 /// with, set the default LLVM IR attributes for a function definition.
 /// The attributes set here are mostly global target-configuration and
diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp
index eafecfb5fe5b1..b1cb3c323074b 100644
--- a/clang/lib/AST/ExprConstant.cpp
+++ b/clang/lib/AST/ExprConstant.cpp
@@ -2042,6 +2042,7 @@ static bool IsNoOpCall(const CallExpr *E) {
   unsigned Builtin = E->getBuiltinCallee();
   return (Builtin == Builtin::BI__builtin___CFStringMakeConstantString ||
   Builtin == Builtin::BI__builtin___NSStringMakeConstantString ||
+  Builtin == Builtin::BI__builtin_ptrauth_sign_constant ||
   Builtin == Builtin::BI__builtin_function_start);
 }
 
diff --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp
index a3c6510503324..b2e3b6fa64284 100644
--- a/clang/lib/CodeGen/CGBuiltin.cpp
+++ b/clang/lib/CodeGen/CGBuiltin.cpp
@@ -5273,6 +5273,9 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl 
GD, unsigned BuiltinID,
   case Builtin::BI__iso_volatile_store64:
 return RValue::

[llvm-branch-commits] gn build: Embed libc++abi.a objects into libc++.a. (PR #88463)

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

pcc wrote:

@nico @aeubanks ping.

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


[llvm-branch-commits] [clang] d3cf61f - Revert "[clang][AST] fix ast-print of `extern ` with >=2 declarators (#…"

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

Author: gulfemsavrun
Date: 2024-05-30T18:49:48-07:00
New Revision: d3cf61ffbea5252db703ca2b7a06d5c4f8aac891

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

LOG: Revert "[clang][AST] fix ast-print of `extern ` with >=2 declarators 
(#…"

This reverts commit 7b8048939024841e07f8d89ddfaa4311f9dd7e9c.

Added: 


Modified: 
clang/lib/AST/DeclPrinter.cpp

Removed: 
clang/test/AST/ast-print-language-linkage.cpp



diff  --git a/clang/lib/AST/DeclPrinter.cpp b/clang/lib/AST/DeclPrinter.cpp
index 9250a7f6eceb2..0cf4e64f83b8d 100644
--- a/clang/lib/AST/DeclPrinter.cpp
+++ b/clang/lib/AST/DeclPrinter.cpp
@@ -633,7 +633,7 @@ static void printExplicitSpecifier(ExplicitSpecifier ES, 
llvm::raw_ostream &Out,
   Out << Proto;
 }
 
-static void maybePrintTagKeywordIfSupressingScopes(PrintingPolicy &Policy,
+static void MaybePrintTagKeywordIfSupressingScopes(PrintingPolicy &Policy,
QualType T,
llvm::raw_ostream &Out) {
   StringRef prefix = T->isClassType()   ? "class "
@@ -643,22 +643,6 @@ static void 
maybePrintTagKeywordIfSupressingScopes(PrintingPolicy &Policy,
   Out << prefix;
 }
 
-/// Return the language of the linkage spec of `D`, if applicable.
-///
-/// \Return - "C" if `D` has been declared with unbraced `extern "C"`
-/// - "C++" if `D` has been declared with unbraced `extern "C++"`
-/// - nullptr in any other case
-static const char *tryGetUnbracedLinkageLanguage(const Decl *D) {
-  const auto *SD = dyn_cast(D->getDeclContext());
-  if (!SD || SD->hasBraces())
-return nullptr;
-  if (SD->getLanguage() == LinkageSpecLanguageIDs::C)
-return "C";
-  assert(SD->getLanguage() == LinkageSpecLanguageIDs::CXX &&
- "unknown language in linkage specification");
-  return "C++";
-}
-
 void DeclPrinter::VisitFunctionDecl(FunctionDecl *D) {
   if (!D->getDescribedFunctionTemplate() &&
   !D->isFunctionTemplateSpecialization()) {
@@ -678,11 +662,6 @@ void DeclPrinter::VisitFunctionDecl(FunctionDecl *D) {
   CXXConversionDecl *ConversionDecl = dyn_cast(D);
   CXXDeductionGuideDecl *GuideDecl = dyn_cast(D);
   if (!Policy.SuppressSpecifiers) {
-if (const char *Lang = tryGetUnbracedLinkageLanguage(D)) {
-  // the "extern" specifier is implicit
-  assert(D->getStorageClass() == SC_None);
-  Out << "extern \"" << Lang << "\" ";
-}
 switch (D->getStorageClass()) {
 case SC_None: break;
 case SC_Extern: Out << "extern "; break;
@@ -828,7 +807,7 @@ void DeclPrinter::VisitFunctionDecl(FunctionDecl *D) {
   }
   if (!Policy.SuppressTagKeyword && Policy.SuppressScope &&
   !Policy.SuppressUnwrittenScope)
-maybePrintTagKeywordIfSupressingScopes(Policy, AFT->getReturnType(),
+MaybePrintTagKeywordIfSupressingScopes(Policy, AFT->getReturnType(),
Out);
   AFT->getReturnType().print(Out, Policy, Proto);
   Proto.clear();
@@ -953,11 +932,6 @@ void DeclPrinter::VisitVarDecl(VarDecl *D) {
 : D->getASTContext().getUnqualifiedObjCPointerType(D->getType());
 
   if (!Policy.SuppressSpecifiers) {
-if (const char *Lang = tryGetUnbracedLinkageLanguage(D)) {
-  // the "extern" specifier is implicit
-  assert(D->getStorageClass() == SC_None);
-  Out << "extern \"" << Lang << "\" ";
-}
 StorageClass SC = D->getStorageClass();
 if (SC != SC_None)
   Out << VarDecl::getStorageClassSpecifierString(SC) << " ";
@@ -987,7 +961,7 @@ void DeclPrinter::VisitVarDecl(VarDecl *D) {
 
   if (!Policy.SuppressTagKeyword && Policy.SuppressScope &&
   !Policy.SuppressUnwrittenScope)
-maybePrintTagKeywordIfSupressingScopes(Policy, T, Out);
+MaybePrintTagKeywordIfSupressingScopes(Policy, T, Out);
 
   printDeclType(T, (isa(D) && Policy.CleanUglifiedParameters &&
 D->getIdentifier())
@@ -1090,8 +1064,6 @@ void 
DeclPrinter::VisitNamespaceAliasDecl(NamespaceAliasDecl *D) {
 
 void DeclPrinter::VisitEmptyDecl(EmptyDecl *D) {
   prettyPrintAttributes(D);
-  if (const char *Lang = tryGetUnbracedLinkageLanguage(D))
-Out << "extern \"" << Lang << "\";";
 }
 
 void DeclPrinter::VisitCXXRecordDecl(CXXRecordDecl *D) {
@@ -1164,21 +1136,22 @@ void DeclPrinter::VisitCXXRecordDecl(CXXRecordDecl *D) {
 }
 
 void DeclPrinter::VisitLinkageSpecDecl(LinkageSpecDecl *D) {
-  if (!D->hasBraces()) {
-VisitDeclContext(D);
-return;
-  }
-  const char *L;
+  const char *l;
   if (D->getLanguage() == LinkageSpecLanguageIDs::C)
-L = "C";
+l = "C";
   else {
 assert(D->getLanguage() == LinkageSpecLanguageIDs::CXX &&
"unknown language in linkage specification");
-L = "C++";
+l = "C++";
   }
-  Out <<

[llvm-branch-commits] [llvm] [PGO] Generate __llvm_profile_raw_version only when instrumented (PR #93917)

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

llvmbot wrote:



@llvm/pr-subscribers-llvm-transforms

@llvm/pr-subscribers-pgo

Author: Pavel Samolysov (samolisov)


Changes

Currently, only modules that contain at least a single function
definition are instrumented. When a module contains no function
definitions at all, the module is not instrumented (yet?) and there is
no reason to introduce the '__llvm_profile_raw_version' variable into
the module.

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


5 Files Affected:

- (modified) llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp (+18-7) 
- (modified) llvm/test/Transforms/PGOProfile/declarations_only.ll (+1-6) 
- (modified) llvm/test/Transforms/PGOProfile/global_variables_only.ll (+1-4) 
- (added) llvm/test/Transforms/PGOProfile/no_global_variables.ll (+15) 
- (modified) 
llvm/unittests/Transforms/Instrumentation/PGOInstrumentationTest.cpp (+50-19) 


``diff
diff --git a/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp 
b/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
index 2269c2e0fffae..ff94fc98d0117 100644
--- a/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
+++ b/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
@@ -405,9 +405,14 @@ static GlobalVariable *createIRLevelProfileFlagVar(Module 
&M, bool IsCS) {
 ProfileVersion |= VARIANT_MASK_BYTE_COVERAGE;
   if (PGOTemporalInstrumentation)
 ProfileVersion |= VARIANT_MASK_TEMPORAL_PROF;
-  auto IRLevelVersionVariable = new GlobalVariable(
+  assert(!M.global_empty() &&
+ "If a module was instrumented, there must be defined global variables 
"
+ "at least for the counters.");
+  auto *InsertionPoint = &*M.global_begin();
+  auto *IRLevelVersionVariable = new GlobalVariable(
   M, IntTy64, true, GlobalValue::WeakAnyLinkage,
-  Constant::getIntegerValue(IntTy64, APInt(64, ProfileVersion)), VarName);
+  Constant::getIntegerValue(IntTy64, APInt(64, ProfileVersion)), VarName,
+  InsertionPoint);
   IRLevelVersionVariable->setVisibility(GlobalValue::HiddenVisibility);
   Triple TT(M.getTargetTriple());
   if (TT.supportsCOMDAT()) {
@@ -1829,11 +1834,6 @@ static bool InstrumentAllFunctions(
 Module &M, function_ref LookupTLI,
 function_ref LookupBPI,
 function_ref LookupBFI, bool IsCS) {
-  // For the context-sensitve instrumentation, we should have a separated pass
-  // (before LTO/ThinLTO linking) to create these variables.
-  if (!IsCS && !PGOCtxProfLoweringPass::isContextualIRPGOEnabled())
-createIRLevelProfileFlagVar(M, /*IsCS=*/false);
-
   Triple TT(M.getTargetTriple());
   LLVMContext &Ctx = M.getContext();
   if (!TT.isOSBinFormatELF() && EnableVTableValueProfiling)
@@ -1845,6 +1845,7 @@ static bool InstrumentAllFunctions(
   std::unordered_multimap ComdatMembers;
   collectComdatMembers(M, ComdatMembers);
 
+  bool AnythingInstrumented = false;
   for (auto &F : M) {
 if (skipPGOGen(F))
   continue;
@@ -1852,7 +1853,17 @@ static bool InstrumentAllFunctions(
 auto *BPI = LookupBPI(F);
 auto *BFI = LookupBFI(F);
 instrumentOneFunc(F, &M, TLI, BPI, BFI, ComdatMembers, IsCS);
+AnythingInstrumented = true;
   }
+
+  if (!AnythingInstrumented)
+return false;
+
+  // For the context-sensitve instrumentation, we should have a separated pass
+  // (before LTO/ThinLTO linking) to create these variables.
+  if (!IsCS && !PGOCtxProfLoweringPass::isContextualIRPGOEnabled())
+createIRLevelProfileFlagVar(M, /*IsCS=*/false);
+
   return true;
 }
 
diff --git a/llvm/test/Transforms/PGOProfile/declarations_only.ll 
b/llvm/test/Transforms/PGOProfile/declarations_only.ll
index e7208fc264c7c..7a975725410c9 100644
--- a/llvm/test/Transforms/PGOProfile/declarations_only.ll
+++ b/llvm/test/Transforms/PGOProfile/declarations_only.ll
@@ -1,13 +1,8 @@
-; RUN: opt < %s -passes=pgo-instr-gen -S | FileCheck %s --check-prefix=GEN 
--check-prefix=GEN-COMDAT
+; RUN: opt < %s -passes=pgo-instr-gen -S | FileCheck %s 
--implicit-check-not='__llvm_profile_raw_version'
 
 target datalayout = 
"e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-unknown-linux-gnu"
 
-; GEN-COMDAT: $__llvm_profile_raw_version = comdat any
-; GEN-COMDAT: @__llvm_profile_raw_version = hidden constant i64 {{[0-9]+}}, 
comdat
-; GEN-NOT: @__profn_test_1 = private constant [6 x i8] c"test_1"
-; GEN-NOT: @__profn_test_2 = private constant [6 x i8] c"test_2"
-
 declare i32 @test_1(i32 %i)
 
 declare i32 @test_2(i32 %i)
diff --git a/llvm/test/Transforms/PGOProfile/global_variables_only.ll 
b/llvm/test/Transforms/PGOProfile/global_variables_only.ll
index 3bfa29af5d34f..46628bfafe534 100644
--- a/llvm/test/Transforms/PGOProfile/global_variables_only.ll
+++ b/llvm/test/Transforms/PGOProfile/global_variables_only.ll
@@ -1,9 +1,6 @@
-; RUN: opt < %s -passes=pgo-instr-gen -S | FileCheck %s 
--check-prefix=GEN-COMDAT
+; RUN: opt < %s -passes=pgo-instr-gen -S | FileCheck %s 
--implicit-check-not='__llvm_pro

[llvm-branch-commits] [llvm] [MTE] add stack frame history buffer (PR #86356)

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

mikaelholmen wrote:

> > Hello @fmayer !
> > If I compile this patch with UBSan (-DLLVM_USE_SANITIZER='Undefined') and 
> > run tests, I see the following for many many lit tests:
> > ```
> > ../include/llvm/Support/CommandLine.h:601:13: runtime error: load of value 
> > 2, which is not a valid value for type 'const RecordStackHistoryMode'
> > SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior 
> > ../include/llvm/Support/CommandLine.h:601:13 in 
> > ```
> > 
> > 
> > 
> >   
> > 
> > 
> >   
> > 
> > 
> > 
> >   
> > Can e.g. be seen with
> > ```
> > llc -verify-machineinstrs -o - test/CodeGen/AArch64/ldst-unscaledimm.ll 
> > -mtriple=aarch64-linux-gnu
> > ```
> > 
> > 
> > 
> >   
> > 
> > 
> >   
> > 
> > 
> > 
> >   
> > if you compiled llc with UBSan.
> 
> should be fixed: 
> [973821c](https://github.com/llvm/llvm-project/commit/973821cb44cf2826e2aea1cd40ff40e6e975b9d6)

Thanks!

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


[llvm-branch-commits] [clang] [clang] Update use of checkUInt32Argument to match on main (PR #93984)

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

llvmbot wrote:




@llvm/pr-subscribers-clang

Author: Oliver Hunt (ojhunt)


Changes

Minor correction to match current API

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


1 Files Affected:

- (modified) clang/lib/Sema/SemaDeclAttr.cpp (+1-1) 


``diff
diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp
index 82c4a3c866458..e9a867ff67ba1 100644
--- a/clang/lib/Sema/SemaDeclAttr.cpp
+++ b/clang/lib/Sema/SemaDeclAttr.cpp
@@ -9246,7 +9246,7 @@ static void handleVTablePointerAuthentication(Sema &S, 
Decl *D,
   AL.setInvalid();
 }
 
-if (!AL.isArgExpr(3) || !S.checkUInt32Argument(AL, AL.getArgAsExpr(3),
+if (!AL.isArgExpr(3) || !checkUInt32Argument(S, AL, AL.getArgAsExpr(3),
customDiscriminationValue)) 
{
   S.Diag(AL.getLoc(), diag::err_invalid_custom_discrimination);
   AL.setInvalid();

``




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


[llvm-branch-commits] [clang] [clang] Update use of checkUInt32Argument to match on main (PR #93984)

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

github-actions[bot] wrote:

⚠️ We detected that you are using a GitHub private e-mail address to contribute 
to the repo. Please turn off [Keep my email addresses 
private](https://github.com/settings/emails) setting in your account. See 
[LLVM 
Discourse](https://discourse.llvm.org/t/hidden-emails-on-github-should-we-do-something-about-it)
 for more information.

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


[llvm-branch-commits] [clang] 8ce0932 - Revert "[CUDA] Fix a couple of driver tests that really weren't being run (#9…"

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

Author: Paul T Robinson
Date: 2024-05-31T13:13:21-04:00
New Revision: 8ce093226b730338a8faacb4ef09f97bcbc17515

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

LOG: Revert "[CUDA] Fix a couple of driver tests that really weren't being run 
(#9…"

This reverts commit 97c34eb8df47543299500ee4cd0b877d184ed790.

Added: 


Modified: 
clang/test/Driver/offloading-interoperability.c
clang/test/Driver/openmp-offload-gpu.c

Removed: 




diff  --git a/clang/test/Driver/offloading-interoperability.c 
b/clang/test/Driver/offloading-interoperability.c
index 9193e12355024..6f6daf31a392e 100644
--- a/clang/test/Driver/offloading-interoperability.c
+++ b/clang/test/Driver/offloading-interoperability.c
@@ -1,7 +1,10 @@
+// REQUIRES: powerpc-registered-target
+// REQUIRES: nvptx-registered-target
+
 //
 // Verify that CUDA device commands do not get OpenMP flags.
 //
-// RUN: %clang -### -x cuda --target=powerpc64le-linux-gnu -std=c++11 
--cuda-gpu-arch=sm_35 --no-cuda-version-check -fopenmp=libomp %s 2>&1 \
+// RUN: not %clang -### -x cuda --target=powerpc64le-linux-gnu -std=c++11 
--cuda-gpu-arch=sm_35 -fopenmp=libomp %s 2>&1 \
 // RUN:   | FileCheck %s --check-prefix NO-OPENMP-FLAGS-FOR-CUDA-DEVICE
 //
 // NO-OPENMP-FLAGS-FOR-CUDA-DEVICE:  "-cc1" "-triple" "nvptx64-nvidia-cuda"

diff  --git a/clang/test/Driver/openmp-offload-gpu.c 
b/clang/test/Driver/openmp-offload-gpu.c
index 0b98aaf6ba53c..d21db7019a1aa 100644
--- a/clang/test/Driver/openmp-offload-gpu.c
+++ b/clang/test/Driver/openmp-offload-gpu.c
@@ -2,6 +2,11 @@
 /// Perform several driver tests for OpenMP offloading
 ///
 
+// REQUIRES: x86-registered-target
+// REQUIRES: powerpc-registered-target
+// REQUIRES: nvptx-registered-target
+// REQUIRES: amdgpu-registered-target
+
 /// ###
 
 /// Check -Xopenmp-target uses one of the archs provided when several archs 
are used.
@@ -300,7 +305,6 @@
 // CHECK-EMIT-LLVM-IR-BC: "-cc1"{{.*}}"-triple" 
"nvptx64-nvidia-cuda"{{.*}}"-emit-llvm-bc"
 
 // RUN:   %clang -### -fopenmp=libomp --offload-arch=sm_89 \
-// RUN:  --no-cuda-version-check \
 // RUN:  -nogpulib %s -o openmp-offload-gpu 2>&1 \
 // RUN:   | FileCheck -check-prefix=DRIVER_EMBEDDING %s
 



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


[llvm-branch-commits] [clang] [clang] Implement pointer authentication for C++ virtual functions, v-tables, and VTTs (PR #94054)

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

llvmbot wrote:




@llvm/pr-subscribers-clang-codegen

Author: Oliver Hunt (ojhunt)


Changes



---

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


53 Files Affected:

- (modified) clang/include/clang/AST/ASTContext.h (+13) 
- (modified) clang/include/clang/AST/GlobalDecl.h (+4) 
- (modified) clang/include/clang/AST/Mangle.h (+5-6) 
- (modified) clang/include/clang/AST/VTableBuilder.h (+29) 
- (modified) clang/include/clang/Basic/Attr.td (+29) 
- (modified) clang/include/clang/Basic/DiagnosticSemaKinds.td (+31) 
- (modified) clang/include/clang/Basic/PointerAuthOptions.h (+25) 
- (modified) clang/include/clang/Basic/Thunk.h (+10-3) 
- (modified) clang/include/clang/CodeGen/CodeGenABITypes.h (+4) 
- (modified) clang/include/clang/CodeGen/ConstantInitBuilder.h (+15-1) 
- (modified) clang/include/clang/InstallAPI/Visitor.h (+2-2) 
- (modified) clang/include/clang/Sema/Sema.h (+4) 
- (modified) clang/lib/AST/ASTContext.cpp (+86) 
- (modified) clang/lib/AST/ItaniumMangle.cpp (+70-7) 
- (modified) clang/lib/AST/Mangle.cpp (+17-6) 
- (modified) clang/lib/AST/MicrosoftMangle.cpp (+16-7) 
- (modified) clang/lib/AST/VTableBuilder.cpp (+101-6) 
- (modified) clang/lib/CodeGen/CGCXX.cpp (+10-1) 
- (modified) clang/lib/CodeGen/CGCXXABI.h (+8-6) 
- (modified) clang/lib/CodeGen/CGClass.cpp (+30-1) 
- (modified) clang/lib/CodeGen/CGExpr.cpp (+5-2) 
- (modified) clang/lib/CodeGen/CGExprConstant.cpp (+76-1) 
- (modified) clang/lib/CodeGen/CGPointerAuth.cpp (+239) 
- (modified) clang/lib/CodeGen/CGVTT.cpp (+5) 
- (modified) clang/lib/CodeGen/CGVTables.cpp (+38-10) 
- (modified) clang/lib/CodeGen/CodeGenFunction.cpp (+27) 
- (modified) clang/lib/CodeGen/CodeGenFunction.h (+18-2) 
- (modified) clang/lib/CodeGen/CodeGenModule.h (+19) 
- (modified) clang/lib/CodeGen/ConstantEmitter.h (+3) 
- (modified) clang/lib/CodeGen/ItaniumCXXABI.cpp (+53-19) 
- (modified) clang/lib/CodeGen/MicrosoftCXXABI.cpp (+7-2) 
- (modified) clang/lib/Frontend/CompilerInvocation.cpp (+12) 
- (modified) clang/lib/Headers/ptrauth.h (+14) 
- (modified) clang/lib/InstallAPI/Visitor.cpp (+7-6) 
- (modified) clang/lib/Parse/ParseDecl.cpp (+29-1) 
- (modified) clang/lib/Sema/SemaDeclAttr.cpp (+116) 
- (modified) clang/lib/Sema/SemaDeclCXX.cpp (+46) 
- (modified) clang/lib/Sema/SemaExpr.cpp (+33) 
- (added) clang/test/CodeGen/ptrauth-ubsan-vptr.cpp (+30) 
- (modified) clang/test/CodeGenCXX/catch-undef-behavior.cpp (+4-3) 
- (added) clang/test/CodeGenCXX/ptrauth-apple-kext-indirect-call-2.cpp (+105) 
- (added) clang/test/CodeGenCXX/ptrauth-apple-kext-indirect-call.cpp (+42) 
- (added) 
clang/test/CodeGenCXX/ptrauth-apple-kext-indirect-virtual-dtor-call.cpp (+50) 
- (added) clang/test/CodeGenCXX/ptrauth-explicit-vtable-pointer-control.cpp 
(+652) 
- (added) clang/test/CodeGenCXX/ptrauth-rtti-layout.cpp (+10) 
- (added) clang/test/CodeGenCXX/ptrauth-thunks.cpp (+28) 
- (added) clang/test/CodeGenCXX/ptrauth-virtual-function.cpp (+581) 
- (added) clang/test/CodeGenCXX/ptrauth-vtable-virtual-inheritance-thunk.cpp 
(+309) 
- (modified) clang/test/CodeGenCXX/ubsan-vtable-checks.cpp (+46-2) 
- (modified) clang/test/Misc/pragma-attribute-supported-attributes-list.test 
(+1) 
- (added) 
clang/test/SemaCXX/ptrauth-incomplete-virtual-member-function-return-arg-type.cpp
 (+50) 
- (added) clang/test/SemaCXX/vtable_pointer_authentication_attribute.cpp (+225) 
- (modified) clang/utils/TableGen/ClangAttrEmitter.cpp (+27) 


``diff
diff --git a/clang/include/clang/AST/ASTContext.h 
b/clang/include/clang/AST/ASTContext.h
index a1d1d1c51cd41..e601face9c2b6 100644
--- a/clang/include/clang/AST/ASTContext.h
+++ b/clang/include/clang/AST/ASTContext.h
@@ -37,6 +37,7 @@
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringMap.h"
 #include "llvm/ADT/StringRef.h"
+#include "llvm/ADT/StringSet.h"
 #include "llvm/ADT/TinyPtrVector.h"
 #include "llvm/Support/TypeSize.h"
 #include 
@@ -1261,6 +1262,10 @@ class ASTContext : public RefCountedBase {
   /// space.
   QualType removeAddrSpaceQualType(QualType T) const;
 
+  /// Return the "other" type-specific discriminator for the given type.
+  uint16_t
+  getPointerAuthVTablePointerDiscriminator(const CXXRecordDecl *record);
+
   /// Apply Objective-C protocol qualifiers to the given type.
   /// \param allowOnPointerType specifies if we can apply protocol
   /// qualifiers on ObjCObjectPointerType. It can be set to true when
@@ -3418,12 +3423,20 @@ OPT_LIST(V)
   /// Whether a C++ static variable or CUDA/HIP kernel should be externalized.
   bool shouldExternalize(const Decl *D) const;
 
+  /// Resolve the root record to be used to derive the vtable pointer
+  /// authentication policy for the specified record.
+  const CXXRecordDecl *baseForVTableAuthentication(const CXXRecordDecl *);
+  bool useAbbreviatedThunkName(GlobalDecl virtualMethodDecl,
+   StringRef mangledName);
+
   StringRef getCUIDHash() const;
 
 private:
   /

[llvm-branch-commits] [lldb] e6c1256 - Revert "A few updates around "transcript" (#92843)"

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

Author: gulfemsavrun
Date: 2024-05-31T20:05:03-07:00
New Revision: e6c1256867d6992d5affca539a8dab6541f8db9e

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

LOG: Revert "A few updates around "transcript" (#92843)"

This reverts commit ad884d97288c752ba9088d01cf7ab80b20e4d2a6.

Added: 


Modified: 
lldb/include/lldb/API/SBCommandInterpreter.h
lldb/include/lldb/Interpreter/CommandInterpreter.h
lldb/include/lldb/Target/Statistics.h
lldb/source/Commands/CommandObjectStats.cpp
lldb/source/Commands/Options.td
lldb/source/Interpreter/CommandInterpreter.cpp
lldb/source/Target/Statistics.cpp
lldb/test/API/commands/statistics/basic/TestStats.py
lldb/test/API/python_api/interpreter/TestCommandInterpreterAPI.py

Removed: 




diff  --git a/lldb/include/lldb/API/SBCommandInterpreter.h 
b/lldb/include/lldb/API/SBCommandInterpreter.h
index 639309aa32bfc..8ac36344b3a79 100644
--- a/lldb/include/lldb/API/SBCommandInterpreter.h
+++ b/lldb/include/lldb/API/SBCommandInterpreter.h
@@ -320,17 +320,10 @@ class SBCommandInterpreter {
 
   /// Returns a list of handled commands, output and error. Each element in
   /// the list is a dictionary with the following keys/values:
-  /// - "command" (string): The command that was given by the user.
-  /// - "commandName" (string): The name of the executed command.
-  /// - "commandArguments" (string): The arguments of the executed command.
+  /// - "command" (string): The command that was executed.
   /// - "output" (string): The output of the command. Empty ("") if no output.
   /// - "error" (string): The error of the command. Empty ("") if no error.
-  /// - "durationInSeconds" (float): The time it took to execute the command.
-  /// - "timestampInEpochSeconds" (int): The timestamp when the command is
-  ///   executed.
-  ///
-  /// Turn on settings `interpreter.save-transcript` for LLDB to populate
-  /// this list. Otherwise this list is empty.
+  /// - "seconds" (float): The time it took to execute the command.
   SBStructuredData GetTranscript();
 
 protected:

diff  --git a/lldb/include/lldb/Interpreter/CommandInterpreter.h 
b/lldb/include/lldb/Interpreter/CommandInterpreter.h
index 8863523b2e31f..ccc30cf4f1a82 100644
--- a/lldb/include/lldb/Interpreter/CommandInterpreter.h
+++ b/lldb/include/lldb/Interpreter/CommandInterpreter.h
@@ -776,14 +776,10 @@ class CommandInterpreter : public Broadcaster,
 
   /// Contains a list of handled commands and their details. Each element in
   /// the list is a dictionary with the following keys/values:
-  /// - "command" (string): The command that was given by the user.
-  /// - "commandName" (string): The name of the executed command.
-  /// - "commandArguments" (string): The arguments of the executed command.
+  /// - "command" (string): The command that was executed.
   /// - "output" (string): The output of the command. Empty ("") if no output.
   /// - "error" (string): The error of the command. Empty ("") if no error.
-  /// - "durationInSeconds" (float): The time it took to execute the command.
-  /// - "timestampInEpochSeconds" (int): The timestamp when the command is
-  ///   executed.
+  /// - "seconds" (float): The time it took to execute the command.
   ///
   /// Turn on settings `interpreter.save-transcript` for LLDB to populate
   /// this list. Otherwise this list is empty.

diff  --git a/lldb/include/lldb/Target/Statistics.h 
b/lldb/include/lldb/Target/Statistics.h
index c04d529290fff..c4f17b503a1f9 100644
--- a/lldb/include/lldb/Target/Statistics.h
+++ b/lldb/include/lldb/Target/Statistics.h
@@ -133,7 +133,6 @@ struct ConstStringStats {
 struct StatisticsOptions {
   bool summary_only = false;
   bool load_all_debug_info = false;
-  bool include_transcript = false;
 };
 
 /// A class that represents statistics for a since lldb_private::Target.

diff  --git a/lldb/source/Commands/CommandObjectStats.cpp 
b/lldb/source/Commands/CommandObjectStats.cpp
index 1935b0fdfadfb..a92bb5d1165ee 100644
--- a/lldb/source/Commands/CommandObjectStats.cpp
+++ b/lldb/source/Commands/CommandObjectStats.cpp
@@ -81,9 +81,6 @@ class CommandObjectStatsDump : public CommandObjectParsed {
   case 'f':
 m_stats_options.load_all_debug_info = true;
 break;
-  case 't':
-m_stats_options.include_transcript = true;
-break;
   default:
 llvm_unreachable("Unimplemented option");
   }

diff  --git a/lldb/source/Commands/Options.td b/lldb/source/Commands/Options.td
index 194902abdce49..62bbfdc117834 100644
--- a/lldb/source/Commands/Options.td
+++ b/lldb/source/Commands/Options.td
@@ -1425,8 +1425,4 @@ let Command = "statistics dump" in {
 Desc<"Dump the total possible debug info statistics. "
 "Force loading all the debug information 

[llvm-branch-commits] [clang] release/18.x: [clang-format] Don't always break before << between str… (PR #94091)

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

llvmbot wrote:




@llvm/pr-subscribers-clang-format

Author: Owen Pan (owenca)


Changes

…ing literals (#92214)

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


2 Files Affected:

- (modified) clang/lib/Format/TokenAnnotator.cpp (+5-3) 
- (modified) clang/unittests/Format/FormatTest.cpp (+11) 


``diff
diff --git a/clang/lib/Format/TokenAnnotator.cpp 
b/clang/lib/Format/TokenAnnotator.cpp
index c1f1662481922..628fe46cc348e 100644
--- a/clang/lib/Format/TokenAnnotator.cpp
+++ b/clang/lib/Format/TokenAnnotator.cpp
@@ -5159,9 +5159,11 @@ bool TokenAnnotator::mustBreakBefore(const AnnotatedLine 
&Line,
 return true;
   if (Left.IsUnterminatedLiteral)
 return true;
-  if (Right.is(tok::lessless) && Right.Next && Left.is(tok::string_literal) &&
-  Right.Next->is(tok::string_literal)) {
-return true;
+  if (const auto *BeforeLeft = Left.Previous, *AfterRight = Right.Next;
+  BeforeLeft && BeforeLeft->is(tok::lessless) &&
+  Left.is(tok::string_literal) && Right.is(tok::lessless) && AfterRight &&
+  AfterRight->is(tok::string_literal)) {
+return Right.NewlinesBefore > 0;
   }
   if (Right.is(TT_RequiresClause)) {
 switch (Style.RequiresClausePosition) {
diff --git a/clang/unittests/Format/FormatTest.cpp 
b/clang/unittests/Format/FormatTest.cpp
index 0161a1685eb12..d69632f7f0f8c 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -10426,6 +10426,17 @@ TEST_F(FormatTest, KeepStringLabelValuePairsOnALine) {
   "  bbb);");
 }
 
+TEST_F(FormatTest, WrapBeforeInsertionOperatorbetweenStringLiterals) {
+  verifyFormat("QStringList() << \"foo\" << \"bar\";");
+
+  verifyNoChange("QStringList() << \"foo\"\n"
+ "  << \"bar\";");
+
+  verifyFormat("log_error(log, \"foo\" << \"bar\");",
+   "log_error(log, \"foo\"\n"
+   "   << \"bar\");");
+}
+
 TEST_F(FormatTest, UnderstandsEquals) {
   verifyFormat(
   "a =\n"

``




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


[llvm-branch-commits] [clang] release/18.x: [clang-format] Don't always break before << between str… (PR #94091)

2024-06-01 Thread via llvm-branch-commits

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


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


[llvm-branch-commits] [clang] [clang] Implement pointer authentication for C++ virtual functions, v-tables, and VTTs (PR #94056)

2024-06-01 Thread via llvm-branch-commits

llvmbot wrote:




@llvm/pr-subscribers-clang-codegen

Author: Oliver Hunt (ojhunt)


Changes



---

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


53 Files Affected:

- (modified) clang/include/clang/AST/ASTContext.h (+13) 
- (modified) clang/include/clang/AST/GlobalDecl.h (+4) 
- (modified) clang/include/clang/AST/Mangle.h (+5-6) 
- (modified) clang/include/clang/AST/VTableBuilder.h (+29) 
- (modified) clang/include/clang/Basic/Attr.td (+29) 
- (modified) clang/include/clang/Basic/DiagnosticSemaKinds.td (+31) 
- (modified) clang/include/clang/Basic/PointerAuthOptions.h (+25) 
- (modified) clang/include/clang/Basic/Thunk.h (+10-3) 
- (modified) clang/include/clang/CodeGen/CodeGenABITypes.h (+4) 
- (modified) clang/include/clang/CodeGen/ConstantInitBuilder.h (+15-1) 
- (modified) clang/include/clang/InstallAPI/Visitor.h (+2-2) 
- (modified) clang/include/clang/Sema/Sema.h (+4) 
- (modified) clang/lib/AST/ASTContext.cpp (+86) 
- (modified) clang/lib/AST/ItaniumMangle.cpp (+70-7) 
- (modified) clang/lib/AST/Mangle.cpp (+17-6) 
- (modified) clang/lib/AST/MicrosoftMangle.cpp (+16-7) 
- (modified) clang/lib/AST/VTableBuilder.cpp (+101-6) 
- (modified) clang/lib/CodeGen/CGCXX.cpp (+10-1) 
- (modified) clang/lib/CodeGen/CGCXXABI.h (+8-6) 
- (modified) clang/lib/CodeGen/CGClass.cpp (+30-1) 
- (modified) clang/lib/CodeGen/CGExpr.cpp (+5-2) 
- (modified) clang/lib/CodeGen/CGExprConstant.cpp (+76-1) 
- (modified) clang/lib/CodeGen/CGPointerAuth.cpp (+239) 
- (modified) clang/lib/CodeGen/CGVTT.cpp (+5) 
- (modified) clang/lib/CodeGen/CGVTables.cpp (+38-10) 
- (modified) clang/lib/CodeGen/CodeGenFunction.cpp (+27) 
- (modified) clang/lib/CodeGen/CodeGenFunction.h (+18-2) 
- (modified) clang/lib/CodeGen/CodeGenModule.h (+19) 
- (modified) clang/lib/CodeGen/ConstantEmitter.h (+3) 
- (modified) clang/lib/CodeGen/ItaniumCXXABI.cpp (+53-19) 
- (modified) clang/lib/CodeGen/MicrosoftCXXABI.cpp (+7-2) 
- (modified) clang/lib/Frontend/CompilerInvocation.cpp (+12) 
- (modified) clang/lib/Headers/ptrauth.h (+14) 
- (modified) clang/lib/InstallAPI/Visitor.cpp (+7-6) 
- (modified) clang/lib/Parse/ParseDecl.cpp (+29-1) 
- (modified) clang/lib/Sema/SemaDeclAttr.cpp (+116) 
- (modified) clang/lib/Sema/SemaDeclCXX.cpp (+46) 
- (modified) clang/lib/Sema/SemaExpr.cpp (+33) 
- (added) clang/test/CodeGen/ptrauth-ubsan-vptr.cpp (+30) 
- (modified) clang/test/CodeGenCXX/catch-undef-behavior.cpp (+4-3) 
- (added) clang/test/CodeGenCXX/ptrauth-apple-kext-indirect-call-2.cpp (+105) 
- (added) clang/test/CodeGenCXX/ptrauth-apple-kext-indirect-call.cpp (+42) 
- (added) 
clang/test/CodeGenCXX/ptrauth-apple-kext-indirect-virtual-dtor-call.cpp (+50) 
- (added) clang/test/CodeGenCXX/ptrauth-explicit-vtable-pointer-control.cpp 
(+652) 
- (added) clang/test/CodeGenCXX/ptrauth-rtti-layout.cpp (+10) 
- (added) clang/test/CodeGenCXX/ptrauth-thunks.cpp (+28) 
- (added) clang/test/CodeGenCXX/ptrauth-virtual-function.cpp (+581) 
- (added) clang/test/CodeGenCXX/ptrauth-vtable-virtual-inheritance-thunk.cpp 
(+309) 
- (modified) clang/test/CodeGenCXX/ubsan-vtable-checks.cpp (+46-2) 
- (modified) clang/test/Misc/pragma-attribute-supported-attributes-list.test 
(+1) 
- (added) 
clang/test/SemaCXX/ptrauth-incomplete-virtual-member-function-return-arg-type.cpp
 (+50) 
- (added) clang/test/SemaCXX/vtable_pointer_authentication_attribute.cpp (+225) 
- (modified) clang/utils/TableGen/ClangAttrEmitter.cpp (+27) 


``diff
diff --git a/clang/include/clang/AST/ASTContext.h 
b/clang/include/clang/AST/ASTContext.h
index a1d1d1c51cd41..e601face9c2b6 100644
--- a/clang/include/clang/AST/ASTContext.h
+++ b/clang/include/clang/AST/ASTContext.h
@@ -37,6 +37,7 @@
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringMap.h"
 #include "llvm/ADT/StringRef.h"
+#include "llvm/ADT/StringSet.h"
 #include "llvm/ADT/TinyPtrVector.h"
 #include "llvm/Support/TypeSize.h"
 #include 
@@ -1261,6 +1262,10 @@ class ASTContext : public RefCountedBase {
   /// space.
   QualType removeAddrSpaceQualType(QualType T) const;
 
+  /// Return the "other" type-specific discriminator for the given type.
+  uint16_t
+  getPointerAuthVTablePointerDiscriminator(const CXXRecordDecl *record);
+
   /// Apply Objective-C protocol qualifiers to the given type.
   /// \param allowOnPointerType specifies if we can apply protocol
   /// qualifiers on ObjCObjectPointerType. It can be set to true when
@@ -3418,12 +3423,20 @@ OPT_LIST(V)
   /// Whether a C++ static variable or CUDA/HIP kernel should be externalized.
   bool shouldExternalize(const Decl *D) const;
 
+  /// Resolve the root record to be used to derive the vtable pointer
+  /// authentication policy for the specified record.
+  const CXXRecordDecl *baseForVTableAuthentication(const CXXRecordDecl *);
+  bool useAbbreviatedThunkName(GlobalDecl virtualMethodDecl,
+   StringRef mangledName);
+
   StringRef getCUIDHash() const;
 
 private:
   /

[llvm-branch-commits] [llvm] release/18.x: [DAGCombiner] In mergeTruncStore, make sure we aren't storing shifted in bits. (#90939) (PR #91038)

2024-06-01 Thread via llvm-branch-commits

https://github.com/AtariDreams closed 
https://github.com/llvm/llvm-project/pull/91038
___
llvm-branch-commits mailing list
[email protected]
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)

2024-06-01 Thread via llvm-branch-commits

https://github.com/AtariDreams reopened 
https://github.com/llvm/llvm-project/pull/91038
___
llvm-branch-commits mailing list
[email protected]
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)

2024-06-01 Thread via llvm-branch-commits

https://github.com/AtariDreams updated 
https://github.com/llvm/llvm-project/pull/91038

>From 094e4fbb65a5f24474cbe556f895ee784f6bdffb Mon Sep 17 00:00:00 2001
From: Craig Topper 
Date: Fri, 3 May 2024 09:59:33 -0700
Subject: [PATCH 1/2] [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 5038f8a1fc156..4951e45edb9ed 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 0..38cda8d388945
--- /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
+}

>From fa3758ab061aaf545bfbbd611992c9cd23a80390 Mon Sep 17 00:00:00 2001
From: AtariDreams 
Date: Sat, 1 Jun 2024 21:54:37 -0400
Subject: [PATCH 2/2] Update DAGCombiner.cpp

---
 llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp 
b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index 4951e45edb9ed..c8f7a0bfbd4b3 100644
--- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -8952,7 +8952,7 @@ SDValue DAGCombiner::mergeTruncStores(StoreSDNode *N) {
   if (ShiftAmtC % NarrowNumBits != 0)
 return SDValue();
 
-  // Make sure we aren't reading bits that are shifted in.
+  // Make sure we aren't reading the bits that are shifted in.
   if (ShiftAmtC > WideVal.getScalarValueSizeInBits() - NarrowNumBits)
 return SDValue();
 

___
llvm-branch-commits mailing list
[email protected]
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)

2024-06-01 Thread via llvm-branch-commits

https://github.com/AtariDreams updated 
https://github.com/llvm/llvm-project/pull/91038

>From 094e4fbb65a5f24474cbe556f895ee784f6bdffb Mon Sep 17 00:00:00 2001
From: Craig Topper 
Date: Fri, 3 May 2024 09:59:33 -0700
Subject: [PATCH 1/3] [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 5038f8a1fc156..4951e45edb9ed 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 0..38cda8d388945
--- /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
+}

>From fa3758ab061aaf545bfbbd611992c9cd23a80390 Mon Sep 17 00:00:00 2001
From: AtariDreams 
Date: Sat, 1 Jun 2024 21:54:37 -0400
Subject: [PATCH 2/3] Update DAGCombiner.cpp

---
 llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp 
b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index 4951e45edb9ed..c8f7a0bfbd4b3 100644
--- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -8952,7 +8952,7 @@ SDValue DAGCombiner::mergeTruncStores(StoreSDNode *N) {
   if (ShiftAmtC % NarrowNumBits != 0)
 return SDValue();
 
-  // Make sure we aren't reading bits that are shifted in.
+  // Make sure we aren't reading the bits that are shifted in.
   if (ShiftAmtC > WideVal.getScalarValueSizeInBits() - NarrowNumBits)
 return SDValue();
 

>From 2eb8863a43c88b63433f91580a83862e60702c99 Mon Sep 17 00:00:00 2001
From: AtariDreams 
Date: Sat, 1 Jun 2024 21:55:02 -0400
Subject: [PATCH 3/3] Update DAGCombiner.cpp

---
 llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp 
b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index c8f7a0bfbd4b3..4951e45edb9ed 100644
--- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -8952,7 +8952,7 @@ SDValue DAGCombiner::mergeTruncStores(StoreSDNode *N) {
   if (ShiftAmtC % NarrowNumBits != 0)
 return SDValue();
 
-  // Make sure we aren't reading the bits that are shifted in.
+  // Make sure we aren't reading bits that are shifted in.
   if (ShiftAmtC > WideVal.getScalarValueSizeInBits() - NarrowNumBits)
 return SDValue();
 

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


[llvm-branch-commits] [clang] [clang][test] remove unused `run` overload in `BoundNodesCallback` (PR #94244)

2024-06-03 Thread via llvm-branch-commits

llvmbot wrote:




@llvm/pr-subscribers-clang

Author: Julian Schmidt (5chmidti)


Changes

The overload that did not take the additional `ASTContext *` argument is 
unnecessary when the context could simply be commented out, as it is always 
passed to `run` from `VerifyMatcher::run`.
This patch removes the single-argument overload in favor of having a single 
overload.

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


3 Files Affected:

- (modified) clang/unittests/ASTMatchers/ASTMatchersNodeTest.cpp (-2) 
- (modified) clang/unittests/ASTMatchers/ASTMatchersTest.h (+1-6) 
- (modified) clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp (+3-6) 


``diff
diff --git a/clang/unittests/ASTMatchers/ASTMatchersNodeTest.cpp 
b/clang/unittests/ASTMatchers/ASTMatchersNodeTest.cpp
index aed6a6408adc9..dd98fbdce3945 100644
--- a/clang/unittests/ASTMatchers/ASTMatchersNodeTest.cpp
+++ b/clang/unittests/ASTMatchers/ASTMatchersNodeTest.cpp
@@ -2030,8 +2030,6 @@ TEST_P(ASTMatchersTest,
 template 
 class VerifyAncestorHasChildIsEqual : public BoundNodesCallback {
 public:
-  bool run(const BoundNodes *Nodes) override { return false; }
-
   bool run(const BoundNodes *Nodes, ASTContext *Context) override {
 const T *Node = Nodes->getNodeAs("");
 return verify(*Nodes, *Context, Node);
diff --git a/clang/unittests/ASTMatchers/ASTMatchersTest.h 
b/clang/unittests/ASTMatchers/ASTMatchersTest.h
index e981299531574..ad2f5f355621c 100644
--- a/clang/unittests/ASTMatchers/ASTMatchersTest.h
+++ b/clang/unittests/ASTMatchers/ASTMatchersTest.h
@@ -28,7 +28,6 @@ using clang::tooling::runToolOnCodeWithArgs;
 class BoundNodesCallback {
 public:
   virtual ~BoundNodesCallback() {}
-  virtual bool run(const BoundNodes *BoundNodes) = 0;
   virtual bool run(const BoundNodes *BoundNodes, ASTContext *Context) = 0;
   virtual void onEndOfTranslationUnit() {}
 };
@@ -403,7 +402,7 @@ template  class VerifyIdIsBoundTo : public 
BoundNodesCallback {
 EXPECT_EQ("", Name);
   }
 
-  bool run(const BoundNodes *Nodes) override {
+  bool run(const BoundNodes *Nodes, ASTContext * /*Context*/) override {
 const BoundNodes::IDToNodeMap &M = Nodes->getMap();
 if (Nodes->getNodeAs(Id)) {
   ++Count;
@@ -426,10 +425,6 @@ template  class VerifyIdIsBoundTo : public 
BoundNodesCallback {
 return false;
   }
 
-  bool run(const BoundNodes *Nodes, ASTContext *Context) override {
-return run(Nodes);
-  }
-
 private:
   const std::string Id;
   const int ExpectedCount;
diff --git a/clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp 
b/clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp
index ada3be287ed59..6bb402caa4d6d 100644
--- a/clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp
+++ b/clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp
@@ -5641,7 +5641,6 @@ TEST(HasParent, MatchesAllParents) {
 TEST(HasParent, NoDuplicateParents) {
   class HasDuplicateParents : public BoundNodesCallback {
   public:
-bool run(const BoundNodes *Nodes) override { return false; }
 bool run(const BoundNodes *Nodes, ASTContext *Context) override {
   const Stmt *Node = Nodes->getNodeAs("node");
   std::set Parents;
@@ -5850,16 +5849,14 @@ template  class VerifyMatchOnNode : public 
BoundNodesCallback {
 public:
   VerifyMatchOnNode(StringRef Id, const internal::Matcher &InnerMatcher,
 StringRef InnerId)
-: Id(Id), InnerMatcher(InnerMatcher), InnerId(InnerId) {
-  }
-
-  bool run(const BoundNodes *Nodes) override { return false; }
+  : Id(Id), InnerMatcher(InnerMatcher), InnerId(InnerId) {}
 
   bool run(const BoundNodes *Nodes, ASTContext *Context) override {
 const T *Node = Nodes->getNodeAs(Id);
 return selectFirst(InnerId, match(InnerMatcher, *Node, *Context)) !=
-  nullptr;
+   nullptr;
   }
+
 private:
   std::string Id;
   internal::Matcher InnerMatcher;

``




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


[llvm-branch-commits] [SPARC][IAS] Add support for %uhi and %ulo extensions (PR #94246)

2024-06-03 Thread via llvm-branch-commits

https://github.com/koachan created 
https://github.com/llvm/llvm-project/pull/94246

This adds support for GNU %uhi and %ulo extensions.
Those resolve to the same relocations as %hh and %hm.



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


[llvm-branch-commits] [SPARC][IAS] Add aliases for %asr20-21 as defined in JPS1 (PR #94247)

2024-06-03 Thread via llvm-branch-commits

https://github.com/koachan created 
https://github.com/llvm/llvm-project/pull/94247

This adds %set_softint and %clear_softint alias for %asr20 and %asr21
as defined in JPS1.



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


[llvm-branch-commits] [SPARC][IAS] Add support for %uhi and %ulo extensions (PR #94246)

2024-06-03 Thread via llvm-branch-commits

llvmbot wrote:




@llvm/pr-subscribers-backend-sparc

Author: Koakuma (koachan)


Changes

This adds support for GNU %uhi and %ulo extensions.
Those resolve to the same relocations as %hh and %hm.


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


2 Files Affected:

- (modified) llvm/lib/Target/Sparc/MCTargetDesc/SparcMCExpr.cpp (+40-38) 
- (modified) llvm/test/MC/Sparc/sparc-relocations.s (+10) 


``diff
diff --git a/llvm/lib/Target/Sparc/MCTargetDesc/SparcMCExpr.cpp 
b/llvm/lib/Target/Sparc/MCTargetDesc/SparcMCExpr.cpp
index 522a8877a1c60..4688837e435e5 100644
--- a/llvm/lib/Target/Sparc/MCTargetDesc/SparcMCExpr.cpp
+++ b/llvm/lib/Target/Sparc/MCTargetDesc/SparcMCExpr.cpp
@@ -93,44 +93,46 @@ bool SparcMCExpr::printVariantKind(raw_ostream &OS, 
VariantKind Kind)
 SparcMCExpr::VariantKind SparcMCExpr::parseVariantKind(StringRef name)
 {
   return StringSwitch(name)
-.Case("lo",  VK_Sparc_LO)
-.Case("hi",  VK_Sparc_HI)
-.Case("h44", VK_Sparc_H44)
-.Case("m44", VK_Sparc_M44)
-.Case("l44", VK_Sparc_L44)
-.Case("hh",  VK_Sparc_HH)
-.Case("hm",  VK_Sparc_HM)
-.Case("lm",  VK_Sparc_LM)
-.Case("pc22",  VK_Sparc_PC22)
-.Case("pc10",  VK_Sparc_PC10)
-.Case("got22", VK_Sparc_GOT22)
-.Case("got10", VK_Sparc_GOT10)
-.Case("got13", VK_Sparc_GOT13)
-.Case("r_disp32",   VK_Sparc_R_DISP32)
-.Case("tgd_hi22",   VK_Sparc_TLS_GD_HI22)
-.Case("tgd_lo10",   VK_Sparc_TLS_GD_LO10)
-.Case("tgd_add",VK_Sparc_TLS_GD_ADD)
-.Case("tgd_call",   VK_Sparc_TLS_GD_CALL)
-.Case("tldm_hi22",  VK_Sparc_TLS_LDM_HI22)
-.Case("tldm_lo10",  VK_Sparc_TLS_LDM_LO10)
-.Case("tldm_add",   VK_Sparc_TLS_LDM_ADD)
-.Case("tldm_call",  VK_Sparc_TLS_LDM_CALL)
-.Case("tldo_hix22", VK_Sparc_TLS_LDO_HIX22)
-.Case("tldo_lox10", VK_Sparc_TLS_LDO_LOX10)
-.Case("tldo_add",   VK_Sparc_TLS_LDO_ADD)
-.Case("tie_hi22",   VK_Sparc_TLS_IE_HI22)
-.Case("tie_lo10",   VK_Sparc_TLS_IE_LO10)
-.Case("tie_ld", VK_Sparc_TLS_IE_LD)
-.Case("tie_ldx",VK_Sparc_TLS_IE_LDX)
-.Case("tie_add",VK_Sparc_TLS_IE_ADD)
-.Case("tle_hix22",  VK_Sparc_TLS_LE_HIX22)
-.Case("tle_lox10",  VK_Sparc_TLS_LE_LOX10)
-.Case("hix",VK_Sparc_HIX22)
-.Case("lox",VK_Sparc_LOX10)
-.Case("gdop_hix22", VK_Sparc_GOTDATA_HIX22)
-.Case("gdop_lox10", VK_Sparc_GOTDATA_LOX10)
-.Case("gdop",   VK_Sparc_GOTDATA_OP)
-.Default(VK_Sparc_None);
+  .Case("lo", VK_Sparc_LO)
+  .Case("hi", VK_Sparc_HI)
+  .Case("h44", VK_Sparc_H44)
+  .Case("m44", VK_Sparc_M44)
+  .Case("l44", VK_Sparc_L44)
+  .Case("hh", VK_Sparc_HH)
+  .Case("uhi", VK_Sparc_HH) // Nonstandard GNU extension
+  .Case("hm", VK_Sparc_HM)
+  .Case("ulo", VK_Sparc_HM) // Nonstandard GNU extension
+  .Case("lm", VK_Sparc_LM)
+  .Case("pc22", VK_Sparc_PC22)
+  .Case("pc10", VK_Sparc_PC10)
+  .Case("got22", VK_Sparc_GOT22)
+  .Case("got10", VK_Sparc_GOT10)
+  .Case("got13", VK_Sparc_GOT13)
+  .Case("r_disp32", VK_Sparc_R_DISP32)
+  .Case("tgd_hi22", VK_Sparc_TLS_GD_HI22)
+  .Case("tgd_lo10", VK_Sparc_TLS_GD_LO10)
+  .Case("tgd_add", VK_Sparc_TLS_GD_ADD)
+  .Case("tgd_call", VK_Sparc_TLS_GD_CALL)
+  .Case("tldm_hi22", VK_Sparc_TLS_LDM_HI22)
+  .Case("tldm_lo10", VK_Sparc_TLS_LDM_LO10)
+  .Case("tldm_add", VK_Sparc_TLS_LDM_ADD)
+  .Case("tldm_call", VK_Sparc_TLS_LDM_CALL)
+  .Case("tldo_hix22", VK_Sparc_TLS_LDO_HIX22)
+  .Case("tldo_lox10", VK_Sparc_TLS_LDO_LOX10)
+  .Case("tldo_add", VK_Sparc_TLS_LDO_ADD)
+  .Case("tie_hi22", VK_Sparc_TLS_IE_HI22)
+  .Case("tie_lo10", VK_Sparc_TLS_IE_LO10)
+  .Case("tie_ld", VK_Sparc_TLS_IE_LD)
+  .Case("tie_ldx", VK_Sparc_TLS_IE_LDX)
+  .Case("tie_add", VK_Sparc_TLS_IE_ADD)
+  .Case("tle_hix22", VK_Sparc_TLS_LE_HIX22)
+  .Case("tle_lox10", VK_Sparc_TLS_LE_LOX10)
+  .Case("hix", VK_Sparc_HIX22)
+  .Case("lox", VK_Sparc_LOX10)
+  .Case("gdop_hix22", VK_Sparc_GOTDATA_HIX22)
+  .Case("gdop_lox10", VK_Sparc_GOTDATA_LOX10)
+  .Case("gdop", VK_Sparc_GOTDATA_OP)
+  .Default(VK_Sparc_None);
 }
 
 Sparc::Fixups SparcMCExpr::getFixupKind(SparcMCExpr::VariantKind Kind) {
diff --git a/llvm/test/MC/Sparc/sparc-relocations.s 
b/llvm/test/MC/Sparc/sparc-relocations.s
index d99ddb7e2f802..82314e440acf6 100644
--- a/llvm/test/MC/Sparc/sparc-relocations.s
+++ b/llvm/test/MC/Sparc/sparc-relocations.s
@@ -10,6 +10,8 @@
 ! CHECK-OBJ-NEXT: 0x{{[0-9,A-F]+}} R_SPARC_M44 sym
 ! CHECK-OBJ-NEXT: 0x{{[0-9,A-F]+}} R_SPARC_L44 sym
 ! CHECK-OBJ-NEXT: 0x{{[0-9,A-F]+}} R_SPARC_HH22 sym
+! CHECK-OBJ-NEXT: 0x{{[0-9,A-F]+}} R_SPARC_HH22 sym
+! CHECK-OBJ-NEXT: 0x{{[0-9,A-F]+}} R_SPARC_HM10 sym
 ! CHECK-OBJ-NEXT: 0x{{[0-9,A-F]+}} R_SPARC_HM10 sym
 ! CHECK-OBJ-NEXT: 0x{{[0-9,A-F]+}} R_SPARC_LM22 sym
 ! CHECK-OBJ-NEXT: 0x{{[0-9,A-F]+}} R

[llvm-branch-commits] [SPARC][IAS] Add named prefetch tag constants (PR #94249)

2024-06-03 Thread via llvm-branch-commits

https://github.com/koachan created 
https://github.com/llvm/llvm-project/pull/94249

This adds named tag constants (such as `#one_write` and `#one_read`)
for the prefetch instruction.



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


[llvm-branch-commits] [SPARC][IAS] Add support for `prefetcha` instruction (PR #94250)

2024-06-03 Thread via llvm-branch-commits

https://github.com/koachan created 
https://github.com/llvm/llvm-project/pull/94250

This adds support for `prefetcha` instruction for prefetching from
alternate address spaces.



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


[llvm-branch-commits] [SPARC][IAS] Add aliases for %asr20-21 as defined in JPS1 (PR #94247)

2024-06-03 Thread via llvm-branch-commits

llvmbot wrote:



@llvm/pr-subscribers-mc

@llvm/pr-subscribers-backend-sparc

Author: Koakuma (koachan)


Changes

This adds %set_softint and %clear_softint alias for %asr20 and %asr21
as defined in JPS1.


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


2 Files Affected:

- (modified) llvm/lib/Target/Sparc/AsmParser/SparcAsmParser.cpp (+9-2) 
- (modified) llvm/test/MC/Sparc/sparcv9-instructions.s (+4) 


``diff
diff --git a/llvm/lib/Target/Sparc/AsmParser/SparcAsmParser.cpp 
b/llvm/lib/Target/Sparc/AsmParser/SparcAsmParser.cpp
index 185b2fe90c6cb..e4f5c64f9d00e 100644
--- a/llvm/lib/Target/Sparc/AsmParser/SparcAsmParser.cpp
+++ b/llvm/lib/Target/Sparc/AsmParser/SparcAsmParser.cpp
@@ -1384,12 +1384,11 @@ MCRegister SparcAsmParser::matchRegisterName(const 
AsmToken &Tok,
   }
 
   // JPS1 extension - aliases for ASRs
-  // Section A.51 - Read State Register
+  // Section 5.2.11 - Ancillary State Registers (ASRs)
   if (Name == "pcr") {
 RegKind = SparcOperand::rk_Special;
 return SP::ASR16;
   }
-
   if (Name == "pic") {
 RegKind = SparcOperand::rk_Special;
 return SP::ASR17;
@@ -1402,6 +1401,14 @@ MCRegister SparcAsmParser::matchRegisterName(const 
AsmToken &Tok,
 RegKind = SparcOperand::rk_Special;
 return SP::ASR19;
   }
+  if (Name == "set_softint") {
+RegKind = SparcOperand::rk_Special;
+return SP::ASR20;
+  }
+  if (Name == "clear_softint") {
+RegKind = SparcOperand::rk_Special;
+return SP::ASR21;
+  }
   if (Name == "softint") {
 RegKind = SparcOperand::rk_Special;
 return SP::ASR22;
diff --git a/llvm/test/MC/Sparc/sparcv9-instructions.s 
b/llvm/test/MC/Sparc/sparcv9-instructions.s
index b947243f8258f..d461c82467471 100644
--- a/llvm/test/MC/Sparc/sparcv9-instructions.s
+++ b/llvm/test/MC/Sparc/sparcv9-instructions.s
@@ -502,6 +502,10 @@
 wr %i0, %i1, %ccr
 ! V9: wr %i0, 1, %ccr   ! encoding: [0x85,0x86,0x20,0x01]
 wr %i0, 1, %ccr
+! V9: wr %i0, 1, %asr20 ! encoding: [0xa9,0x86,0x20,0x01]
+wr %i0, 1, %set_softint
+! V9: wr %i0, 1, %asr21 ! encoding: [0xab,0x86,0x20,0x01]
+wr %i0, 1, %clear_softint
 
 ! V9: st %o1, [%o0] ! encoding: [0xd2,0x22,0x00,0x00]
 stw %o1, [%o0]

``




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


[llvm-branch-commits] [SPARC][IAS] Handle the case of non-4-byte aligned writeNopData (PR #94251)

2024-06-03 Thread via llvm-branch-commits

https://github.com/koachan created 
https://github.com/llvm/llvm-project/pull/94251

If the Count passed into writeNopData is not a multiple of four,
add a little amount of zeros before writing the NOP stream.
This makes it match the behavior of GNU binutils.



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


[llvm-branch-commits] [clang] [clang][test] add testing for the AST matcher reference (PR #94248)

2024-06-03 Thread via llvm-branch-commits

llvmbot wrote:




@llvm/pr-subscribers-clang

Author: Julian Schmidt (5chmidti)


Changes

Previously, the examples in the AST matcher reference, which gets generated by 
the doxygen comments in `ASTMatchers.h`, were untested and best effort.
Some of the matchers had no or wrong examples of how to use the matcher.

This patch introduces a simple DSL around doxygen commands to enable testing 
the AST matcher documentation in a way that should be relatively easy.
In `ASTMatchers.h`, most matchers are documented with a doxygen comment. Most 
of these also have a code example that aims to show what the matcher will 
match, given a matcher somewhere in the documentation text. The way that 
testing the documentation is done, is by using doxygens alias feature to 
declare custom aliases. These aliases forward to `text` 
(which is what doxygens \c does, but for multiple words). Using the doxygen 
aliases was the obvious choice, because there are (now) four consumers:
 - people reading the header/using signature help
 - the doxygen generated documentation
 - the generated html AST matcher reference
 - (new) the generated matcher tests

This patch rewrites/extends the documentation such that all matchers have a 
documented example.
The new `generate_ast_matcher_doc_tests.py` script will warn on any 
undocumented matchers (but not on matchers without a doxygen comment) and 
provides diagnostics and statistics about the matchers. Below is a file-level 
comment from the test generation script that describes how documenting matchers 
to be tested works on a slightly more technical level. In general, the new 
comments can be used as a reference for how to implement a tested documentation.

The current statistics emitted by the parser are:

```text
Statistics:
doxygen_blocks:   519
missing_tests :10
skipped_objc  :42
code_snippets :   503
matches   :   820
matchers  :   580
tested_matchers   :   574
none_type_matchers: 6
```

The tests are generated during building and the script will only print 
something if it found an issue (compile failure, parsing issues, the expected 
and actual number of failures differs).

DSL for generating the tests from documentation.

TLDR:
The order for a single code snippet example is:

  \header{a.h}
  \endheader <- zero or more header

  \code
int a = 42;
  \endcode
  \compile_args{-std=c++,c23-or-later} <- optional, supports std ranges and
  whole languages

  \matcher{expr()} <- one or more matchers in succession
  \match{42}   <- one or more matches in succession

  \matcher{varDecl()} <- new matcher resets the context, the above
 \match will not count for this new
 matcher(-group)
  \match{int a  = 42} <- only applies to the previous matcher (no the
 previous case)

The above block can be repeated inside a doxygen command for multiple code 
examples.

Language Grammar:
  [] denotes an optional, and <> denotes user-input

  compile_args j:= \compile_args{[;]}
  matcher_tag_key ::= type
  match_tag_key ::= type || std || count
  matcher_tags ::= [matcher_tag_key=;]matcher_tag_key=
  match_tags ::= [match_tag_key=;]match_tag_key=
  matcher ::= \matcher{[matcher_tags$]}
  matchers ::= [matcher] matcher
  match ::= \match{[match_tags$]}
  matches ::= [match] match
  case ::= matchers matches
  cases ::= [case] case
  header-block ::= \header{}  \endheader
  code-block ::= \code  \endcode
  testcase ::= code-block [compile_args] cases

The 'std' tag and '\compile_args' support specifying a specific language 
version, a whole language and all of its versions, and thresholds (implies 
ranges). Multiple arguments are passed with a ',' separator. For a language and 
version to execute a tested matcher, it has to match the specified 
'\compile_args' for the code, and the 'std' tag for the matcher. Predicates for 
the 'std' compiler flag are used with disjunction between languages (e.g. 'c || 
c++') and conjunction for all predicates specific to each language (e.g. 
'c++11-or-later && c++23-or-earlier').

Examples:
 - call available versions of C
 - c++11only C++11
 - c++11-or-later   C++11 or later
 - c++11-or-earlier C++11 or earlier
 - c++11-or-later,c++23-or-earlier,call of C and C++ between 11 and
  23 (inclusive)
 - c++11-23,c same as above

Tags:

  Type:
  Match types are used to select where the string that is used to check if
  a node matches comes from.
  Available: code, name, typestr, typeofst

[llvm-branch-commits] [SPARC][IAS] Add movr(n)e alias for movr(n)z (PR #94252)


https://github.com/koachan created 
https://github.com/llvm/llvm-project/pull/94252

This adds the alternate mnemonics for movrz and movrnz.



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


[llvm-branch-commits] [SPARC][IAS] Add named prefetch tag constants (PR #94249)


llvmbot wrote:




@llvm/pr-subscribers-backend-sparc

Author: Koakuma (koachan)


Changes

This adds named tag constants (such as `#one_write` and `#one_read`)
for the prefetch instruction.


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


11 Files Affected:

- (modified) llvm/lib/Target/Sparc/AsmParser/SparcAsmParser.cpp (+56-1) 
- (modified) llvm/lib/Target/Sparc/MCTargetDesc/SparcInstPrinter.cpp (+11) 
- (modified) llvm/lib/Target/Sparc/MCTargetDesc/SparcInstPrinter.h (+2) 
- (modified) llvm/lib/Target/Sparc/MCTargetDesc/SparcMCTargetDesc.cpp (+5) 
- (modified) llvm/lib/Target/Sparc/MCTargetDesc/SparcMCTargetDesc.h (+11) 
- (modified) llvm/lib/Target/Sparc/Sparc.td (+2) 
- (modified) llvm/lib/Target/Sparc/SparcASITags.td (-2) 
- (modified) llvm/lib/Target/Sparc/SparcInstrInfo.td (+12-2) 
- (added) llvm/lib/Target/Sparc/SparcPrefetchTags.td (+41) 
- (modified) llvm/test/MC/Disassembler/Sparc/sparc-v9.txt (+2-2) 
- (modified) llvm/test/MC/Sparc/sparcv9-instructions.s (+14-4) 


``diff
diff --git a/llvm/lib/Target/Sparc/AsmParser/SparcAsmParser.cpp 
b/llvm/lib/Target/Sparc/AsmParser/SparcAsmParser.cpp
index e4f5c64f9d00e..a0dec24e3200a 100644
--- a/llvm/lib/Target/Sparc/AsmParser/SparcAsmParser.cpp
+++ b/llvm/lib/Target/Sparc/AsmParser/SparcAsmParser.cpp
@@ -91,6 +91,8 @@ class SparcAsmParser : public MCTargetAsmParser {
 
   ParseStatus parseASITag(OperandVector &Operands);
 
+  ParseStatus parsePrefetchTag(OperandVector &Operands);
+
   template 
   ParseStatus parseTailRelocSym(OperandVector &Operands);
 
@@ -209,7 +211,8 @@ class SparcOperand : public MCParsedAsmOperand {
 k_Immediate,
 k_MemoryReg,
 k_MemoryImm,
-k_ASITag
+k_ASITag,
+k_PrefetchTag,
   } Kind;
 
   SMLoc StartLoc, EndLoc;
@@ -240,6 +243,7 @@ class SparcOperand : public MCParsedAsmOperand {
 struct ImmOp Imm;
 struct MemOp Mem;
 unsigned ASI;
+unsigned Prefetch;
   };
 
 public:
@@ -253,6 +257,7 @@ class SparcOperand : public MCParsedAsmOperand {
   bool isMEMri() const { return Kind == k_MemoryImm; }
   bool isMembarTag() const { return Kind == k_Immediate; }
   bool isASITag() const { return Kind == k_ASITag; }
+  bool isPrefetchTag() const { return Kind == k_PrefetchTag; }
   bool isTailRelocSym() const { return Kind == k_Immediate; }
 
   bool isCallTarget() const {
@@ -337,6 +342,11 @@ class SparcOperand : public MCParsedAsmOperand {
 return ASI;
   }
 
+  unsigned getPrefetchTag() const {
+assert((Kind == k_PrefetchTag) && "Invalid access!");
+return Prefetch;
+  }
+
   /// getStartLoc - Get the location of the first token of this operand.
   SMLoc getStartLoc() const override {
 return StartLoc;
@@ -360,6 +370,9 @@ class SparcOperand : public MCParsedAsmOperand {
 case k_ASITag:
   OS << "ASI tag: " << getASITag() << "\n";
   break;
+case k_PrefetchTag:
+  OS << "Prefetch tag: " << getPrefetchTag() << "\n";
+  break;
 }
   }
 
@@ -416,6 +429,11 @@ class SparcOperand : public MCParsedAsmOperand {
 Inst.addOperand(MCOperand::createImm(getASITag()));
   }
 
+  void addPrefetchTagOperands(MCInst &Inst, unsigned N) const {
+assert(N == 1 && "Invalid number of operands!");
+Inst.addOperand(MCOperand::createImm(getPrefetchTag()));
+  }
+
   void addMembarTagOperands(MCInst &Inst, unsigned N) const {
 assert(N == 1 && "Invalid number of operands!");
 const MCExpr *Expr = getImm();
@@ -469,6 +487,15 @@ class SparcOperand : public MCParsedAsmOperand {
 return Op;
   }
 
+  static std::unique_ptr CreatePrefetchTag(unsigned Val, SMLoc S,
+ SMLoc E) {
+auto Op = std::make_unique(k_PrefetchTag);
+Op->Prefetch = Val;
+Op->StartLoc = S;
+Op->EndLoc = E;
+return Op;
+  }
+
   static bool MorphToIntPairReg(SparcOperand &Op) {
 unsigned Reg = Op.getReg();
 assert(Op.Reg.Kind == rk_IntReg);
@@ -1088,6 +1115,34 @@ ParseStatus SparcAsmParser::parseASITag(OperandVector 
&Operands) {
   return ParseStatus::Success;
 }
 
+ParseStatus SparcAsmParser::parsePrefetchTag(OperandVector &Operands) {
+  SMLoc S = Parser.getTok().getLoc();
+  SMLoc E = Parser.getTok().getEndLoc();
+  int64_t PrefetchVal = 0;
+
+  if (getLexer().getKind() == AsmToken::Hash) {
+SMLoc TagStart = getLexer().peekTok(false).getLoc();
+Parser.Lex(); // Eat the '#'.
+auto PrefetchName = Parser.getTok().getString();
+auto PrefetchTag = SparcPrefetchTag::lookupPrefetchTagByName(PrefetchName);
+Parser.Lex(); // Eat the identifier token.
+
+if (!PrefetchTag)
+  return Error(TagStart, "unknown prefetch tag");
+
+PrefetchVal = PrefetchTag->Encoding;
+  } else if (!getParser().parseAbsoluteExpression(PrefetchVal)) {
+if (!isUInt<5>(PrefetchVal))
+  return Error(S, "invalid prefetch number, must be between 0 and 31");
+  } else {
+return Error(S, "malformed prefetch tag, must be a constant integer "
+"expression,

[llvm-branch-commits] [SPARC][IAS] Add support for `prefetcha` instruction (PR #94250)


llvmbot wrote:




@llvm/pr-subscribers-backend-sparc

Author: Koakuma (koachan)


Changes

This adds support for `prefetcha` instruction for prefetching from
alternate address spaces.


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


3 Files Affected:

- (modified) llvm/lib/Target/Sparc/SparcInstrInfo.td (+7) 
- (modified) llvm/test/MC/Disassembler/Sparc/sparc-v9-asi.txt (+5) 
- (modified) llvm/test/MC/Sparc/sparcv9-instructions.s (+30) 


``diff
diff --git a/llvm/lib/Target/Sparc/SparcInstrInfo.td 
b/llvm/lib/Target/Sparc/SparcInstrInfo.td
index f1778f2162f8c..cac96a1398721 100644
--- a/llvm/lib/Target/Sparc/SparcInstrInfo.td
+++ b/llvm/lib/Target/Sparc/SparcInstrInfo.td
@@ -1782,6 +1782,13 @@ let Predicates = [HasV9] in {
   def PREFETCHi : F3_2<3, 0b101101,
(outs), (ins (MEMri $rs1, $simm13):$addr, PrefetchTag:$rd),
"prefetch [$addr], $rd", []>;
+  def PREFETCHAr : F3_1_asi<3, 0b01, (outs),
+(ins (MEMrr $rs1, $rs2):$addr, ASITag:$asi, 
PrefetchTag:$rd),
+"prefetcha [$addr] $asi, $rd", []>;
+  let Uses = [ASR3] in
+  def PREFETCHAi : F3_2<3, 0b01, (outs),
+(ins (MEMri $rs1, $simm13):$addr, PrefetchTag:$rd),
+"prefetcha [$addr] %asi, $rd", []>;
 }
 
 
diff --git a/llvm/test/MC/Disassembler/Sparc/sparc-v9-asi.txt 
b/llvm/test/MC/Disassembler/Sparc/sparc-v9-asi.txt
index 9286814552cf5..1d1fdb667fafa 100644
--- a/llvm/test/MC/Disassembler/Sparc/sparc-v9-asi.txt
+++ b/llvm/test/MC/Disassembler/Sparc/sparc-v9-asi.txt
@@ -32,3 +32,8 @@
 0xd5 0xf6 0x11 0x56
 # V9: casxa [%i0] #ASI_SNF_L, %l6, %o2
 0xd5 0xf6 0x11 0x76
+
+# V9: prefetcha  [%i1+3968] %asi, #one_read
+0xc3 0xee 0x6f 0x80
+# V9: prefetcha [%i1+%i2] #ASI_SNF, #one_read
+0xc3 0xee 0x50 0x7a
diff --git a/llvm/test/MC/Sparc/sparcv9-instructions.s 
b/llvm/test/MC/Sparc/sparcv9-instructions.s
index f0348eb70f1c5..ae8646f8bc560 100644
--- a/llvm/test/MC/Sparc/sparcv9-instructions.s
+++ b/llvm/test/MC/Sparc/sparcv9-instructions.s
@@ -557,6 +557,36 @@
 ! V9: prefetch  [%i1+%i2], #one_read  ! encoding: [0xc3,0x6e,0x40,0x1a]
 prefetch  [ %i1 + %i2 ], #one_read
 
+! V8:  error: malformed ASI tag, must be a constant integer 
expression
+! V8-NEXT: prefetcha  [ %i1 + 0xf80 ] %asi, 1
+! V9: prefetcha [%i1+3968] %asi, #one_read! encoding: 
[0xc3,0xee,0x6f,0x80]
+prefetcha  [ %i1 + 0xf80 ] %asi, 1
+
+! V8:  error: malformed ASI tag, must be a constant integer 
expression
+! V8-NEXT: prefetcha  [ %i1 + 0xf80 ] %asi, #one_read
+! V9: prefetcha [%i1+3968] %asi, #one_read! encoding: 
[0xc3,0xee,0x6f,0x80]
+prefetcha  [ %i1 + 0xf80 ] %asi, #one_read
+
+! V8:  error: malformed ASI tag, must be a constant integer 
expression
+! V8-NEXT: prefetcha  [ %i1 + %i2 ] #ASI_SNF, 1
+! V9: prefetcha [%i1+%i2] #ASI_SNF, #one_read ! encoding: 
[0xc3,0xee,0x50,0x7a]
+prefetcha  [ %i1 + %i2 ] #ASI_SNF, 1
+
+! V8:  error: malformed ASI tag, must be a constant integer 
expression
+! V8-NEXT: prefetcha  [ %i1 + %i2 ] #ASI_SNF, #one_read
+! V9: prefetcha [%i1+%i2] #ASI_SNF, #one_read ! encoding: 
[0xc3,0xee,0x50,0x7a]
+prefetcha  [ %i1 + %i2 ] #ASI_SNF, #one_read
+
+! V8:  error: invalid operand for instruction
+! V8-NEXT: prefetcha  [ %i1 + %i2 ] 131, 1
+! V9: prefetcha [%i1+%i2] #ASI_SNF, #one_read ! encoding: 
[0xc3,0xee,0x50,0x7a]
+prefetcha  [ %i1 + %i2 ] 131, 1
+
+! V8:  error: unexpected token
+! V8-NEXT: prefetcha  [ %i1 + %i2 ] 131, #one_read
+! V9: prefetcha [%i1+%i2] #ASI_SNF, #one_read ! encoding: 
[0xc3,0xee,0x50,0x7a]
+prefetcha  [ %i1 + %i2 ] 131, #one_read
+
 ! V8:  error: instruction requires a CPU feature not currently 
enabled
 ! V8-NEXT: done
 ! V9: done  ! encoding: [0x81,0xf0,0x00,0x00]

``




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


[llvm-branch-commits] [SPARC][IAS] Add support for `prefetcha` instruction (PR #94250)


llvmbot wrote:




@llvm/pr-subscribers-mc

Author: Koakuma (koachan)


Changes

This adds support for `prefetcha` instruction for prefetching from
alternate address spaces.


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


3 Files Affected:

- (modified) llvm/lib/Target/Sparc/SparcInstrInfo.td (+7) 
- (modified) llvm/test/MC/Disassembler/Sparc/sparc-v9-asi.txt (+5) 
- (modified) llvm/test/MC/Sparc/sparcv9-instructions.s (+30) 


``diff
diff --git a/llvm/lib/Target/Sparc/SparcInstrInfo.td 
b/llvm/lib/Target/Sparc/SparcInstrInfo.td
index f1778f2162f8c..cac96a1398721 100644
--- a/llvm/lib/Target/Sparc/SparcInstrInfo.td
+++ b/llvm/lib/Target/Sparc/SparcInstrInfo.td
@@ -1782,6 +1782,13 @@ let Predicates = [HasV9] in {
   def PREFETCHi : F3_2<3, 0b101101,
(outs), (ins (MEMri $rs1, $simm13):$addr, PrefetchTag:$rd),
"prefetch [$addr], $rd", []>;
+  def PREFETCHAr : F3_1_asi<3, 0b01, (outs),
+(ins (MEMrr $rs1, $rs2):$addr, ASITag:$asi, 
PrefetchTag:$rd),
+"prefetcha [$addr] $asi, $rd", []>;
+  let Uses = [ASR3] in
+  def PREFETCHAi : F3_2<3, 0b01, (outs),
+(ins (MEMri $rs1, $simm13):$addr, PrefetchTag:$rd),
+"prefetcha [$addr] %asi, $rd", []>;
 }
 
 
diff --git a/llvm/test/MC/Disassembler/Sparc/sparc-v9-asi.txt 
b/llvm/test/MC/Disassembler/Sparc/sparc-v9-asi.txt
index 9286814552cf5..1d1fdb667fafa 100644
--- a/llvm/test/MC/Disassembler/Sparc/sparc-v9-asi.txt
+++ b/llvm/test/MC/Disassembler/Sparc/sparc-v9-asi.txt
@@ -32,3 +32,8 @@
 0xd5 0xf6 0x11 0x56
 # V9: casxa [%i0] #ASI_SNF_L, %l6, %o2
 0xd5 0xf6 0x11 0x76
+
+# V9: prefetcha  [%i1+3968] %asi, #one_read
+0xc3 0xee 0x6f 0x80
+# V9: prefetcha [%i1+%i2] #ASI_SNF, #one_read
+0xc3 0xee 0x50 0x7a
diff --git a/llvm/test/MC/Sparc/sparcv9-instructions.s 
b/llvm/test/MC/Sparc/sparcv9-instructions.s
index f0348eb70f1c5..ae8646f8bc560 100644
--- a/llvm/test/MC/Sparc/sparcv9-instructions.s
+++ b/llvm/test/MC/Sparc/sparcv9-instructions.s
@@ -557,6 +557,36 @@
 ! V9: prefetch  [%i1+%i2], #one_read  ! encoding: [0xc3,0x6e,0x40,0x1a]
 prefetch  [ %i1 + %i2 ], #one_read
 
+! V8:  error: malformed ASI tag, must be a constant integer 
expression
+! V8-NEXT: prefetcha  [ %i1 + 0xf80 ] %asi, 1
+! V9: prefetcha [%i1+3968] %asi, #one_read! encoding: 
[0xc3,0xee,0x6f,0x80]
+prefetcha  [ %i1 + 0xf80 ] %asi, 1
+
+! V8:  error: malformed ASI tag, must be a constant integer 
expression
+! V8-NEXT: prefetcha  [ %i1 + 0xf80 ] %asi, #one_read
+! V9: prefetcha [%i1+3968] %asi, #one_read! encoding: 
[0xc3,0xee,0x6f,0x80]
+prefetcha  [ %i1 + 0xf80 ] %asi, #one_read
+
+! V8:  error: malformed ASI tag, must be a constant integer 
expression
+! V8-NEXT: prefetcha  [ %i1 + %i2 ] #ASI_SNF, 1
+! V9: prefetcha [%i1+%i2] #ASI_SNF, #one_read ! encoding: 
[0xc3,0xee,0x50,0x7a]
+prefetcha  [ %i1 + %i2 ] #ASI_SNF, 1
+
+! V8:  error: malformed ASI tag, must be a constant integer 
expression
+! V8-NEXT: prefetcha  [ %i1 + %i2 ] #ASI_SNF, #one_read
+! V9: prefetcha [%i1+%i2] #ASI_SNF, #one_read ! encoding: 
[0xc3,0xee,0x50,0x7a]
+prefetcha  [ %i1 + %i2 ] #ASI_SNF, #one_read
+
+! V8:  error: invalid operand for instruction
+! V8-NEXT: prefetcha  [ %i1 + %i2 ] 131, 1
+! V9: prefetcha [%i1+%i2] #ASI_SNF, #one_read ! encoding: 
[0xc3,0xee,0x50,0x7a]
+prefetcha  [ %i1 + %i2 ] 131, 1
+
+! V8:  error: unexpected token
+! V8-NEXT: prefetcha  [ %i1 + %i2 ] 131, #one_read
+! V9: prefetcha [%i1+%i2] #ASI_SNF, #one_read ! encoding: 
[0xc3,0xee,0x50,0x7a]
+prefetcha  [ %i1 + %i2 ] 131, #one_read
+
 ! V8:  error: instruction requires a CPU feature not currently 
enabled
 ! V8-NEXT: done
 ! V9: done  ! encoding: [0x81,0xf0,0x00,0x00]

``




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


[llvm-branch-commits] [SPARC][IAS] Add movr(n)e alias for movr(n)z (PR #94252)


llvmbot wrote:




@llvm/pr-subscribers-mc

Author: Koakuma (koachan)


Changes

This adds the alternate mnemonics for movrz and movrnz.


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


2 Files Affected:

- (modified) llvm/lib/Target/Sparc/SparcInstrAliases.td (+2) 
- (modified) llvm/test/MC/Sparc/sparc64-ctrl-instructions.s (+8) 


``diff
diff --git a/llvm/lib/Target/Sparc/SparcInstrAliases.td 
b/llvm/lib/Target/Sparc/SparcInstrAliases.td
index 2b9244519f154..eedad25737f65 100644
--- a/llvm/lib/Target/Sparc/SparcInstrAliases.td
+++ b/llvm/lib/Target/Sparc/SparcInstrAliases.td
@@ -400,9 +400,11 @@ defm : cp_cond_alias<"012",   0b>;
 let EmitPriority = 0 in defm : cp_cond_alias<"",  0b1000>; // same as a; 
gnu asm, not in manual
 
 defm : reg_cond_alias<"z",0b001>;
+defm : reg_cond_alias<"e",0b001>;
 defm : reg_cond_alias<"lez",  0b010>;
 defm : reg_cond_alias<"lz",   0b011>;
 defm : reg_cond_alias<"nz",   0b101>;
+defm : reg_cond_alias<"ne",   0b101>;
 defm : reg_cond_alias<"gz",   0b110>;
 defm : reg_cond_alias<"gez",  0b111>;
 
diff --git a/llvm/test/MC/Sparc/sparc64-ctrl-instructions.s 
b/llvm/test/MC/Sparc/sparc64-ctrl-instructions.s
index a21b17552eb15..188947314f4b7 100644
--- a/llvm/test/MC/Sparc/sparc64-ctrl-instructions.s
+++ b/llvm/test/MC/Sparc/sparc64-ctrl-instructions.s
@@ -1190,29 +1190,37 @@
 ! CHECK-NEXT: !   fixup A - offset: 0, 
value: .BB0, kind: fixup_sparc_br16
 brz,a,pn   %g1, .BB0
 
+! CHECK: movrz   %g1, %g2, %g3 ! encoding: [0x87,0x78,0x44,0x02]
 ! CHECK: movrz   %g1, %g2, %g3 ! encoding: [0x87,0x78,0x44,0x02]
 ! CHECK: movrlez %g1, %g2, %g3 ! encoding: [0x87,0x78,0x48,0x02]
 ! CHECK: movrlz  %g1, %g2, %g3 ! encoding: [0x87,0x78,0x4c,0x02]
 ! CHECK: movrnz  %g1, %g2, %g3 ! encoding: [0x87,0x78,0x54,0x02]
+! CHECK: movrnz  %g1, %g2, %g3 ! encoding: [0x87,0x78,0x54,0x02]
 ! CHECK: movrgz  %g1, %g2, %g3 ! encoding: [0x87,0x78,0x58,0x02]
 ! CHECK: movrgez %g1, %g2, %g3 ! encoding: [0x87,0x78,0x5c,0x02]
 movrz   %g1, %g2, %g3
+movre   %g1, %g2, %g3
 movrlez %g1, %g2, %g3
 movrlz  %g1, %g2, %g3
 movrnz  %g1, %g2, %g3
+movrne  %g1, %g2, %g3
 movrgz  %g1, %g2, %g3
 movrgez %g1, %g2, %g3
 
+! CHECK: movrz   %g1, 2, %g3 ! encoding: [0x87,0x78,0x64,0x02]
 ! CHECK: movrz   %g1, 2, %g3 ! encoding: [0x87,0x78,0x64,0x02]
 ! CHECK: movrlez %g1, 2, %g3 ! encoding: [0x87,0x78,0x68,0x02]
 ! CHECK: movrlz  %g1, 2, %g3 ! encoding: [0x87,0x78,0x6c,0x02]
 ! CHECK: movrnz  %g1, 2, %g3 ! encoding: [0x87,0x78,0x74,0x02]
+! CHECK: movrnz  %g1, 2, %g3 ! encoding: [0x87,0x78,0x74,0x02]
 ! CHECK: movrgz  %g1, 2, %g3 ! encoding: [0x87,0x78,0x78,0x02]
 ! CHECK: movrgez %g1, 2, %g3 ! encoding: [0x87,0x78,0x7c,0x02]
 movrz   %g1, 2, %g3
+movre   %g1, 2, %g3
 movrlez %g1, 2, %g3
 movrlz  %g1, 2, %g3
 movrnz  %g1, 2, %g3
+movrne  %g1, 2, %g3
 movrgz  %g1, 2, %g3
 movrgez %g1, 2, %g3
 

``




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


[llvm-branch-commits] [SPARC][IAS] Add movr(n)e alias for movr(n)z (PR #94252)


llvmbot wrote:




@llvm/pr-subscribers-backend-sparc

Author: Koakuma (koachan)


Changes

This adds the alternate mnemonics for movrz and movrnz.


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


2 Files Affected:

- (modified) llvm/lib/Target/Sparc/SparcInstrAliases.td (+2) 
- (modified) llvm/test/MC/Sparc/sparc64-ctrl-instructions.s (+8) 


``diff
diff --git a/llvm/lib/Target/Sparc/SparcInstrAliases.td 
b/llvm/lib/Target/Sparc/SparcInstrAliases.td
index 2b9244519f154..eedad25737f65 100644
--- a/llvm/lib/Target/Sparc/SparcInstrAliases.td
+++ b/llvm/lib/Target/Sparc/SparcInstrAliases.td
@@ -400,9 +400,11 @@ defm : cp_cond_alias<"012",   0b>;
 let EmitPriority = 0 in defm : cp_cond_alias<"",  0b1000>; // same as a; 
gnu asm, not in manual
 
 defm : reg_cond_alias<"z",0b001>;
+defm : reg_cond_alias<"e",0b001>;
 defm : reg_cond_alias<"lez",  0b010>;
 defm : reg_cond_alias<"lz",   0b011>;
 defm : reg_cond_alias<"nz",   0b101>;
+defm : reg_cond_alias<"ne",   0b101>;
 defm : reg_cond_alias<"gz",   0b110>;
 defm : reg_cond_alias<"gez",  0b111>;
 
diff --git a/llvm/test/MC/Sparc/sparc64-ctrl-instructions.s 
b/llvm/test/MC/Sparc/sparc64-ctrl-instructions.s
index a21b17552eb15..188947314f4b7 100644
--- a/llvm/test/MC/Sparc/sparc64-ctrl-instructions.s
+++ b/llvm/test/MC/Sparc/sparc64-ctrl-instructions.s
@@ -1190,29 +1190,37 @@
 ! CHECK-NEXT: !   fixup A - offset: 0, 
value: .BB0, kind: fixup_sparc_br16
 brz,a,pn   %g1, .BB0
 
+! CHECK: movrz   %g1, %g2, %g3 ! encoding: [0x87,0x78,0x44,0x02]
 ! CHECK: movrz   %g1, %g2, %g3 ! encoding: [0x87,0x78,0x44,0x02]
 ! CHECK: movrlez %g1, %g2, %g3 ! encoding: [0x87,0x78,0x48,0x02]
 ! CHECK: movrlz  %g1, %g2, %g3 ! encoding: [0x87,0x78,0x4c,0x02]
 ! CHECK: movrnz  %g1, %g2, %g3 ! encoding: [0x87,0x78,0x54,0x02]
+! CHECK: movrnz  %g1, %g2, %g3 ! encoding: [0x87,0x78,0x54,0x02]
 ! CHECK: movrgz  %g1, %g2, %g3 ! encoding: [0x87,0x78,0x58,0x02]
 ! CHECK: movrgez %g1, %g2, %g3 ! encoding: [0x87,0x78,0x5c,0x02]
 movrz   %g1, %g2, %g3
+movre   %g1, %g2, %g3
 movrlez %g1, %g2, %g3
 movrlz  %g1, %g2, %g3
 movrnz  %g1, %g2, %g3
+movrne  %g1, %g2, %g3
 movrgz  %g1, %g2, %g3
 movrgez %g1, %g2, %g3
 
+! CHECK: movrz   %g1, 2, %g3 ! encoding: [0x87,0x78,0x64,0x02]
 ! CHECK: movrz   %g1, 2, %g3 ! encoding: [0x87,0x78,0x64,0x02]
 ! CHECK: movrlez %g1, 2, %g3 ! encoding: [0x87,0x78,0x68,0x02]
 ! CHECK: movrlz  %g1, 2, %g3 ! encoding: [0x87,0x78,0x6c,0x02]
 ! CHECK: movrnz  %g1, 2, %g3 ! encoding: [0x87,0x78,0x74,0x02]
+! CHECK: movrnz  %g1, 2, %g3 ! encoding: [0x87,0x78,0x74,0x02]
 ! CHECK: movrgz  %g1, 2, %g3 ! encoding: [0x87,0x78,0x78,0x02]
 ! CHECK: movrgez %g1, 2, %g3 ! encoding: [0x87,0x78,0x7c,0x02]
 movrz   %g1, 2, %g3
+movre   %g1, 2, %g3
 movrlez %g1, 2, %g3
 movrlz  %g1, 2, %g3
 movrnz  %g1, 2, %g3
+movrne  %g1, 2, %g3
 movrgz  %g1, 2, %g3
 movrgez %g1, 2, %g3
 

``




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


[llvm-branch-commits] [SPARC][IAS] Handle the case of non-4-byte aligned writeNopData (PR #94251)


llvmbot wrote:




@llvm/pr-subscribers-backend-sparc

Author: Koakuma (koachan)


Changes

If the Count passed into writeNopData is not a multiple of four,
add a little amount of zeros before writing the NOP stream.
This makes it match the behavior of GNU binutils.


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


1 Files Affected:

- (modified) llvm/lib/Target/Sparc/MCTargetDesc/SparcAsmBackend.cpp (+5-3) 


``diff
diff --git a/llvm/lib/Target/Sparc/MCTargetDesc/SparcAsmBackend.cpp 
b/llvm/lib/Target/Sparc/MCTargetDesc/SparcAsmBackend.cpp
index 240f5396855c8..cb7414fddd29f 100644
--- a/llvm/lib/Target/Sparc/MCTargetDesc/SparcAsmBackend.cpp
+++ b/llvm/lib/Target/Sparc/MCTargetDesc/SparcAsmBackend.cpp
@@ -323,9 +323,11 @@ namespace {
 
 bool writeNopData(raw_ostream &OS, uint64_t Count,
   const MCSubtargetInfo *STI) const override {
-  // Cannot emit NOP with size not multiple of 32 bits.
-  if (Count % 4 != 0)
-return false;
+
+  // If the count is not 4-byte aligned, we must be writing data into the
+  // text section (otherwise we have unaligned instructions, and thus have
+  // far bigger problems), so just write zeros instead.
+  OS.write_zeros(Count % 4);
 
   uint64_t NumNops = Count / 4;
   for (uint64_t i = 0; i != NumNops; ++i)

``




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


[llvm-branch-commits] [SPARC][IAS] Add support for %uhi and %ulo extensions (PR #94246)


koachan wrote:

Note: this PR was created by `spr`, please do not hand-merge this.

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


[llvm-branch-commits] [SPARC][IAS] Add aliases for %asr20-21 as defined in JPS1 (PR #94247)


koachan wrote:

Note: this PR was created by `spr`, please do not hand-merge this.

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


[llvm-branch-commits] [SPARC][IAS] Add named prefetch tag constants (PR #94249)


koachan wrote:

Note: this PR was created by `spr`, please do not hand-merge this.

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


[llvm-branch-commits] [SPARC][IAS] Add support for `prefetcha` instruction (PR #94250)


koachan wrote:

Note: this PR was created by `spr`, please do not hand-merge this.

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


[llvm-branch-commits] [SPARC][IAS] Handle the case of non-4-byte aligned writeNopData (PR #94251)


koachan wrote:

Note: this PR was created by `spr`, please do not hand-merge this.

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


[llvm-branch-commits] [SPARC][IAS] Add movr(n)e alias for movr(n)z (PR #94252)


koachan wrote:

Note: this PR was created by `spr`, please do not hand-merge this.

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


[llvm-branch-commits] [clang] [clang] Implement function pointer signing and authenticated function calls (PR #93906)


llvmbot wrote:




@llvm/pr-subscribers-clang-codegen

Author: Ahmed Bougacha (ahmedbougacha)


Changes

The functions are currently always signed/authenticated with zero discriminator.

Co-Authored-By: John McCall 

---

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


24 Files Affected:

- (modified) clang/include/clang/Basic/CodeGenOptions.h (+4) 
- (modified) clang/include/clang/Basic/DiagnosticDriverKinds.td (+3) 
- (modified) clang/include/clang/Basic/LangOptions.h (+2) 
- (modified) clang/include/clang/Basic/PointerAuthOptions.h (+136) 
- (modified) clang/include/clang/Frontend/CompilerInvocation.h (+10) 
- (modified) clang/lib/CodeGen/CGBuiltin.cpp (+1-2) 
- (modified) clang/lib/CodeGen/CGCall.cpp (+3) 
- (modified) clang/lib/CodeGen/CGCall.h (+22-6) 
- (modified) clang/lib/CodeGen/CGExpr.cpp (+9-8) 
- (modified) clang/lib/CodeGen/CGExprConstant.cpp (+18-1) 
- (modified) clang/lib/CodeGen/CGPointerAuth.cpp (+51) 
- (added) clang/lib/CodeGen/CGPointerAuthInfo.h (+96) 
- (modified) clang/lib/CodeGen/CodeGenFunction.cpp (+22) 
- (modified) clang/lib/CodeGen/CodeGenFunction.h (+7) 
- (modified) clang/lib/CodeGen/CodeGenModule.h (+34) 
- (modified) clang/lib/Frontend/CompilerInvocation.cpp (+36) 
- (modified) clang/lib/Headers/ptrauth.h (+34) 
- (added) clang/test/CodeGen/ptrauth-function-attributes.c (+13) 
- (added) clang/test/CodeGen/ptrauth-function-init-fail.c (+5) 
- (added) clang/test/CodeGen/ptrauth-function-init.c (+31) 
- (added) clang/test/CodeGen/ptrauth-function-lvalue-cast.c (+23) 
- (added) clang/test/CodeGen/ptrauth-function.c (+28) 
- (added) clang/test/CodeGen/ptrauth-weak_import.c (+10) 
- (added) clang/test/CodeGenCXX/ptrauth.cpp (+24) 


``diff
diff --git a/clang/include/clang/Basic/CodeGenOptions.h 
b/clang/include/clang/Basic/CodeGenOptions.h
index 9469a424045bb..502722a6ec4eb 100644
--- a/clang/include/clang/Basic/CodeGenOptions.h
+++ b/clang/include/clang/Basic/CodeGenOptions.h
@@ -13,6 +13,7 @@
 #ifndef LLVM_CLANG_BASIC_CODEGENOPTIONS_H
 #define LLVM_CLANG_BASIC_CODEGENOPTIONS_H
 
+#include "clang/Basic/PointerAuthOptions.h"
 #include "clang/Basic/Sanitizers.h"
 #include "clang/Basic/XRayInstr.h"
 #include "llvm/ADT/FloatingPointMode.h"
@@ -388,6 +389,9 @@ class CodeGenOptions : public CodeGenOptionsBase {
 
   std::vector Reciprocals;
 
+  /// Configuration for pointer-signing.
+  PointerAuthOptions PointerAuth;
+
   /// The preferred width for auto-vectorization transforms. This is intended 
to
   /// override default transforms based on the width of the architected vector
   /// registers.
diff --git a/clang/include/clang/Basic/DiagnosticDriverKinds.td 
b/clang/include/clang/Basic/DiagnosticDriverKinds.td
index 773b234cd68fe..6cbb0c8401c15 100644
--- a/clang/include/clang/Basic/DiagnosticDriverKinds.td
+++ b/clang/include/clang/Basic/DiagnosticDriverKinds.td
@@ -351,6 +351,9 @@ def err_drv_omp_host_ir_file_not_found : Error<
   "target regions but cannot be found">;
 def err_drv_omp_host_target_not_supported : Error<
   "target '%0' is not a supported OpenMP host target">;
+def err_drv_ptrauth_not_supported : Error<
+  "target '%0' does not support native pointer authentication">;
+
 def err_drv_expecting_fopenmp_with_fopenmp_targets : Error<
   "'-fopenmp-targets' must be used in conjunction with a '-fopenmp' option "
   "compatible with offloading; e.g., '-fopenmp=libomp' or 
'-fopenmp=libiomp5'">;
diff --git a/clang/include/clang/Basic/LangOptions.h 
b/clang/include/clang/Basic/LangOptions.h
index 75e88afbd9705..5216822e45b1b 100644
--- a/clang/include/clang/Basic/LangOptions.h
+++ b/clang/include/clang/Basic/LangOptions.h
@@ -346,6 +346,8 @@ class LangOptionsBase {
 BKey
   };
 
+  using PointerAuthenticationMode = ::clang::PointerAuthenticationMode;
+
   enum class ThreadModelKind {
 /// POSIX Threads.
 POSIX,
diff --git a/clang/include/clang/Basic/PointerAuthOptions.h 
b/clang/include/clang/Basic/PointerAuthOptions.h
index e5cdcc31ebfb7..32b179e3f9460 100644
--- a/clang/include/clang/Basic/PointerAuthOptions.h
+++ b/clang/include/clang/Basic/PointerAuthOptions.h
@@ -14,10 +14,146 @@
 #ifndef LLVM_CLANG_BASIC_POINTERAUTHOPTIONS_H
 #define LLVM_CLANG_BASIC_POINTERAUTHOPTIONS_H
 
+#include "clang/Basic/LLVM.h"
+#include "clang/Basic/LangOptions.h"
+#include "llvm/Support/ErrorHandling.h"
+#include "llvm/Target/TargetOptions.h"
+#include 
+#include 
+#include 
+#include 
+
 namespace clang {
 
 constexpr unsigned PointerAuthKeyNone = -1;
 
+class PointerAuthSchema {
+public:
+  enum class Kind : unsigned {
+None,
+ARM8_3,
+  };
+
+  /// Hardware pointer-signing keys in ARM8.3.
+  ///
+  /// These values are the same used in ptrauth.h.
+  enum class ARM8_3Key : unsigned {
+ASIA = 0,
+ASIB = 1,
+ASDA = 2,
+ASDB = 3
+  };
+
+  /// Forms of extra discrimination.
+  enum class Discrimination : unsigned {
+/// No additional discrimination.
+

[llvm-branch-commits] [clang] [clang] Implement function pointer signing and authenticated function calls (PR #93906)


llvmbot wrote:




@llvm/pr-subscribers-backend-x86

Author: Ahmed Bougacha (ahmedbougacha)


Changes

The functions are currently always signed/authenticated with zero discriminator.

Co-Authored-By: John McCall 

---

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


24 Files Affected:

- (modified) clang/include/clang/Basic/CodeGenOptions.h (+4) 
- (modified) clang/include/clang/Basic/DiagnosticDriverKinds.td (+3) 
- (modified) clang/include/clang/Basic/LangOptions.h (+2) 
- (modified) clang/include/clang/Basic/PointerAuthOptions.h (+136) 
- (modified) clang/include/clang/Frontend/CompilerInvocation.h (+10) 
- (modified) clang/lib/CodeGen/CGBuiltin.cpp (+1-2) 
- (modified) clang/lib/CodeGen/CGCall.cpp (+3) 
- (modified) clang/lib/CodeGen/CGCall.h (+22-6) 
- (modified) clang/lib/CodeGen/CGExpr.cpp (+9-8) 
- (modified) clang/lib/CodeGen/CGExprConstant.cpp (+18-1) 
- (modified) clang/lib/CodeGen/CGPointerAuth.cpp (+51) 
- (added) clang/lib/CodeGen/CGPointerAuthInfo.h (+96) 
- (modified) clang/lib/CodeGen/CodeGenFunction.cpp (+22) 
- (modified) clang/lib/CodeGen/CodeGenFunction.h (+7) 
- (modified) clang/lib/CodeGen/CodeGenModule.h (+34) 
- (modified) clang/lib/Frontend/CompilerInvocation.cpp (+36) 
- (modified) clang/lib/Headers/ptrauth.h (+34) 
- (added) clang/test/CodeGen/ptrauth-function-attributes.c (+13) 
- (added) clang/test/CodeGen/ptrauth-function-init-fail.c (+5) 
- (added) clang/test/CodeGen/ptrauth-function-init.c (+31) 
- (added) clang/test/CodeGen/ptrauth-function-lvalue-cast.c (+23) 
- (added) clang/test/CodeGen/ptrauth-function.c (+28) 
- (added) clang/test/CodeGen/ptrauth-weak_import.c (+10) 
- (added) clang/test/CodeGenCXX/ptrauth.cpp (+24) 


``diff
diff --git a/clang/include/clang/Basic/CodeGenOptions.h 
b/clang/include/clang/Basic/CodeGenOptions.h
index 9469a424045bb..502722a6ec4eb 100644
--- a/clang/include/clang/Basic/CodeGenOptions.h
+++ b/clang/include/clang/Basic/CodeGenOptions.h
@@ -13,6 +13,7 @@
 #ifndef LLVM_CLANG_BASIC_CODEGENOPTIONS_H
 #define LLVM_CLANG_BASIC_CODEGENOPTIONS_H
 
+#include "clang/Basic/PointerAuthOptions.h"
 #include "clang/Basic/Sanitizers.h"
 #include "clang/Basic/XRayInstr.h"
 #include "llvm/ADT/FloatingPointMode.h"
@@ -388,6 +389,9 @@ class CodeGenOptions : public CodeGenOptionsBase {
 
   std::vector Reciprocals;
 
+  /// Configuration for pointer-signing.
+  PointerAuthOptions PointerAuth;
+
   /// The preferred width for auto-vectorization transforms. This is intended 
to
   /// override default transforms based on the width of the architected vector
   /// registers.
diff --git a/clang/include/clang/Basic/DiagnosticDriverKinds.td 
b/clang/include/clang/Basic/DiagnosticDriverKinds.td
index 773b234cd68fe..6cbb0c8401c15 100644
--- a/clang/include/clang/Basic/DiagnosticDriverKinds.td
+++ b/clang/include/clang/Basic/DiagnosticDriverKinds.td
@@ -351,6 +351,9 @@ def err_drv_omp_host_ir_file_not_found : Error<
   "target regions but cannot be found">;
 def err_drv_omp_host_target_not_supported : Error<
   "target '%0' is not a supported OpenMP host target">;
+def err_drv_ptrauth_not_supported : Error<
+  "target '%0' does not support native pointer authentication">;
+
 def err_drv_expecting_fopenmp_with_fopenmp_targets : Error<
   "'-fopenmp-targets' must be used in conjunction with a '-fopenmp' option "
   "compatible with offloading; e.g., '-fopenmp=libomp' or 
'-fopenmp=libiomp5'">;
diff --git a/clang/include/clang/Basic/LangOptions.h 
b/clang/include/clang/Basic/LangOptions.h
index 75e88afbd9705..5216822e45b1b 100644
--- a/clang/include/clang/Basic/LangOptions.h
+++ b/clang/include/clang/Basic/LangOptions.h
@@ -346,6 +346,8 @@ class LangOptionsBase {
 BKey
   };
 
+  using PointerAuthenticationMode = ::clang::PointerAuthenticationMode;
+
   enum class ThreadModelKind {
 /// POSIX Threads.
 POSIX,
diff --git a/clang/include/clang/Basic/PointerAuthOptions.h 
b/clang/include/clang/Basic/PointerAuthOptions.h
index e5cdcc31ebfb7..32b179e3f9460 100644
--- a/clang/include/clang/Basic/PointerAuthOptions.h
+++ b/clang/include/clang/Basic/PointerAuthOptions.h
@@ -14,10 +14,146 @@
 #ifndef LLVM_CLANG_BASIC_POINTERAUTHOPTIONS_H
 #define LLVM_CLANG_BASIC_POINTERAUTHOPTIONS_H
 
+#include "clang/Basic/LLVM.h"
+#include "clang/Basic/LangOptions.h"
+#include "llvm/Support/ErrorHandling.h"
+#include "llvm/Target/TargetOptions.h"
+#include 
+#include 
+#include 
+#include 
+
 namespace clang {
 
 constexpr unsigned PointerAuthKeyNone = -1;
 
+class PointerAuthSchema {
+public:
+  enum class Kind : unsigned {
+None,
+ARM8_3,
+  };
+
+  /// Hardware pointer-signing keys in ARM8.3.
+  ///
+  /// These values are the same used in ptrauth.h.
+  enum class ARM8_3Key : unsigned {
+ASIA = 0,
+ASIB = 1,
+ASDA = 2,
+ASDB = 3
+  };
+
+  /// Forms of extra discrimination.
+  enum class Discrimination : unsigned {
+/// No additional discrimination.
+  

[llvm-branch-commits] [SPARC][IAS] Add named prefetch tag constants (PR #94249)



@@ -1088,6 +1115,34 @@ ParseStatus SparcAsmParser::parseASITag(OperandVector 
&Operands) {
   return ParseStatus::Success;
 }
 
+ParseStatus SparcAsmParser::parsePrefetchTag(OperandVector &Operands) {
+  SMLoc S = Parser.getTok().getLoc();
+  SMLoc E = Parser.getTok().getEndLoc();
+  int64_t PrefetchVal = 0;
+
+  if (getLexer().getKind() == AsmToken::Hash) {
+SMLoc TagStart = getLexer().peekTok(false).getLoc();
+Parser.Lex(); // Eat the '#'.
+auto PrefetchName = Parser.getTok().getString();
+auto PrefetchTag = SparcPrefetchTag::lookupPrefetchTagByName(PrefetchName);

koachan wrote:

Here I am following the code from the [ASI tag 
handling](https://github.com/llvm/llvm-project/pull/94249/files/2b16c922835eda4759b3372da362293efcc9c0f4#diff-e6d91775e25820bb2665f18e0bf771e71fd8351ae05a8895d25b9b43007a0c4eR1093-R1094)
Should I change it?

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


[llvm-branch-commits] [SPARC][IAS] Add support for `prefetcha` instruction (PR #94250)



@@ -557,6 +557,36 @@
 ! V9: prefetch  [%i1+%i2], #one_read  ! encoding: [0xc3,0x6e,0x40,0x1a]
 prefetch  [ %i1 + %i2 ], #one_read
 
+! V8:  error: malformed ASI tag, must be a constant integer 
expression

koachan wrote:

Changing them to return a NoMatch results in the error changing into `unknown 
token in expression`, but still doesn't catch that `prefetcha` is unavailable 
in V8...

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


[llvm-branch-commits] [llvm] 1ce2d26 - Bump version to 18.1.7 (#93723)


Author: Tom Stellard
Date: 2024-06-03T17:50:36-07:00
New Revision: 1ce2d26cd2e912bb168e78ccc049b70a81dab03a

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

LOG: Bump version to 18.1.7 (#93723)

Added: 


Modified: 
llvm/CMakeLists.txt
llvm/utils/lit/lit/__init__.py

Removed: 




diff  --git a/llvm/CMakeLists.txt b/llvm/CMakeLists.txt
index 26b7b01bb1f8d..51278943847aa 100644
--- a/llvm/CMakeLists.txt
+++ b/llvm/CMakeLists.txt
@@ -22,7 +22,7 @@ if(NOT DEFINED LLVM_VERSION_MINOR)
   set(LLVM_VERSION_MINOR 1)
 endif()
 if(NOT DEFINED LLVM_VERSION_PATCH)
-  set(LLVM_VERSION_PATCH 6)
+  set(LLVM_VERSION_PATCH 7)
 endif()
 if(NOT DEFINED LLVM_VERSION_SUFFIX)
   set(LLVM_VERSION_SUFFIX)

diff  --git a/llvm/utils/lit/lit/__init__.py b/llvm/utils/lit/lit/__init__.py
index d8b0e3bd1c69e..5003d78ce5218 100644
--- a/llvm/utils/lit/lit/__init__.py
+++ b/llvm/utils/lit/lit/__init__.py
@@ -2,7 +2,7 @@
 
 __author__ = "Daniel Dunbar"
 __email__ = "[email protected]"
-__versioninfo__ = (18, 1, 6)
+__versioninfo__ = (18, 1, 7)
 __version__ = ".".join(str(v) for v in __versioninfo__) + "dev"
 
 __all__ = []



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


[llvm-branch-commits] [RISCV][MC] Warn if SEW/LMUL may not be compatible (PR #94313)


llvmbot wrote:




@llvm/pr-subscribers-mc

Author: Pengcheng Wang (wangpc-pp)


Changes

According to RVV spec:
> In general, the requirement is to support LMUL ≥ SEWMIN/ELEN,
> where SEWMIN is the narrowest supported SEW value and ELEN is
> the widest supported SEW value.
>
> For a given supported fractional LMUL setting, implementations
> must support SEW settings between SEWMIN and LMUL * ELEN, inclusive.

We print a warning if these requirements are not met.


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


2 Files Affected:

- (modified) llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp (+22) 
- (modified) llvm/test/MC/RISCV/rvv/vsetvl.s (+5) 


``diff
diff --git a/llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp 
b/llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp
index d92998ced91ef..4295e98ff2fa8 100644
--- a/llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp
+++ b/llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp
@@ -2155,6 +2155,17 @@ bool RISCVAsmParser::parseVTypeToken(const AsmToken 
&Tok, VTypeState &State,
   break;
 if (!RISCVVType::isValidLMUL(Lmul, Fractional))
   break;
+
+if (Fractional) {
+  unsigned ELEN = STI->hasFeature(RISCV::FeatureStdExtZve64x) ? 64 : 32;
+  unsigned MinLMUL = ELEN / 8;
+  if (Lmul > MinLMUL)
+Warning(
+Tok.getLoc(),
+Twine("LMUL < mf") + Twine(MinLMUL) +
+Twine(" may not be compatible with all RVV implementations"));
+}
+
 State = VTypeState_TailPolicy;
 return false;
   }
@@ -2194,6 +2205,7 @@ ParseStatus RISCVAsmParser::parseVTypeI(OperandVector 
&Operands) {
   bool MaskAgnostic = false;
 
   VTypeState State = VTypeState_SEW;
+  SMLoc SEWLoc = S;
 
   if (parseVTypeToken(getTok(), State, Sew, Lmul, Fractional, TailAgnostic,
   MaskAgnostic))
@@ -2211,6 +2223,16 @@ ParseStatus RISCVAsmParser::parseVTypeI(OperandVector 
&Operands) {
 
   if (getLexer().is(AsmToken::EndOfStatement) && State == VTypeState_Done) {
 RISCVII::VLMUL VLMUL = RISCVVType::encodeLMUL(Lmul, Fractional);
+if (Fractional) {
+  unsigned ELEN = STI->hasFeature(RISCV::FeatureStdExtZve64x) ? 64 : 32;
+  unsigned MaxSEW = ELEN / Lmul;
+  // If MaxSEW < 8, we should have printed warning about incompatible LMUL.
+  if (MaxSEW >= 8 && Sew > MaxSEW)
+Warning(
+SEWLoc,
+Twine("SEW > ") + Twine(MaxSEW) +
+Twine(" may not be compatible with all RVV implementations"));
+}
 
 unsigned VTypeI =
 RISCVVType::encodeVTYPE(VLMUL, Sew, TailAgnostic, MaskAgnostic);
diff --git a/llvm/test/MC/RISCV/rvv/vsetvl.s b/llvm/test/MC/RISCV/rvv/vsetvl.s
index c9197d8917a47..d61e8f48445d4 100644
--- a/llvm/test/MC/RISCV/rvv/vsetvl.s
+++ b/llvm/test/MC/RISCV/rvv/vsetvl.s
@@ -1,5 +1,7 @@
 # RUN: llvm-mc -triple=riscv64 -show-encoding --mattr=+v %s \
 # RUN:| FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INST
+# RUN: llvm-mc -triple=riscv64 -show-encoding --mattr=+zve32x %s 2>&1 \
+# RUN:| FileCheck %s --check-prefix=CHECK-WARNING
 # RUN: not llvm-mc -triple=riscv64 -show-encoding %s 2>&1 \
 # RUN:| FileCheck %s --check-prefix=CHECK-ERROR
 # RUN: llvm-mc -triple=riscv64 -filetype=obj --mattr=+v %s \
@@ -71,18 +73,21 @@ vsetvli a2, a0, e32, m8, ta, ma
 
 vsetvli a2, a0, e32, mf2, ta, ma
 # CHECK-INST: vsetvli a2, a0, e32, mf2, ta, ma
+# CHECK-WARNING: :[[#@LINE-2]]:17: warning: SEW > 16 may not be compatible 
with all RVV implementations{{$}}
 # CHECK-ENCODING: [0x57,0x76,0x75,0x0d]
 # CHECK-ERROR: instruction requires the following: 'V' (Vector Extension for 
Application Processors), 'Zve32x' (Vector Extensions for Embedded 
Processors){{$}}
 # CHECK-UNKNOWN: 0d757657 
 
 vsetvli a2, a0, e32, mf4, ta, ma
 # CHECK-INST: vsetvli a2, a0, e32, mf4, ta, ma
+# CHECK-WARNING: :[[#@LINE-2]]:17: warning: SEW > 8 may not be compatible with 
all RVV implementations{{$}}
 # CHECK-ENCODING: [0x57,0x76,0x65,0x0d]
 # CHECK-ERROR: instruction requires the following: 'V' (Vector Extension for 
Application Processors), 'Zve32x' (Vector Extensions for Embedded 
Processors){{$}}
 # CHECK-UNKNOWN: 0d657657 
 
 vsetvli a2, a0, e32, mf8, ta, ma
 # CHECK-INST: vsetvli a2, a0, e32, mf8, ta, ma
+# CHECK-WARNING: :[[#@LINE-2]]:22: warning: LMUL < mf4 may not be compatible 
with all RVV implementations{{$}}
 # CHECK-ENCODING: [0x57,0x76,0x55,0x0d]
 # CHECK-ERROR: instruction requires the following: 'V' (Vector Extension for 
Application Processors), 'Zve32x' (Vector Extensions for Embedded 
Processors){{$}}
 # CHECK-UNKNOWN: 0d557657 

``




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


[llvm-branch-commits] [SPARC][IAS] Add named prefetch tag constants (PR #94249)



@@ -537,16 +537,26 @@
 ! V9: stxa %g0, [%g2+%i5] #ASI_SNF   ! encoding: [0xc0,0xf0,0x90,0x7d]
 stxa %g0, [%g2 + %i5] #ASI_SNF
 
-! V8:  error: instruction requires a CPU feature not currently 
enabled
+! V8:  error: invalid operand for instruction

koachan wrote:

This is probably the same issue that causes the error message in [PR 
92450](https://github.com/llvm/llvm-project/pull/94250/files#r1624938216) to be 
wrong.

I can at least change the tag parser to return a NoMatch here, but I suppose 
the full fix is probably better done separately, like you said there?

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


[llvm-branch-commits] [llvm] [SPARC][IAS] Add named prefetch tag constants (PR #94249)


https://github.com/koachan updated 
https://github.com/llvm/llvm-project/pull/94249

>From 2debba6d10e3025ae5b312ef8ef8e1f68bc2b794 Mon Sep 17 00:00:00 2001
From: Koakuma 
Date: Tue, 4 Jun 2024 22:30:09 +0700
Subject: [PATCH] Update tests and apply suggestions

Created using spr 1.3.4
---
 .../Target/Sparc/AsmParser/SparcAsmParser.cpp | 28 --
 llvm/test/MC/Disassembler/Sparc/sparc-v9.txt  | 58 +++-
 llvm/test/MC/Sparc/sparcv9-instructions.s | 90 +++
 3 files changed, 165 insertions(+), 11 deletions(-)

diff --git a/llvm/lib/Target/Sparc/AsmParser/SparcAsmParser.cpp 
b/llvm/lib/Target/Sparc/AsmParser/SparcAsmParser.cpp
index a0dec24e3200a..f0a3a4e88b30c 100644
--- a/llvm/lib/Target/Sparc/AsmParser/SparcAsmParser.cpp
+++ b/llvm/lib/Target/Sparc/AsmParser/SparcAsmParser.cpp
@@ -1120,23 +1120,33 @@ ParseStatus 
SparcAsmParser::parsePrefetchTag(OperandVector &Operands) {
   SMLoc E = Parser.getTok().getEndLoc();
   int64_t PrefetchVal = 0;
 
-  if (getLexer().getKind() == AsmToken::Hash) {
+  switch (getLexer().getKind()) {
+  case AsmToken::LParen:
+  case AsmToken::Integer:
+  case AsmToken::Identifier:
+  case AsmToken::Plus:
+  case AsmToken::Minus:
+  case AsmToken::Tilde:
+if (getParser().parseAbsoluteExpression(PrefetchVal) ||
+!isUInt<5>(PrefetchVal))
+  return Error(S, "invalid prefetch number, must be between 0 and 31");
+break;
+  case AsmToken::Hash: {
 SMLoc TagStart = getLexer().peekTok(false).getLoc();
 Parser.Lex(); // Eat the '#'.
-auto PrefetchName = Parser.getTok().getString();
-auto PrefetchTag = SparcPrefetchTag::lookupPrefetchTagByName(PrefetchName);
+const StringRef PrefetchName = Parser.getTok().getString();
+const SparcPrefetchTag::PrefetchTag *PrefetchTag =
+SparcPrefetchTag::lookupPrefetchTagByName(PrefetchName);
 Parser.Lex(); // Eat the identifier token.
 
 if (!PrefetchTag)
   return Error(TagStart, "unknown prefetch tag");
 
 PrefetchVal = PrefetchTag->Encoding;
-  } else if (!getParser().parseAbsoluteExpression(PrefetchVal)) {
-if (!isUInt<5>(PrefetchVal))
-  return Error(S, "invalid prefetch number, must be between 0 and 31");
-  } else {
-return Error(S, "malformed prefetch tag, must be a constant integer "
-"expression, or a named tag");
+break;
+  }
+  default:
+return ParseStatus::NoMatch;
   }
 
   Operands.push_back(SparcOperand::CreatePrefetchTag(PrefetchVal, S, E));
diff --git a/llvm/test/MC/Disassembler/Sparc/sparc-v9.txt 
b/llvm/test/MC/Disassembler/Sparc/sparc-v9.txt
index 49b6e339435f1..d561216fec6f2 100644
--- a/llvm/test/MC/Disassembler/Sparc/sparc-v9.txt
+++ b/llvm/test/MC/Disassembler/Sparc/sparc-v9.txt
@@ -132,11 +132,65 @@
 # CHECK: membar #LoadLoad | #StoreLoad | #LoadStore | #StoreStore | #Lookaside 
| #MemIssue | #Sync
 0x81 0x43 0xe0 0x7f
 
+# CHECK: prefetch  [%i1+3968], #n_reads
+0xc1 0x6e 0x6f 0x80
+
 # CHECK: prefetch  [%i1+3968], #one_read
-0xc3,0x6e,0x6f,0x80
+0xc3 0x6e 0x6f 0x80
+
+# CHECK: prefetch  [%i1+3968], #n_writes
+0xc5 0x6e 0x6f 0x80
+
+# CHECK: prefetch  [%i1+3968], #one_write
+0xc7 0x6e 0x6f 0x80
+
+# CHECK: prefetch  [%i1+3968], #page
+0xc9 0x6e 0x6f 0x80
+
+# CHECK: prefetch  [%i1+3968], #unified
+0xe3 0x6e 0x6f 0x80
+
+# CHECK: prefetch  [%i1+3968], #n_reads_strong
+0xe9 0x6e 0x6f 0x80
+
+# CHECK: prefetch  [%i1+3968], #one_read_strong
+0xeb 0x6e 0x6f 0x80
+
+# CHECK: prefetch  [%i1+3968], #n_writes_strong
+0xed 0x6e 0x6f 0x80
+
+# CHECK: prefetch  [%i1+3968], #one_write_strong
+0xef 0x6e 0x6f 0x80
+
+# CHECK: prefetch  [%i1+%i2], #n_reads
+0xc1 0x6e 0x40 0x1a
 
 # CHECK: prefetch  [%i1+%i2], #one_read
-0xc3,0x6e,0x40,0x1a
+0xc3 0x6e 0x40 0x1a
+
+# CHECK: prefetch  [%i1+%i2], #n_writes
+0xc5 0x6e 0x40 0x1a
+
+# CHECK: prefetch  [%i1+%i2], #one_write
+0xc7 0x6e 0x40 0x1a
+
+# CHECK: prefetch  [%i1+%i2], #page
+0xc9 0x6e 0x40 0x1a
+
+# CHECK: prefetch  [%i1+%i2], #unified
+0xe3 0x6e 0x40 0x1a
+
+# CHECK: prefetch  [%i1+%i2], #n_reads_strong
+0xe9 0x6e 0x40 0x1a
+
+# CHECK: prefetch  [%i1+%i2], #one_read_strong
+0xeb 0x6e 0x40 0x1a
+
+# CHECK: prefetch  [%i1+%i2], #n_writes_strong
+0xed 0x6e 0x40 0x1a
+
+# CHECK: prefetch  [%i1+%i2], #one_write_strong
+0xef 0x6e 0x40 0x1a
 
 # CHECK: done
 0x81,0xf0,0x00,0x00
diff --git a/llvm/test/MC/Sparc/sparcv9-instructions.s 
b/llvm/test/MC/Sparc/sparcv9-instructions.s
index f0348eb70f1c5..80f67ac30bc82 100644
--- a/llvm/test/MC/Sparc/sparcv9-instructions.s
+++ b/llvm/test/MC/Sparc/sparcv9-instructions.s
@@ -542,21 +542,111 @@
 ! V9: prefetch  [%i1+3968], #one_read  ! encoding: 
[0xc3,0x6e,0x6f,0x80]
 prefetch  [ %i1 + 0xf80 ], 1
 
+! V8:  error: unexpected token
+! V8-NEXT: prefetch  [ %i1 + 0xf80 ], #n_reads
+! V9: prefetch  [%i1+3968], #n_reads  ! encoding: [0xc1,0x6e,0x6f,0x80]
+prefetch  [ %i1 + 0xf80 ], #n_reads
+
 ! V8:  error: unexpected token
 ! V8-NEXT: prefetch  [ %i1 + 0xf80 ], #o

[llvm-branch-commits] [SPARC][IAS] Add support for `prefetcha` instruction (PR #94250)



@@ -557,6 +557,36 @@
 ! V9: prefetch  [%i1+%i2], #one_read  ! encoding: [0xc3,0x6e,0x40,0x1a]
 prefetch  [ %i1 + %i2 ], #one_read
 
+! V8:  error: malformed ASI tag, must be a constant integer 
expression

koachan wrote:

Okay, so parsePrefetchTag has changed to return NoMatch like you suggested, but 
what to do with the ASI errors displayed here? Should I do that in another 
patch?

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


[llvm-branch-commits] [compiler-rt] backport to release/17.x (PR #94397)


https://github.com/github-actions[bot] closed 
https://github.com/llvm/llvm-project/pull/94397
___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [compiler-rt] backport to release/17.x (PR #94397)


github-actions[bot] wrote:

This repository does not accept pull requests. Please follow 
http://llvm.org/docs/Contributing.html#how-to-submit-a-patch for contribution 
to LLVM.

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


[llvm-branch-commits] [compiler-rt] backport to release/17.x (PR #94397)


https://github.com/github-actions[bot] locked 
https://github.com/llvm/llvm-project/pull/94397
___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] release/18.x: [PPCMergeStringPool] Only replace constant once (#92996) (PR #93442)


https://github.com/llvmbot updated 
https://github.com/llvm/llvm-project/pull/93442

>From 7e6ece9b4f2d37caf8ff7b87603f15ed9ad2d6ec Mon Sep 17 00:00:00 2001
From: Nikita Popov 
Date: Mon, 27 May 2024 08:54:11 +0200
Subject: [PATCH] [PPCMergeStringPool] Only replace constant once (#92996)

In #88846 I changed this code to use RAUW to perform the replacement
instead of manual updates -- but kept the outer loop, which means we try
to perform RAUW once per user. However, some of the users might be freed
by the RAUW operation, resulting in use-after-free.

The case where this happens is constant users where the replacement
might result in the destruction of the original constant.

Fixes https://github.com/llvm/llvm-project/issues/92991.

(cherry picked from commit 9f85bc834b07ebfec9e5e02deb9255a0f6ec5cc7)
---
 .../lib/Target/PowerPC/PPCMergeStringPool.cpp | 37 ---
 .../PowerPC/mergeable-string-pool-pr92991.ll  | 20 ++
 2 files changed, 27 insertions(+), 30 deletions(-)
 create mode 100644 llvm/test/CodeGen/PowerPC/mergeable-string-pool-pr92991.ll

diff --git a/llvm/lib/Target/PowerPC/PPCMergeStringPool.cpp 
b/llvm/lib/Target/PowerPC/PPCMergeStringPool.cpp
index ebd876d50c44e..0830b02370cd0 100644
--- a/llvm/lib/Target/PowerPC/PPCMergeStringPool.cpp
+++ b/llvm/lib/Target/PowerPC/PPCMergeStringPool.cpp
@@ -290,13 +290,6 @@ bool PPCMergeStringPool::mergeModuleStringPool(Module &M) {
   return true;
 }
 
-static bool userHasOperand(User *TheUser, GlobalVariable *GVOperand) {
-  for (Value *Op : TheUser->operands())
-if (Op == GVOperand)
-  return true;
-  return false;
-}
-
 // For pooled strings we need to add the offset into the pool for each string.
 // This is done by adding a Get Element Pointer (GEP) before each user. This
 // function adds the GEP.
@@ -307,29 +300,13 @@ void 
PPCMergeStringPool::replaceUsesWithGEP(GlobalVariable *GlobalToReplace,
   Indices.push_back(ConstantInt::get(Type::getInt32Ty(*Context), 0));
   Indices.push_back(ConstantInt::get(Type::getInt32Ty(*Context), 
ElementIndex));
 
-  // Need to save a temporary copy of each user list because we remove uses
-  // as we replace them.
-  SmallVector Users;
-  for (User *CurrentUser : GlobalToReplace->users())
-Users.push_back(CurrentUser);
-
-  for (User *CurrentUser : Users) {
-// The user was not found so it must have been replaced earlier.
-if (!userHasOperand(CurrentUser, GlobalToReplace))
-  continue;
-
-// We cannot replace operands in globals so we ignore those.
-if (isa(CurrentUser))
-  continue;
-
-Constant *ConstGEP = ConstantExpr::getInBoundsGetElementPtr(
-PooledStructType, GPool, Indices);
-LLVM_DEBUG(dbgs() << "Replacing this global:\n");
-LLVM_DEBUG(GlobalToReplace->dump());
-LLVM_DEBUG(dbgs() << "with this:\n");
-LLVM_DEBUG(ConstGEP->dump());
-GlobalToReplace->replaceAllUsesWith(ConstGEP);
-  }
+  Constant *ConstGEP =
+  ConstantExpr::getInBoundsGetElementPtr(PooledStructType, GPool, Indices);
+  LLVM_DEBUG(dbgs() << "Replacing this global:\n");
+  LLVM_DEBUG(GlobalToReplace->dump());
+  LLVM_DEBUG(dbgs() << "with this:\n");
+  LLVM_DEBUG(ConstGEP->dump());
+  GlobalToReplace->replaceAllUsesWith(ConstGEP);
 }
 
 } // namespace
diff --git a/llvm/test/CodeGen/PowerPC/mergeable-string-pool-pr92991.ll 
b/llvm/test/CodeGen/PowerPC/mergeable-string-pool-pr92991.ll
new file mode 100644
index 0..4e9c69e5fe4cf
--- /dev/null
+++ b/llvm/test/CodeGen/PowerPC/mergeable-string-pool-pr92991.ll
@@ -0,0 +1,20 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py 
UTC_ARGS: --version 5
+; RUN: llc -mtriple=powerpc64le-unknown-linux-gnu < %s | FileCheck %s
+
+@g = private constant [4 x i32] [i32 122, i32 67, i32 35, i32 56]
+@g2 = private constant [1 x i64] [i64 1], align 8
+
+define void @test(ptr %p, ptr %p2) {
+; CHECK-LABEL: test:
+; CHECK:   # %bb.0:
+; CHECK-NEXT:addis 5, 2, .L__ModuleStringPool@toc@ha
+; CHECK-NEXT:addi 5, 5, .L__ModuleStringPool@toc@l
+; CHECK-NEXT:addi 6, 5, 12
+; CHECK-NEXT:std 6, 0(3)
+; CHECK-NEXT:addi 3, 5, 16
+; CHECK-NEXT:std 3, 0(4)
+; CHECK-NEXT:blr
+  store ptr getelementptr inbounds ([4 x i32], ptr @g, i64 0, i64 1), ptr %p
+  store ptr getelementptr inbounds ([4 x i32], ptr @g, i64 0, i64 2), ptr %p2
+  ret void
+}

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


[llvm-branch-commits] [llvm] 7e6ece9 - [PPCMergeStringPool] Only replace constant once (#92996)


Author: Nikita Popov
Date: 2024-06-04T13:50:32-07:00
New Revision: 7e6ece9b4f2d37caf8ff7b87603f15ed9ad2d6ec

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

LOG: [PPCMergeStringPool] Only replace constant once (#92996)

In #88846 I changed this code to use RAUW to perform the replacement
instead of manual updates -- but kept the outer loop, which means we try
to perform RAUW once per user. However, some of the users might be freed
by the RAUW operation, resulting in use-after-free.

The case where this happens is constant users where the replacement
might result in the destruction of the original constant.

Fixes https://github.com/llvm/llvm-project/issues/92991.

(cherry picked from commit 9f85bc834b07ebfec9e5e02deb9255a0f6ec5cc7)

Added: 
llvm/test/CodeGen/PowerPC/mergeable-string-pool-pr92991.ll

Modified: 
llvm/lib/Target/PowerPC/PPCMergeStringPool.cpp

Removed: 




diff  --git a/llvm/lib/Target/PowerPC/PPCMergeStringPool.cpp 
b/llvm/lib/Target/PowerPC/PPCMergeStringPool.cpp
index ebd876d50c44e..0830b02370cd0 100644
--- a/llvm/lib/Target/PowerPC/PPCMergeStringPool.cpp
+++ b/llvm/lib/Target/PowerPC/PPCMergeStringPool.cpp
@@ -290,13 +290,6 @@ bool PPCMergeStringPool::mergeModuleStringPool(Module &M) {
   return true;
 }
 
-static bool userHasOperand(User *TheUser, GlobalVariable *GVOperand) {
-  for (Value *Op : TheUser->operands())
-if (Op == GVOperand)
-  return true;
-  return false;
-}
-
 // For pooled strings we need to add the offset into the pool for each string.
 // This is done by adding a Get Element Pointer (GEP) before each user. This
 // function adds the GEP.
@@ -307,29 +300,13 @@ void 
PPCMergeStringPool::replaceUsesWithGEP(GlobalVariable *GlobalToReplace,
   Indices.push_back(ConstantInt::get(Type::getInt32Ty(*Context), 0));
   Indices.push_back(ConstantInt::get(Type::getInt32Ty(*Context), 
ElementIndex));
 
-  // Need to save a temporary copy of each user list because we remove uses
-  // as we replace them.
-  SmallVector Users;
-  for (User *CurrentUser : GlobalToReplace->users())
-Users.push_back(CurrentUser);
-
-  for (User *CurrentUser : Users) {
-// The user was not found so it must have been replaced earlier.
-if (!userHasOperand(CurrentUser, GlobalToReplace))
-  continue;
-
-// We cannot replace operands in globals so we ignore those.
-if (isa(CurrentUser))
-  continue;
-
-Constant *ConstGEP = ConstantExpr::getInBoundsGetElementPtr(
-PooledStructType, GPool, Indices);
-LLVM_DEBUG(dbgs() << "Replacing this global:\n");
-LLVM_DEBUG(GlobalToReplace->dump());
-LLVM_DEBUG(dbgs() << "with this:\n");
-LLVM_DEBUG(ConstGEP->dump());
-GlobalToReplace->replaceAllUsesWith(ConstGEP);
-  }
+  Constant *ConstGEP =
+  ConstantExpr::getInBoundsGetElementPtr(PooledStructType, GPool, Indices);
+  LLVM_DEBUG(dbgs() << "Replacing this global:\n");
+  LLVM_DEBUG(GlobalToReplace->dump());
+  LLVM_DEBUG(dbgs() << "with this:\n");
+  LLVM_DEBUG(ConstGEP->dump());
+  GlobalToReplace->replaceAllUsesWith(ConstGEP);
 }
 
 } // namespace

diff  --git a/llvm/test/CodeGen/PowerPC/mergeable-string-pool-pr92991.ll 
b/llvm/test/CodeGen/PowerPC/mergeable-string-pool-pr92991.ll
new file mode 100644
index 0..4e9c69e5fe4cf
--- /dev/null
+++ b/llvm/test/CodeGen/PowerPC/mergeable-string-pool-pr92991.ll
@@ -0,0 +1,20 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py 
UTC_ARGS: --version 5
+; RUN: llc -mtriple=powerpc64le-unknown-linux-gnu < %s | FileCheck %s
+
+@g = private constant [4 x i32] [i32 122, i32 67, i32 35, i32 56]
+@g2 = private constant [1 x i64] [i64 1], align 8
+
+define void @test(ptr %p, ptr %p2) {
+; CHECK-LABEL: test:
+; CHECK:   # %bb.0:
+; CHECK-NEXT:addis 5, 2, .L__ModuleStringPool@toc@ha
+; CHECK-NEXT:addi 5, 5, .L__ModuleStringPool@toc@l
+; CHECK-NEXT:addi 6, 5, 12
+; CHECK-NEXT:std 6, 0(3)
+; CHECK-NEXT:addi 3, 5, 16
+; CHECK-NEXT:std 3, 0(4)
+; CHECK-NEXT:blr
+  store ptr getelementptr inbounds ([4 x i32], ptr @g, i64 0, i64 1), ptr %p
+  store ptr getelementptr inbounds ([4 x i32], ptr @g, i64 0, i64 2), ptr %p2
+  ret void
+}



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


[llvm-branch-commits] gn build: Embed libc++abi.a objects into libc++.a. (PR #88463)


pcc wrote:

Hmm, after actually doing a CMake build it doesn't seem to be the CMake default 
in fact. It's what you get if you set `LIBCXX_ENABLE_STATIC_ABI_LIBRARY` to 
true. I think I got the idea that it was the default after inspecting the NDK 
compiler, which was built with `LIBCXX_ENABLE_STATIC_ABI_LIBRARY` set to true, 
combined with the fact that `-static-libstdc++ -stdlib=libc++` does not work 
out of the box unless you set this (several CMake caches set 
`LIBCXX_ENABLE_STATIC_ABI_LIBRARY` to true, presumably in order to get this 
working).

Conceptually we want `libc++.a` to be like `libc++.so`, which is a linker 
script that causes `libc++.so.1` and `libc++abi.so` to be linked. One way to do 
that would be to make it a linker script as well. But the other way would be to 
combine `libc++.a` and `libc++abi.a` by default. On the CMake side that's 
controlled by `LIBCXX_STATICALLY_LINK_ABI_IN_STATIC_LIBRARY` which defaults to 
`LIBCXX_ENABLE_STATIC_ABI_LIBRARY`. So maybe the right fix here would be to 
change `LIBCXX_STATICALLY_LINK_ABI_IN_STATIC_LIBRARY` to default to true, and 
land this patch to make the gn build consistent?

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


[llvm-branch-commits] [llvm] [Support] Integrate SipHash.cpp into libSupport. (PR #94394)


llvmbot wrote:




@llvm/pr-subscribers-llvm-support

Author: Ahmed Bougacha (ahmedbougacha)


Changes

Start building it as part of the library, with some minor
tweaks compared to the reference implementation:
- clang-format to match libSupport
- remove tracing support
- add file header
- templatize cROUNDS/dROUNDS, as well as 8B/16B result type
- replace assert with static_assert
- return the result directly, as uint64_t/uint128_t
- remove big-endian support
- use LLVM_FALLTHROUGH
- remove tracing support

The siphash function itself isn't used yet, and will be in a follow-up
commit.

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


3 Files Affected:

- (modified) llvm/lib/Support/CMakeLists.txt (+1-3) 
- (removed) llvm/lib/Support/README.md.SipHash (-126) 
- (modified) llvm/lib/Support/SipHash.cpp (+126-176) 


``diff
diff --git a/llvm/lib/Support/CMakeLists.txt b/llvm/lib/Support/CMakeLists.txt
index 7cc01a5399911..f5f8447d48d01 100644
--- a/llvm/lib/Support/CMakeLists.txt
+++ b/llvm/lib/Support/CMakeLists.txt
@@ -127,9 +127,6 @@ endif()
 
 add_subdirectory(BLAKE3)
 
-# Temporarily ignore SipHash.cpp before we fully integrate it into LLVMSupport.
-set(LLVM_OPTIONAL_SOURCES SipHash.cpp)
-
 add_llvm_component_library(LLVMSupport
   ABIBreak.cpp
   AMDGPUMetadata.cpp
@@ -226,6 +223,7 @@ add_llvm_component_library(LLVMSupport
   SHA1.cpp
   SHA256.cpp
   Signposts.cpp
+  SipHash.cpp
   SmallPtrSet.cpp
   SmallVector.cpp
   SourceMgr.cpp
diff --git a/llvm/lib/Support/README.md.SipHash 
b/llvm/lib/Support/README.md.SipHash
deleted file mode 100644
index 4de3cd1854681..0
--- a/llvm/lib/Support/README.md.SipHash
+++ /dev/null
@@ -1,126 +0,0 @@
-# SipHash
-
-[![License:
-CC0-1.0](https://licensebuttons.net/l/zero/1.0/80x15.png)](http://creativecommons.org/publicdomain/zero/1.0/)
-
-[![License: 
MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
-
-
-SipHash is a family of pseudorandom functions (PRFs) optimized for speed on 
short messages.
-This is the reference C code of SipHash: portable, simple, optimized for 
clarity and debugging.
-
-SipHash was designed in 2012 by [Jean-Philippe Aumasson](https://aumasson.jp)
-and [Daniel J. Bernstein](https://cr.yp.to) as a defense against [hash-flooding
-DoS attacks](https://aumasson.jp/siphash/siphashdos_29c3_slides.pdf).
-
-SipHash is:
-
-* *Simpler and faster* on short messages than previous cryptographic
-algorithms, such as MACs based on universal hashing.
-
-* *Competitive in performance* with insecure non-cryptographic algorithms, 
such as [fhhash](https://github.com/cbreeden/fxhash).
-
-* *Cryptographically secure*, with no sign of weakness despite multiple 
[cryptanalysis](https://eprint.iacr.org/2019/865) 
[projects](https://eprint.iacr.org/2019/865) by leading cryptographers.
-
-* *Battle-tested*, with successful integration in OSs (Linux kernel, OpenBSD,
-FreeBSD, FreeRTOS), languages (Perl, Python, Ruby, etc.), libraries (OpenSSL 
libcrypto,
-Sodium, etc.) and applications (Wireguard, Redis, etc.).
-
-As a secure pseudorandom function (a.k.a. keyed hash function), SipHash can 
also be used as a secure message authentication code (MAC).
-But SipHash is *not a hash* in the sense of general-purpose key-less hash 
function such as BLAKE3 or SHA-3.
-SipHash should therefore always be used with a secret key in order to be 
secure.
-
-
-## Variants
-
-The default SipHash is *SipHash-2-4*: it takes a 128-bit key, does 2 
compression
-rounds, 4 finalization rounds, and returns a 64-bit tag.
-
-Variants can use a different number of rounds. For example, we proposed 
*SipHash-4-8* as a conservative version.
-
-The following versions are not described in the paper but were designed and 
analyzed to fulfill applications' needs:
-
-* *SipHash-128* returns a 128-bit tag instead of 64-bit. Versions with 
specified number of rounds are SipHash-2-4-128, SipHash4-8-128, and so on.
-
-* *HalfSipHash* works with 32-bit words instead of 64-bit, takes a 64-bit key,
-and returns 32-bit or 64-bit tags. For example, HalfSipHash-2-4-32 has 2
-compression rounds, 4 finalization rounds, and returns a 32-bit tag.
-
-
-## Security
-
-(Half)SipHash-*c*-*d* with *c* ≥ 2 and *d* ≥ 4 is expected to provide the 
maximum PRF
-security for any function with the same key and output size.
-
-The standard PRF security goal allow the attacker access to the output of 
SipHash on messages chosen adaptively by the attacker.
-
-Security is limited by the key size (128 bits for SipHash), such that
-attackers searching 2*s* keys have chance 2*s*−128 of 
finding
-the SipHash key. 
-Security is also limited by the output size. In particular, when
-SipHash is used as a MAC, an attacker who blindly tries 2*s* tags 
will
-succeed with probability 2*s*-*t*, if *t* is that tag's bit size.
-
-
-## Research
-
-* [Research paper](https://www.aumasson.jp/siphash/siphash.pdf) "SipHash: a 
fast short-input PRF" (accepted at INDOCR

[llvm-branch-commits] [llvm] 2e96a19 - Revert "[symbolizer] Empty string is not an error (#92660)"


Author: Serge Pavlov
Date: 2024-06-05T10:58:52+07:00
New Revision: 2e96a199a72cdc88e140d0b4dc2a73d32bad762d

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

LOG: Revert "[symbolizer] Empty string is not an error (#92660)"

This reverts commit 22a7f7c3314328dd1ac20042158f4b68a4ac5c1f.

Added: 


Modified: 
llvm/test/tools/llvm-symbolizer/get-input-file.test
llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp

Removed: 




diff  --git a/llvm/test/tools/llvm-symbolizer/get-input-file.test 
b/llvm/test/tools/llvm-symbolizer/get-input-file.test
index 50eb051968718..8c21816591c81 100644
--- a/llvm/test/tools/llvm-symbolizer/get-input-file.test
+++ b/llvm/test/tools/llvm-symbolizer/get-input-file.test
@@ -1,9 +1,9 @@
 # If binary input file is not specified, llvm-symbolizer assumes it is the 
first
 # item in the command.
 
-# No input items at all. Report an unknown line, but do not produce any output 
on stderr.
+# No input items at all, complain about missing input file.
 RUN: echo | llvm-symbolizer 2>%t.1.err | FileCheck %s --check-prefix=NOSOURCE
-RUN: FileCheck --input-file=%t.1.err --implicit-check-not={{.}} --allow-empty 
%s
+RUN: FileCheck --input-file=%t.1.err --check-prefix=NOFILE %s
 
 # Only one input item, complain about missing addresses.
 RUN: llvm-symbolizer "foo" 2>%t.2.err | FileCheck %s --check-prefix=NOSOURCE
@@ -32,6 +32,8 @@ RUN: FileCheck --input-file=%t.7.err --check-prefix=BAD-QUOTE 
%s
 NOSOURCE:  ??
 NOSOURCE-NEXT: ??:0:0
 
+NOFILE: error: no input filename has been specified
+
 NOADDR: error: 'foo': no module offset has been specified
 
 NOTFOUND:  error: 'foo': [[MSG]]

diff  --git a/llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp 
b/llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp
index 6d7953f3109a5..b98bdbc388faf 100644
--- a/llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp
+++ b/llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp
@@ -337,14 +337,6 @@ static void symbolizeInput(const opt::InputArgList &Args,
   object::BuildID BuildID(IncomingBuildID.begin(), IncomingBuildID.end());
   uint64_t Offset = 0;
   StringRef Symbol;
-
-  // An empty input string may be used to check if the process is alive and
-  // responding to input. Do not emit a message on stderr in this case but
-  // respond on stdout.
-  if (InputString.empty()) {
-printUnknownLineInfo(ModuleName, Printer);
-return;
-  }
   if (Error E = parseCommand(Args.getLastArgValue(OPT_obj_EQ), IsAddr2Line,
  StringRef(InputString), Cmd, ModuleName, BuildID,
  Symbol, Offset)) {



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


[llvm-branch-commits] [clang] [Coverage] Handles macros from system headers and nested macros in scratch space (PR #94438)


llvmbot wrote:




@llvm/pr-subscribers-clang

Author: Wentao Zhang (whentojump)


Changes

Backports #89869 and #91446 (and associated tests in 
3591da9f1ccbd8b19fef4814f96638dbbe9c2b40) that fixes missing code regions and 
`llvm-cov` crashes.

With them, we are able to measure MC/DC of large C/C++ projects like LLVM 
itself and Linux kernel.


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


5 Files Affected:

- (modified) clang/lib/CodeGen/CoverageMappingGen.cpp (+82-11) 
- (modified) clang/test/CoverageMapping/builtinmacro.c (+1-1) 
- (modified) clang/test/CoverageMapping/macros.c (+5-3) 
- (added) clang/test/CoverageMapping/mcdc-scratch-space.c (+65) 
- (added) clang/test/CoverageMapping/mcdc-system-headers.cpp (+50) 


``diff
diff --git a/clang/lib/CodeGen/CoverageMappingGen.cpp 
b/clang/lib/CodeGen/CoverageMappingGen.cpp
index ae4e6d4c88c02..3b912e0f83208 100644
--- a/clang/lib/CodeGen/CoverageMappingGen.cpp
+++ b/clang/lib/CodeGen/CoverageMappingGen.cpp
@@ -17,6 +17,7 @@
 #include "clang/Basic/FileManager.h"
 #include "clang/Frontend/FrontendDiagnostic.h"
 #include "clang/Lex/Lexer.h"
+#include "llvm/ADT/DenseSet.h"
 #include "llvm/ADT/SmallSet.h"
 #include "llvm/ADT/StringExtras.h"
 #include "llvm/ProfileData/Coverage/CoverageMapping.h"
@@ -278,10 +279,36 @@ class CoverageMappingBuilder {
 return SM.getLocForEndOfFile(SM.getFileID(Loc));
   }
 
-  /// Find out where the current file is included or macro is expanded.
-  SourceLocation getIncludeOrExpansionLoc(SourceLocation Loc) {
-return Loc.isMacroID() ? SM.getImmediateExpansionRange(Loc).getBegin()
-   : SM.getIncludeLoc(SM.getFileID(Loc));
+  /// Find out where a macro is expanded. If the immediate result is a
+  /// , keep looking until the result isn't. Return a pair of
+  /// \c SourceLocation. The first object is always the begin sloc of found
+  /// result. The second should be checked by the caller: if it has value, it's
+  /// the end sloc of the found result. Otherwise the while loop didn't get
+  /// executed, which means the location wasn't changed and the caller has to
+  /// learn the end sloc from somewhere else.
+  std::pair>
+  getNonScratchExpansionLoc(SourceLocation Loc) {
+std::optional EndLoc = std::nullopt;
+while (Loc.isMacroID() &&
+   SM.isWrittenInScratchSpace(SM.getSpellingLoc(Loc))) {
+  auto ExpansionRange = SM.getImmediateExpansionRange(Loc);
+  Loc = ExpansionRange.getBegin();
+  EndLoc = ExpansionRange.getEnd();
+}
+return std::make_pair(Loc, EndLoc);
+  }
+
+  /// Find out where the current file is included or macro is expanded. If
+  /// \c AcceptScratch is set to false, keep looking for expansions until the
+  /// found sloc is not a .
+  SourceLocation getIncludeOrExpansionLoc(SourceLocation Loc,
+  bool AcceptScratch = true) {
+if (!Loc.isMacroID())
+  return SM.getIncludeLoc(SM.getFileID(Loc));
+Loc = SM.getImmediateExpansionRange(Loc).getBegin();
+if (AcceptScratch)
+  return Loc;
+return getNonScratchExpansionLoc(Loc).first;
   }
 
   /// Return true if \c Loc is a location in a built-in macro.
@@ -325,16 +352,35 @@ class CoverageMappingBuilder {
 
 llvm::SmallSet Visited;
 SmallVector, 8> FileLocs;
-for (const auto &Region : SourceRegions) {
+for (auto &Region : SourceRegions) {
   SourceLocation Loc = Region.getBeginLoc();
+
+  // Replace Region with its definition if it is in .
+  auto NonScratchExpansionLoc = getNonScratchExpansionLoc(Loc);
+  auto EndLoc = NonScratchExpansionLoc.second;
+  if (EndLoc.has_value()) {
+Loc = NonScratchExpansionLoc.first;
+Region.setStartLoc(Loc);
+Region.setEndLoc(EndLoc.value());
+  }
+
+  // Replace Loc with FileLoc if it is expanded with system headers.
+  if (!SystemHeadersCoverage && SM.isInSystemMacro(Loc)) {
+auto BeginLoc = SM.getSpellingLoc(Loc);
+auto EndLoc = SM.getSpellingLoc(Region.getEndLoc());
+if (SM.isWrittenInSameFile(BeginLoc, EndLoc)) {
+  Loc = SM.getFileLoc(Loc);
+  Region.setStartLoc(Loc);
+  Region.setEndLoc(SM.getFileLoc(Region.getEndLoc()));
+}
+  }
+
   FileID File = SM.getFileID(Loc);
   if (!Visited.insert(File).second)
 continue;
 
-  // Do not map FileID's associated with system headers unless collecting
-  // coverage from system headers is explicitly enabled.
-  if (!SystemHeadersCoverage && 
SM.isInSystemHeader(SM.getSpellingLoc(Loc)))
-continue;
+  assert(SystemHeadersCoverage ||
+ !SM.isInSystemHeader(SM.getSpellingLoc(Loc)));
 
   unsigned Depth = 0;
   for (SourceLocation Parent = getIncludeOrExpansionLoc(Loc);
@@ -503,7 +549,7 @@ class CoverageMappingBuilder {
 SourceRegionFilter Filter;
 for (const auto &FM : FileIDMapping) {
   SourceLocation ExpandedLoc = FM.second.second

[llvm-branch-commits] [lld] [llvm] release/18.x: [lld] Fix -ObjC load behavior with LTO (#92162) (PR #92478)


https://github.com/AtariDreams updated 
https://github.com/llvm/llvm-project/pull/92478

>From aafe93171093465519add9aeab56c1f7f779f0f9 Mon Sep 17 00:00:00 2001
From: Nuri Amari 
Date: Wed, 15 May 2024 09:21:02 -0700
Subject: [PATCH] [lld] Fix -ObjC load behavior with LTO (#92162)

When -ObjC is passed, the linker must force load any object files that
contain special sections that store Objective-C / Swift information that
is used at runtime.

This should work regadless if input files are bitcode or native, but it
was not working with bitcode. This is because the sections that identify
an object file that should be loaded were inconsistent when dealing with
a native file vs bitcode file. In particular, bitcode files were not
searched for `__TEXT,__swift` prefixed sections, while native files
were.

This means LLD wasn't loading certain bitcode files and forcing the user
to introduce --force-load to their linker invocation for that archive.

Co-authored-by: Nuri Amari 
---
 lld/test/MachO/objc.s | 23 ---
 llvm/lib/Bitcode/Reader/BitcodeReader.cpp |  3 ++-
 2 files changed, 22 insertions(+), 4 deletions(-)

diff --git a/lld/test/MachO/objc.s b/lld/test/MachO/objc.s
index e7074141f0113..dbb9f1df27571 100644
--- a/lld/test/MachO/objc.s
+++ b/lld/test/MachO/objc.s
@@ -5,12 +5,14 @@
 # RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin 
%t/has-objc-category.s -o %t/has-objc-category.o
 # RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin 
%t/has-objc-symbol-and-category.s -o %t/has-objc-symbol-and-category.o
 # RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/has-swift.s -o 
%t/has-swift.o
+# RUN: llvm-as %t/has-swift-ir-loaded.ll -o %t/has-swift-ir-loaded.o
+# RUN: llvm-as %t/has-swift-ir-not-loaded.ll -o %t/has-swift-ir-not-loaded.o
 # RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/has-swift-proto.s 
-o %t/has-swift-proto.o
 # RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/no-objc.s -o 
%t/no-objc.o
 ## Make sure we don't mis-parse a 32-bit file as 64-bit
 # RUN: llvm-mc -filetype=obj -triple=armv7-apple-watchos %t/no-objc.s -o 
%t/wrong-arch.o
-# RUN: llvm-ar rcs %t/libHasSomeObjC.a %t/no-objc.o %t/has-objc-symbol.o 
%t/has-objc-category.o %t/has-swift.o %t/has-swift-proto.o %t/wrong-arch.o
-# RUN: llvm-ar rcs %t/libHasSomeObjC2.a %t/no-objc.o 
%t/has-objc-symbol-and-category.o %t/has-swift.o %t/has-swift-proto.o 
%t/wrong-arch.o
+# RUN: llvm-ar rcs %t/libHasSomeObjC.a %t/no-objc.o %t/has-objc-symbol.o 
%t/has-objc-category.o %t/has-swift.o %t/has-swift-proto.o 
%t/has-swift-ir-loaded.o %t/has-swift-ir-not-loaded.o %t/wrong-arch.o
+# RUN: llvm-ar rcs %t/libHasSomeObjC2.a %t/no-objc.o 
%t/has-objc-symbol-and-category.o %t/has-swift.o %t/has-swift-proto.o 
%t/has-swift-ir-loaded.o %t/has-swift-ir-not-loaded.o %t/wrong-arch.o
 
 # RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/test.s -o %t/test.o
 
@@ -20,7 +22,7 @@
 # RUN: %lld -lSystem %t/test.o -o %t/test -L%t -lHasSomeObjC2 -ObjC
 # RUN: llvm-objdump --section-headers --syms %t/test | FileCheck %s 
--check-prefix=OBJC
 
-# RUN: %no-fatal-warnings-lld -lSystem %t/test.o -o %t/test --start-lib 
%t/no-objc.o %t/has-objc-symbol.o %t/has-objc-category.o %t/has-swift.o 
%t/has-swift-proto.o %t/wrong-arch.o --end-lib -ObjC 2>&1 \
+# RUN: %no-fatal-warnings-lld -lSystem %t/test.o -o %t/test --start-lib 
%t/no-objc.o %t/has-objc-symbol.o %t/has-objc-category.o %t/has-swift.o 
%t/has-swift-proto.o %t/has-swift-ir-loaded.o %t/has-swift-ir-not-loaded.o 
%t/wrong-arch.o --end-lib -ObjC 2>&1 \
 # RUN: | FileCheck -check-prefix=WARNING %s
 # RUN: llvm-objdump --section-headers --syms %t/test | FileCheck %s 
--check-prefix=OBJC
 
@@ -36,6 +38,7 @@
 # OBJC-NEXT:4 has_objc_symbol {{.*}}  DATA
 # OBJC-EMPTY:
 # OBJC-NEXT:  SYMBOL TABLE:
+# OBJC-DAG:   g O __TEXT,__swift _foo
 # OBJC-DAG:   g F __TEXT,__text _main
 # OBJC-DAG:   g F __TEXT,__text _OBJC_CLASS_$_MyObject
 # OBJC-DAG:   g O __TEXT,__swift5_fieldmd $s7somelib4Blah_pMF
@@ -100,6 +103,20 @@ _has_dup:
 .section __TEXT,__swift
 .quad 0x1234
 
+#--- has-swift-ir-loaded.ll
+target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128"
+target triple = "x86_64-apple-darwin"
+
+@foo = global i64 1234, section "__TEXT,__swift"
[email protected] = appending global [1 x ptr] [ptr @foo]
+
+#--- has-swift-ir-not-loaded.ll
+target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128"
+target triple = "x86_64-apple-darwin"
+
+@bar = global i64 1234
[email protected] = appending global [1 x ptr] [ptr @bar]
+
 #--- has-swift-proto.s
 .section __TEXT,__swift5_fieldmd
 .globl $s7somelib4Blah_pMF
diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp 
b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
index a027d0c21ba0b..db1bd457f83d1 100644
--- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
+++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
@@ -294,7 +294,8 @@ static Expected 
hasObjCCategoryInModule(BitstreamCursor &Stream) {
 return error("I

[llvm-branch-commits] [flang] [flang][OpenMP] Make object identity more precise (PR #94495)


llvmbot wrote:



@llvm/pr-subscribers-flang-openmp

@llvm/pr-subscribers-flang-fir-hlfir

Author: Krzysztof Parzyszek (kparzysz)


Changes

Derived type components may use a given `Symbol` regardless of what parent 
objects they are a part of. Because of that, simply using a symbol address is 
not sufficient to determine object identity.

Make the designator a part of the IdTy. To compare identities, when symbols are 
equal (and non-null), compare the designators.

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


3 Files Affected:

- (modified) flang/lib/Lower/OpenMP/Clauses.h (+42-8) 
- (modified) flang/lib/Lower/OpenMP/Utils.cpp (+1-1) 
- (modified) flang/test/Lower/OpenMP/map-component-ref.f90 (+32-9) 


``diff
diff --git a/flang/lib/Lower/OpenMP/Clauses.h b/flang/lib/Lower/OpenMP/Clauses.h
index f7cd0ea83ad12..98fb5dcf7722e 100644
--- a/flang/lib/Lower/OpenMP/Clauses.h
+++ b/flang/lib/Lower/OpenMP/Clauses.h
@@ -36,30 +36,64 @@ struct TypeTy : public evaluate::SomeType {
   bool operator==(const TypeTy &t) const { return true; }
 };
 
-using IdTy = semantics::Symbol *;
+template 
+struct IdTyTemplate {
+  // "symbol" is always non-null for id's of actual objects.
+  Fortran::semantics::Symbol *symbol;
+  std::optional designator;
+
+  bool operator==(const IdTyTemplate &other) const {
+// If symbols are different, then the objects are different.
+if (symbol != other.symbol)
+  return false;
+if (symbol == nullptr)
+  return true;
+// Equal symbols don't necessarily indicate identical objects,
+// for example, a derived object component may use a single symbol,
+// which will refer to different objects for different designators,
+// e.g. a%c and b%c.
+return designator == other.designator;
+  }
+
+  operator bool() const { return symbol != nullptr; }
+};
+
 using ExprTy = SomeExpr;
 
 template 
 using List = tomp::ListT;
 } // namespace Fortran::lower::omp
 
+// Specialization of the ObjectT template
 namespace tomp::type {
 template <>
-struct ObjectT {
-  using IdTy = Fortran::lower::omp::IdTy;
+struct ObjectT,
+   Fortran::lower::omp::ExprTy> {
+  using IdTy = Fortran::lower::omp::IdTyTemplate;
   using ExprTy = Fortran::lower::omp::ExprTy;
 
-  IdTy id() const { return symbol; }
-  Fortran::semantics::Symbol *sym() const { return symbol; }
-  const std::optional &ref() const { return designator; }
+  IdTy id() const { return identity; }
+  Fortran::semantics::Symbol *sym() const { return identity.symbol; }
+  const std::optional &ref() const { return identity.designator; }
 
-  IdTy symbol;
-  std::optional designator;
+  IdTy identity;
 };
 } // namespace tomp::type
 
 namespace Fortran::lower::omp {
+using IdTy = IdTyTemplate;
+}
 
+namespace std {
+template <>
+struct hash {
+  size_t operator()(const Fortran::lower::omp::IdTy &id) const {
+return static_cast(reinterpret_cast(id.symbol));
+  }
+};
+} // namespace std
+
+namespace Fortran::lower::omp {
 using Object = tomp::ObjectT;
 using ObjectList = tomp::ObjectListT;
 
diff --git a/flang/lib/Lower/OpenMP/Utils.cpp b/flang/lib/Lower/OpenMP/Utils.cpp
index eff915f569f27..da94352a84a7c 100644
--- a/flang/lib/Lower/OpenMP/Utils.cpp
+++ b/flang/lib/Lower/OpenMP/Utils.cpp
@@ -188,7 +188,7 @@ void addChildIndexAndMapToParent(
 std::map> &parentMemberIndices,
 mlir::omp::MapInfoOp &mapOp, semantics::SemanticsContext &semaCtx) {
-  std::optional dataRef = ExtractDataRef(object.designator);
+  std::optional dataRef = ExtractDataRef(object.ref());
   assert(dataRef.has_value() &&
  "DataRef could not be extracted during mapping of derived type "
  "cannot proceed");
diff --git a/flang/test/Lower/OpenMP/map-component-ref.f90 
b/flang/test/Lower/OpenMP/map-component-ref.f90
index 2c582667f38d3..21b56ab303acd 100644
--- a/flang/test/Lower/OpenMP/map-component-ref.f90
+++ b/flang/test/Lower/OpenMP/map-component-ref.f90
@@ -1,21 +1,22 @@
 ! RUN: %flang_fc1 -emit-hlfir -fopenmp %s -o - | FileCheck %s
 ! RUN: bbc -fopenmp -emit-hlfir %s -o - | FileCheck %s
 
-! CHECK: %[[V0:[0-9]+]] = fir.alloca !fir.type<_QFfooTt0{a0:i32,a1:i32}> 
{bindc_name = "a", uniq_name = "_QFfooEa"}
-! CHECK: %[[V1:[0-9]+]]:2 = hlfir.declare %[[V0]] {uniq_name = "_QFfooEa"} : 
(!fir.ref>) -> 
(!fir.ref>, 
!fir.ref>)
-! CHECK: %[[V2:[0-9]+]] = hlfir.designate %[[V1]]#0{"a1"}   : 
(!fir.ref>) -> !fir.ref
+! CHECK-LABEL: func.func @_QPfoo1
+! CHECK: %[[V0:[0-9]+]] = fir.alloca !fir.type<_QFfoo1Tt0{a0:i32,a1:i32}> 
{bindc_name = "a", uniq_name = "_QFfoo1Ea"}
+! CHECK: %[[V1:[0-9]+]]:2 = hlfir.declare %[[V0]] {uniq_name = "_QFfoo1Ea"} : 
(!fir.ref>) -> 
(!fir.ref>, 
!fir.ref>)
+! CHECK: %[[V2:[0-9]+]] = hlfir.designate %[[V1]]#0{"a1"}   : 
(!fir.ref>) -> !fir.ref
 ! CHECK: %[[V3:[0-9]+]] = omp.map.info var_ptr(%[[V2]] : !fir.ref, i32) 
map_clauses(tofrom) capture(ByRef) -> !fir.ref {name = "a%a1"}
-! CHECK: %[[V4:[0-9]+]] = omp.map.info var_ptr(%[[V1]]#1 : 
!fir.ref>, 
!fir.type<_QFf

[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 updated 
https://github.com/llvm/llvm-project/pull/91038

>From 7f8d5e96e879f2e63a0c751547b4754f2634 Mon Sep 17 00:00:00 2001
From: Craig Topper 
Date: Fri, 3 May 2024 09:59:33 -0700
Subject: [PATCH 1/3] [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 5038f8a1fc156..4951e45edb9ed 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 0..38cda8d388945
--- /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
+}

>From c194040f2f57e1a2270ad3d77e50be010e76a54b Mon Sep 17 00:00:00 2001
From: AtariDreams 
Date: Sat, 1 Jun 2024 21:54:37 -0400
Subject: [PATCH 2/3] Update DAGCombiner.cpp

---
 llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp 
b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index 4951e45edb9ed..c8f7a0bfbd4b3 100644
--- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -8952,7 +8952,7 @@ SDValue DAGCombiner::mergeTruncStores(StoreSDNode *N) {
   if (ShiftAmtC % NarrowNumBits != 0)
 return SDValue();
 
-  // Make sure we aren't reading bits that are shifted in.
+  // Make sure we aren't reading the bits that are shifted in.
   if (ShiftAmtC > WideVal.getScalarValueSizeInBits() - NarrowNumBits)
 return SDValue();
 

>From 371f035fb685dd9ccf9ad3f977e1e153a522ca69 Mon Sep 17 00:00:00 2001
From: AtariDreams 
Date: Sat, 1 Jun 2024 21:55:02 -0400
Subject: [PATCH 3/3] Update DAGCombiner.cpp

---
 llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp 
b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index c8f7a0bfbd4b3..4951e45edb9ed 100644
--- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -8952,7 +8952,7 @@ SDValue DAGCombiner::mergeTruncStores(StoreSDNode *N) {
   if (ShiftAmtC % NarrowNumBits != 0)
 return SDValue();
 
-  // Make sure we aren't reading the bits that are shifted in.
+  // Make sure we aren't reading bits that are shifted in.
   if (ShiftAmtC > WideVal.getScalarValueSizeInBits() - NarrowNumBits)
 return SDValue();
 

___
llvm-branch-commits mailing list
[email protected]
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 updated 
https://github.com/llvm/llvm-project/pull/91038

>From a62c1fce19ad9c1bf6899e9b528a07593909be8f 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 5038f8a1fc156..4951e45edb9ed 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 0..38cda8d388945
--- /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
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [flang] [flang][OpenMP] Make object identity more precise (PR #94495)


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

LGTM, and tested it locally and it seems to fix the issue I encountered! Thank 
you very much for this fix :-) 

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


[llvm-branch-commits] [clang] 8c0fe0d - release/18.x: [clang-format] Don't always break before << between str… (#94091)


Author: Owen Pan
Date: 2024-06-05T14:55:50-07:00
New Revision: 8c0fe0d65ed85966c0ac075e896620c55ca95227

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

LOG: release/18.x: [clang-format] Don't always break before << between str… 
(#94091)

…ing literals (#92214)

Added: 


Modified: 
clang/lib/Format/TokenAnnotator.cpp
clang/unittests/Format/FormatTest.cpp

Removed: 




diff  --git a/clang/lib/Format/TokenAnnotator.cpp 
b/clang/lib/Format/TokenAnnotator.cpp
index c1f1662481922..628fe46cc348e 100644
--- a/clang/lib/Format/TokenAnnotator.cpp
+++ b/clang/lib/Format/TokenAnnotator.cpp
@@ -5159,9 +5159,11 @@ bool TokenAnnotator::mustBreakBefore(const AnnotatedLine 
&Line,
 return true;
   if (Left.IsUnterminatedLiteral)
 return true;
-  if (Right.is(tok::lessless) && Right.Next && Left.is(tok::string_literal) &&
-  Right.Next->is(tok::string_literal)) {
-return true;
+  if (const auto *BeforeLeft = Left.Previous, *AfterRight = Right.Next;
+  BeforeLeft && BeforeLeft->is(tok::lessless) &&
+  Left.is(tok::string_literal) && Right.is(tok::lessless) && AfterRight &&
+  AfterRight->is(tok::string_literal)) {
+return Right.NewlinesBefore > 0;
   }
   if (Right.is(TT_RequiresClause)) {
 switch (Style.RequiresClausePosition) {

diff  --git a/clang/unittests/Format/FormatTest.cpp 
b/clang/unittests/Format/FormatTest.cpp
index 0161a1685eb12..d69632f7f0f8c 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -10426,6 +10426,17 @@ TEST_F(FormatTest, KeepStringLabelValuePairsOnALine) {
   "  bbb);");
 }
 
+TEST_F(FormatTest, WrapBeforeInsertionOperatorbetweenStringLiterals) {
+  verifyFormat("QStringList() << \"foo\" << \"bar\";");
+
+  verifyNoChange("QStringList() << \"foo\"\n"
+ "  << \"bar\";");
+
+  verifyFormat("log_error(log, \"foo\" << \"bar\");",
+   "log_error(log, \"foo\"\n"
+   "   << \"bar\");");
+}
+
 TEST_F(FormatTest, UnderstandsEquals) {
   verifyFormat(
   "a =\n"



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


[llvm-branch-commits] [llvm] 60d8b31 - Revert "[RISCV] Support select/merge like ops for bf16 vectors when have Zvfb…"


Author: Mehdi Amini
Date: 2024-06-05T21:13:29-07:00
New Revision: 60d8b31b055ebc9211ccd1326c8ee73602f71a88

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

LOG: Revert "[RISCV] Support select/merge like ops for bf16 vectors when have 
Zvfb…"

This reverts commit d5ab38f69c1a5c1456bc1a8cc936489d31599f33.

Added: 


Modified: 
llvm/lib/Target/RISCV/RISCVISelLowering.cpp
llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td
llvm/lib/Target/RISCV/RISCVInstrInfoVSDPatterns.td
llvm/lib/Target/RISCV/RISCVInstrInfoVVLPatterns.td
llvm/test/CodeGen/RISCV/rvv/fixed-vectors-select-fp.ll
llvm/test/CodeGen/RISCV/rvv/fixed-vectors-vpmerge.ll
llvm/test/CodeGen/RISCV/rvv/fixed-vectors-vselect-vp.ll
llvm/test/CodeGen/RISCV/rvv/select-fp.ll
llvm/test/CodeGen/RISCV/rvv/vpmerge-sdnode.ll
llvm/test/CodeGen/RISCV/rvv/vselect-fp.ll
llvm/test/CodeGen/RISCV/rvv/vselect-vp.ll

Removed: 




diff  --git a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp 
b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
index 4051279fdbf8e..8ace5d79af079 100644
--- a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
+++ b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
@@ -1102,15 +1102,6 @@ RISCVTargetLowering::RISCVTargetLowering(const 
TargetMachine &TM,
 ISD::EXTRACT_SUBVECTOR},
VT, Custom);
 setOperationAction({ISD::LOAD, ISD::STORE}, VT, Custom);
-if (Subtarget.hasStdExtZfbfmin()) {
-  if (Subtarget.hasVInstructionsF16())
-setOperationAction(ISD::SPLAT_VECTOR, VT, Legal);
-  else if (Subtarget.hasVInstructionsF16Minimal())
-setOperationAction(ISD::SPLAT_VECTOR, VT, Custom);
-}
-setOperationAction({ISD::VP_MERGE, ISD::VP_SELECT, ISD::SELECT}, VT,
-   Custom);
-setOperationAction(ISD::SELECT_CC, VT, Expand);
 // TODO: Promote to fp32.
   }
 }
@@ -1340,15 +1331,6 @@ RISCVTargetLowering::RISCVTargetLowering(const 
TargetMachine &TM,
   ISD::EXTRACT_SUBVECTOR},
  VT, Custom);
   setOperationAction({ISD::LOAD, ISD::STORE}, VT, Custom);
-  if (Subtarget.hasStdExtZfbfmin()) {
-if (Subtarget.hasVInstructionsF16())
-  setOperationAction(ISD::SPLAT_VECTOR, VT, Legal);
-else if (Subtarget.hasVInstructionsF16Minimal())
-  setOperationAction(ISD::SPLAT_VECTOR, VT, Custom);
-  }
-  setOperationAction(
-  {ISD::VP_MERGE, ISD::VP_SELECT, ISD::VSELECT, ISD::SELECT}, VT,
-  Custom);
   // TODO: Promote to fp32.
   continue;
 }
@@ -6722,16 +6704,10 @@ SDValue RISCVTargetLowering::LowerOperation(SDValue Op,
   case ISD::BUILD_VECTOR:
 return lowerBUILD_VECTOR(Op, DAG, Subtarget);
   case ISD::SPLAT_VECTOR:
-if ((Op.getValueType().getScalarType() == MVT::f16 &&
- (Subtarget.hasVInstructionsF16Minimal() &&
-  Subtarget.hasStdExtZfhminOrZhinxmin() &&
-  !Subtarget.hasVInstructionsF16())) ||
-(Op.getValueType().getScalarType() == MVT::bf16 &&
- (Subtarget.hasVInstructionsBF16() && Subtarget.hasStdExtZfbfmin() &&
-  Subtarget.hasVInstructionsF16Minimal() &&
-  !Subtarget.hasVInstructionsF16( {
-  if (Op.getValueType() == MVT::nxv32f16 ||
-  Op.getValueType() == MVT::nxv32bf16)
+if (Op.getValueType().getScalarType() == MVT::f16 &&
+(Subtarget.hasVInstructionsF16Minimal() &&
+ !Subtarget.hasVInstructionsF16())) {
+  if (Op.getValueType() == MVT::nxv32f16)
 return SplitVectorOp(Op, DAG);
   SDLoc DL(Op);
   SDValue NewScalar =

diff  --git a/llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td 
b/llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td
index fe4d839e4fdcb..b0949f5fc1d72 100644
--- a/llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td
+++ b/llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td
@@ -382,20 +382,7 @@ class GetIntVTypeInfo {
   // Equivalent integer vector type. Eg.
   //   VI8M1 → VI8M1 (identity)
   //   VF64M4 → VI64M4
-  VTypeInfo Vti = !cast(!subst("VBF", "VI",
-  !subst("VF", "VI",
- !cast(vti;
-}
-
-// This functor is used to obtain the fp vector type that has the same SEW and
-// multiplier as the input parameter type.
-class GetFpVTypeInfo {
-  // Equivalent integer vector type. Eg.
-  //   VF16M1 → VF16M1 (identity)
-  //   VBF16M1 → VF16M1
-  VTypeInfo Vti = !cast(!subst("VBF", "VF",
-  !subst("VI", "VF",
- !cast(vti;
+  VTypeInfo Vti = !cast(!subst("VF", "VI", 

[llvm-branch-commits] [libcxx] [libc++] Implement std::move_only_function (P0288R9) (PR #94670)


github-actions[bot] wrote:




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



You can test this locally with the following command:


``bash
git-clang-format --diff 5367b2c862a7bfe138ee17994edfdb7938437064 
7a203002b19f5a2827607e73a998dcd1ace9d135 -- 
libcxx/include/__functional/move_only_function.h 
libcxx/include/__functional/move_only_function_common.h 
libcxx/include/__functional/move_only_function_impl.h 
libcxx/include/__utility/pointer_int_pair.h 
libcxx/test/libcxx/private_headers.verify.cpp 
libcxx/test/libcxx/utilities/function.objects/func.wrap/func.wrap.move/assert.engaged.cpp
 libcxx/test/libcxx/utilities/pointer_int_pair.pass.cpp 
libcxx/test/libcxx/utilities/pointer_int_pair/assert.constructor.pass.cpp 
libcxx/test/libcxx/utilities/pointer_int_pair/constinit.verify.cpp 
libcxx/test/libcxx/utilities/pointer_int_pair/pointer_int_pair.pass.cpp 
libcxx/test/libcxx/utilities/pointer_int_pair/static_asserts.verify.cpp 
libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/assignment/functor.pass.cpp
 
libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/assignment/move.pass.cpp
 
libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/assignment/move_other.pass.cpp
 
libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/assignment/nullptr.pass.cpp
 
libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/call/lvalue.pass.cpp
 
libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/call/lvalue_const.pass.cpp
 
libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/call/lvalue_const_noexcept.pass.cpp
 
libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/call/lvalue_noexcept.pass.cpp
 
libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/call/normal.pass.cpp
 
libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/call/normal_const.pass.cpp
 
libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/call/normal_const_noexcept.pass.cpp
 
libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/call/normal_noexcept.pass.cpp
 
libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/call/rvalue.pass.cpp
 
libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/call/rvalue_const.pass.cpp
 
libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/call/rvalue_const_noexcept.pass.cpp
 
libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/call/rvalue_noexcept.pass.cpp
 libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/common.h 
libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/ctors/default.pass.cpp
 
libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/ctors/functor.pass.cpp
 
libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/ctors/in_place.pass.cpp
 
libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/ctors/in_place_init_list.pass.cpp
 
libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/ctors/move.pass.cpp
 
libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/ctors/move_other.pass.cpp
 
libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/ctors/nullptr.pass.cpp
 
libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/swap.adl.pass.cpp
 
libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/swap.member.pass.cpp
 libcxx/include/__configuration/abi.h libcxx/include/__std_clang_module 
libcxx/include/functional libcxx/include/version 
libcxx/test/std/language.support/support.limits/support.limits.general/functional.version.compile.pass.cpp
 
libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp
 libcxx/test/support/type_algorithms.h
``





View the diff from clang-format here.


``diff
diff --git a/libcxx/test/libcxx/private_headers.verify.cpp 
b/libcxx/test/libcxx/private_headers.verify.cpp
index fc76655325..8debceecd2 100644
--- a/libcxx/test/libcxx/private_headers.verify.cpp
+++ b/libcxx/test/libcxx/private_headers.verify.cpp
@@ -226,11 +226,11 @@ END-SCRIPT
 #include <__algorithm/unwrap_iter.h> // expected-error@*:* {{use of private 
header from outside its module: '__algorithm/unwrap_iter.h'}}
 #include <__algorithm/unwrap_range.h> // expected-error@*:* {{use of private 
header from outside its module: '__algorithm/unwrap_range.h'}}
 #include <__algorithm/upper_bound.h> // expected-error@*:* {{use of private 
header from outside its module: '__algorithm/upper_bound.h'}}
-#include <__availability> // expected-error@*:* {{use of private header from 
outside its module: '__availability'}}
+#include <__availability>   // expected-error@*:* {{use of private header from 
outside its module: '__availability'}}
 #include <__bit/bit_cast.h> // expected-error@*:* {{use of private header from 
outside its module: '__bit/bit_cast.h'}}
 #include

[llvm-branch-commits] [llvm] [Frontend] Introduce `getDirectiveCategory` for ACC/OMP directives (PR #94689)


llvmbot wrote:




@llvm/pr-subscribers-flang-openmp

Author: Krzysztof Parzyszek (kparzysz)


Changes

The categories are primarily meant for OpenMP, where the spec assigns a 
category to each directive. It's one of declarative, executable, informational, 
meta, subsidiary, and utility.

These will be used in clang to avoid listing directives belonging to certain 
categories by hand.

---

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


7 Files Affected:

- (modified) llvm/include/llvm/Frontend/Directive/DirectiveBase.td (+15) 
- (modified) llvm/include/llvm/Frontend/OpenACC/ACC.td (+21) 
- (modified) llvm/include/llvm/Frontend/OpenMP/OMP.td (+109) 
- (modified) llvm/include/llvm/TableGen/DirectiveEmitter.h (+6) 
- (modified) llvm/test/TableGen/directive1.td (+22-1) 
- (modified) llvm/test/TableGen/directive2.td (+22-1) 
- (modified) llvm/utils/TableGen/DirectiveEmitter.cpp (+30-1) 


``diff
diff --git a/llvm/include/llvm/Frontend/Directive/DirectiveBase.td 
b/llvm/include/llvm/Frontend/Directive/DirectiveBase.td
index ce532e0cfae29..6889c7e642ec6 100644
--- a/llvm/include/llvm/Frontend/Directive/DirectiveBase.td
+++ b/llvm/include/llvm/Frontend/Directive/DirectiveBase.td
@@ -156,6 +156,18 @@ def AS_FromLeaves : Association<"FromLeaves"> {}// See 
below
 // The name "AS_FromLeaves" is recognized by TableGen, and there is no enum
 // generated for it.
 
+// Kinds of directive categories.
+class Category {
+  string name = n;  // Name of the enum value in enum class Category.
+}
+
+def CA_Declarative: Category<"Declarative"> {}
+def CA_Executable: Category<"Executable"> {}
+def CA_Informational: Category<"Informational"> {}
+def CA_Meta: Category<"Meta"> {}
+def CA_Subsidiary: Category<"Subsidiary"> {}
+def CA_Utility: Category<"Utility"> {}
+
 // Information about a specific directive.
 class Directive {
   // Name of the directive. Can be composite directive sepearted by whitespace.
@@ -190,4 +202,7 @@ class Directive {
 
   // What the directive is associated with.
   Association association = AS_FromLeaves;
+
+  // The category if the directive.
+  Category category = ?;
 }
diff --git a/llvm/include/llvm/Frontend/OpenACC/ACC.td 
b/llvm/include/llvm/Frontend/OpenACC/ACC.td
index dfa6a222e9f77..30a81efe7f8a6 100644
--- a/llvm/include/llvm/Frontend/OpenACC/ACC.td
+++ b/llvm/include/llvm/Frontend/OpenACC/ACC.td
@@ -268,6 +268,7 @@ def ACCC_Unknown : Clause<"unknown"> {
 // 2.12
 def ACC_Atomic : Directive<"atomic"> {
   let association = AS_Block;
+  let category = CA_Executable;
 }
 
 // 2.6.5
@@ -293,6 +294,7 @@ def ACC_Data : Directive<"data"> {
 VersionedClause
   ];
   let association = AS_Block;
+  let category = CA_Executable;
 }
 
 // 2.13
@@ -308,6 +310,7 @@ def ACC_Declare : Directive<"declare"> {
 VersionedClause
   ];
   let association = AS_None;
+  let category = CA_Executable;
 }
 
 // 2.5.3
@@ -334,6 +337,7 @@ def ACC_Kernels : Directive<"kernels"> {
 VersionedClause
   ];
   let association = AS_Block;
+  let category = CA_Executable;
 }
 
 // 2.5.1
@@ -363,6 +367,7 @@ def ACC_Parallel : Directive<"parallel"> {
 VersionedClause
   ];
   let association = AS_Block;
+  let category = CA_Executable;
 }
 
 // 2.5.2
@@ -391,6 +396,7 @@ def ACC_Serial : Directive<"serial"> {
 VersionedClause
   ];
   let association = AS_Block;
+  let category = CA_Executable;
 }
 
 // 2.9
@@ -411,11 +417,13 @@ def ACC_Loop : Directive<"loop"> {
 VersionedClause
   ];
   let association = AS_Loop;
+  let category = CA_Executable;
 }
 
 // 2.10
 def ACC_Cache : Directive<"cache"> {
   let association = AS_None;
+  let category = CA_Executable;
 }
 
 // 2.14.1
@@ -426,6 +434,7 @@ def ACC_Init : Directive<"init"> {
 VersionedClause
   ];
   let association = AS_None;
+  let category = CA_Executable;
 }
 
 // 2.15.1
@@ -442,6 +451,7 @@ def ACC_Routine : Directive<"routine"> {
 VersionedClause
   ];
   let association = AS_Declaration;
+  let category = CA_Declarative;
 }
 
 // 2.14.3
@@ -461,6 +471,7 @@ def ACC_Set : Directive<"set"> {
 VersionedClause
   ];
   let association = AS_None;
+  let category = CA_Executable;
 }
 
 // 2.14.2
@@ -471,6 +482,7 @@ def ACC_Shutdown : Directive<"shutdown"> {
 VersionedClause
   ];
   let association = AS_None;
+  let category = CA_Executable;
 }
 
 // 2.14.4
@@ -490,6 +502,7 @@ def ACC_Update : Directive<"update"> {
 VersionedClause
   ];
   let association = AS_None;
+  let category = CA_Executable;
 }
 
 // 2.16.3
@@ -499,6 +512,7 @@ def ACC_Wait : Directive<"wait"> {
 VersionedClause
   ];
   let association = AS_None;
+  let category = CA_Executable;
 }
 
 // 2.14.6
@@ -516,6 +530,7 @@ def ACC_EnterData : Directive<"enter data"> {
 VersionedClause
   ];
   let association = AS_None;
+  let category = CA_Executable;
 }
 
 // 2.14.7
@@ -534,6 +549,7 @@ def ACC_ExitData : Directive<"exit data"> {
 VersionedClause
   ];
   let association 

[llvm-branch-commits] [llvm] [Frontend] Introduce `getDirectiveCategory` for ACC/OMP directives (PR #94689)


llvmbot wrote:




@llvm/pr-subscribers-openacc

Author: Krzysztof Parzyszek (kparzysz)


Changes

The categories are primarily meant for OpenMP, where the spec assigns a 
category to each directive. It's one of declarative, executable, informational, 
meta, subsidiary, and utility.

These will be used in clang to avoid listing directives belonging to certain 
categories by hand.

---

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


7 Files Affected:

- (modified) llvm/include/llvm/Frontend/Directive/DirectiveBase.td (+15) 
- (modified) llvm/include/llvm/Frontend/OpenACC/ACC.td (+21) 
- (modified) llvm/include/llvm/Frontend/OpenMP/OMP.td (+109) 
- (modified) llvm/include/llvm/TableGen/DirectiveEmitter.h (+6) 
- (modified) llvm/test/TableGen/directive1.td (+22-1) 
- (modified) llvm/test/TableGen/directive2.td (+22-1) 
- (modified) llvm/utils/TableGen/DirectiveEmitter.cpp (+30-1) 


``diff
diff --git a/llvm/include/llvm/Frontend/Directive/DirectiveBase.td 
b/llvm/include/llvm/Frontend/Directive/DirectiveBase.td
index ce532e0cfae29..6889c7e642ec6 100644
--- a/llvm/include/llvm/Frontend/Directive/DirectiveBase.td
+++ b/llvm/include/llvm/Frontend/Directive/DirectiveBase.td
@@ -156,6 +156,18 @@ def AS_FromLeaves : Association<"FromLeaves"> {}// See 
below
 // The name "AS_FromLeaves" is recognized by TableGen, and there is no enum
 // generated for it.
 
+// Kinds of directive categories.
+class Category {
+  string name = n;  // Name of the enum value in enum class Category.
+}
+
+def CA_Declarative: Category<"Declarative"> {}
+def CA_Executable: Category<"Executable"> {}
+def CA_Informational: Category<"Informational"> {}
+def CA_Meta: Category<"Meta"> {}
+def CA_Subsidiary: Category<"Subsidiary"> {}
+def CA_Utility: Category<"Utility"> {}
+
 // Information about a specific directive.
 class Directive {
   // Name of the directive. Can be composite directive sepearted by whitespace.
@@ -190,4 +202,7 @@ class Directive {
 
   // What the directive is associated with.
   Association association = AS_FromLeaves;
+
+  // The category if the directive.
+  Category category = ?;
 }
diff --git a/llvm/include/llvm/Frontend/OpenACC/ACC.td 
b/llvm/include/llvm/Frontend/OpenACC/ACC.td
index dfa6a222e9f77..30a81efe7f8a6 100644
--- a/llvm/include/llvm/Frontend/OpenACC/ACC.td
+++ b/llvm/include/llvm/Frontend/OpenACC/ACC.td
@@ -268,6 +268,7 @@ def ACCC_Unknown : Clause<"unknown"> {
 // 2.12
 def ACC_Atomic : Directive<"atomic"> {
   let association = AS_Block;
+  let category = CA_Executable;
 }
 
 // 2.6.5
@@ -293,6 +294,7 @@ def ACC_Data : Directive<"data"> {
 VersionedClause
   ];
   let association = AS_Block;
+  let category = CA_Executable;
 }
 
 // 2.13
@@ -308,6 +310,7 @@ def ACC_Declare : Directive<"declare"> {
 VersionedClause
   ];
   let association = AS_None;
+  let category = CA_Executable;
 }
 
 // 2.5.3
@@ -334,6 +337,7 @@ def ACC_Kernels : Directive<"kernels"> {
 VersionedClause
   ];
   let association = AS_Block;
+  let category = CA_Executable;
 }
 
 // 2.5.1
@@ -363,6 +367,7 @@ def ACC_Parallel : Directive<"parallel"> {
 VersionedClause
   ];
   let association = AS_Block;
+  let category = CA_Executable;
 }
 
 // 2.5.2
@@ -391,6 +396,7 @@ def ACC_Serial : Directive<"serial"> {
 VersionedClause
   ];
   let association = AS_Block;
+  let category = CA_Executable;
 }
 
 // 2.9
@@ -411,11 +417,13 @@ def ACC_Loop : Directive<"loop"> {
 VersionedClause
   ];
   let association = AS_Loop;
+  let category = CA_Executable;
 }
 
 // 2.10
 def ACC_Cache : Directive<"cache"> {
   let association = AS_None;
+  let category = CA_Executable;
 }
 
 // 2.14.1
@@ -426,6 +434,7 @@ def ACC_Init : Directive<"init"> {
 VersionedClause
   ];
   let association = AS_None;
+  let category = CA_Executable;
 }
 
 // 2.15.1
@@ -442,6 +451,7 @@ def ACC_Routine : Directive<"routine"> {
 VersionedClause
   ];
   let association = AS_Declaration;
+  let category = CA_Declarative;
 }
 
 // 2.14.3
@@ -461,6 +471,7 @@ def ACC_Set : Directive<"set"> {
 VersionedClause
   ];
   let association = AS_None;
+  let category = CA_Executable;
 }
 
 // 2.14.2
@@ -471,6 +482,7 @@ def ACC_Shutdown : Directive<"shutdown"> {
 VersionedClause
   ];
   let association = AS_None;
+  let category = CA_Executable;
 }
 
 // 2.14.4
@@ -490,6 +502,7 @@ def ACC_Update : Directive<"update"> {
 VersionedClause
   ];
   let association = AS_None;
+  let category = CA_Executable;
 }
 
 // 2.16.3
@@ -499,6 +512,7 @@ def ACC_Wait : Directive<"wait"> {
 VersionedClause
   ];
   let association = AS_None;
+  let category = CA_Executable;
 }
 
 // 2.14.6
@@ -516,6 +530,7 @@ def ACC_EnterData : Directive<"enter data"> {
 VersionedClause
   ];
   let association = AS_None;
+  let category = CA_Executable;
 }
 
 // 2.14.7
@@ -534,6 +549,7 @@ def ACC_ExitData : Directive<"exit data"> {
 VersionedClause
   ];
   let association = AS_

[llvm-branch-commits] [clang] [clang][OpenMP] Shorten directive classification in ParseOpenMP (PR #94691)


llvmbot wrote:




@llvm/pr-subscribers-clang

Author: Krzysztof Parzyszek (kparzysz)


Changes

Use directive categories to simplify long lists of `case` statements in the 
OpenMP parser. This is a step towards avoiding dependence on explicitly 
specified sets of directives that can be expressed more generically.
The upcoming OpenMP 6.0 will introduce many new combined directives, and the 
more generically we handle directives, the easier the introduction of the new 
standard will be.

---

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


2 Files Affected:

- (modified) clang/include/clang/Parse/Parser.h (+13) 
- (modified) clang/lib/Parse/ParseOpenMP.cpp (+217-309) 


``diff
diff --git a/clang/include/clang/Parse/Parser.h 
b/clang/include/clang/Parse/Parser.h
index d054b8cf0d240..88571a4a46f2c 100644
--- a/clang/include/clang/Parse/Parser.h
+++ b/clang/include/clang/Parse/Parser.h
@@ -3509,6 +3509,19 @@ class Parser : public CodeCompletionHandler {
   /// metadirective and therefore ends on the closing paren.
   StmtResult ParseOpenMPDeclarativeOrExecutableDirective(
   ParsedStmtContext StmtCtx, bool ReadDirectiveWithinMetadirective = 
false);
+
+  /// Parses executable directive.
+  ///
+  /// \param StmtCtx The context in which we're parsing the directive.
+  /// \param DKind The kind of the executable directive.
+  /// \param Loc Source location of the beginning of the directive.
+  /// \param ReadDirectiveWithinMetadirective true if directive is within a
+  /// metadirective and therefore ends on the closing paren.
+  StmtResult
+  ParseOpenMPExecutableDirective(ParsedStmtContext StmtCtx,
+ OpenMPDirectiveKind DKind, SourceLocation Loc,
+ bool ReadDirectiveWithinMetadirective);
+
   /// Parses clause of kind \a CKind for directive of a kind \a Kind.
   ///
   /// \param DKind Kind of current directive.
diff --git a/clang/lib/Parse/ParseOpenMP.cpp b/clang/lib/Parse/ParseOpenMP.cpp
index 50a872fedebf7..a10bb009ec835 100644
--- a/clang/lib/Parse/ParseOpenMP.cpp
+++ b/clang/lib/Parse/ParseOpenMP.cpp
@@ -2374,86 +2374,209 @@ Parser::DeclGroupPtrTy 
Parser::ParseOpenMPDeclarativeDirectiveWithExtDecl(
   case OMPD_unknown:
 Diag(Tok, diag::err_omp_unknown_directive);
 break;
-  case OMPD_parallel:
-  case OMPD_simd:
-  case OMPD_tile:
-  case OMPD_unroll:
-  case OMPD_task:
-  case OMPD_taskyield:
+  default:
+switch (getDirectiveCategory(DKind)) {
+case Category::Executable:
+case Category::Meta:
+case Category::Subsidiary:
+case Category::Utility:
+  Diag(Tok, diag::err_omp_unexpected_directive)
+  << 1 << getOpenMPDirectiveName(DKind);
+  break;
+default:
+  break;
+}
+  }
+  while (Tok.isNot(tok::annot_pragma_openmp_end))
+ConsumeAnyToken();
+  ConsumeAnyToken();
+  return nullptr;
+}
+
+StmtResult
+Parser::ParseOpenMPExecutableDirective(ParsedStmtContext StmtCtx,
+   OpenMPDirectiveKind DKind,
+   SourceLocation Loc,
+   bool ReadDirectiveWithinMetadirective) {
+  bool HasAssociatedStatement = true;
+
+  switch (DKind) {
   case OMPD_barrier:
-  case OMPD_taskwait:
-  case OMPD_taskgroup:
-  case OMPD_flush:
+  case OMPD_cancel:
+  case OMPD_cancellation_point:
   case OMPD_depobj:
+  case OMPD_error:
+  case OMPD_flush:
+  case OMPD_interop:
   case OMPD_scan:
-  case OMPD_for:
-  case OMPD_for_simd:
-  case OMPD_sections:
-  case OMPD_section:
-  case OMPD_single:
-  case OMPD_master:
-  case OMPD_ordered:
-  case OMPD_critical:
-  case OMPD_parallel_for:
-  case OMPD_parallel_for_simd:
-  case OMPD_parallel_sections:
-  case OMPD_parallel_master:
-  case OMPD_parallel_masked:
-  case OMPD_atomic:
-  case OMPD_target:
-  case OMPD_teams:
-  case OMPD_cancellation_point:
-  case OMPD_cancel:
-  case OMPD_target_data:
   case OMPD_target_enter_data:
   case OMPD_target_exit_data:
-  case OMPD_target_parallel:
-  case OMPD_target_parallel_for:
-  case OMPD_taskloop:
-  case OMPD_taskloop_simd:
-  case OMPD_master_taskloop:
-  case OMPD_master_taskloop_simd:
-  case OMPD_parallel_master_taskloop:
-  case OMPD_parallel_master_taskloop_simd:
-  case OMPD_masked_taskloop:
-  case OMPD_masked_taskloop_simd:
-  case OMPD_parallel_masked_taskloop:
-  case OMPD_parallel_masked_taskloop_simd:
-  case OMPD_distribute:
   case OMPD_target_update:
-  case OMPD_distribute_parallel_for:
-  case OMPD_distribute_parallel_for_simd:
-  case OMPD_distribute_simd:
-  case OMPD_target_parallel_for_simd:
-  case OMPD_target_simd:
-  case OMPD_scope:
-  case OMPD_teams_distribute:
-  case OMPD_teams_distribute_simd:
-  case OMPD_teams_distribute_parallel_for_simd:
-  case OMPD_teams_distribute_parallel_for:
-  case OMPD_target_teams:
-  case OMPD_target_teams_distribute:
-  case OMPD_target_teams_distribute_paralle

[llvm-branch-commits] [libcxx] [libc++] Implement std::move_only_function (P0288R9) (PR #94670)



@@ -0,0 +1,233 @@
+//===--===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+// This header is unguarded on purpose. This header is an implementation 
detail of move_only_function.h
+// and generates multiple versions of std::move_only_function
+
+#include <__config>
+#include <__functional/invoke.h>
+#include <__functional/move_only_function_common.h>
+#include <__type_traits/is_trivially_destructible.h>
+#include <__utility/exchange.h>
+#include <__utility/forward.h>
+#include <__utility/in_place.h>
+#include <__utility/move.h>
+#include <__utility/pointer_int_pair.h>
+#include <__utility/small_buffer.h>
+#include <__utility/swap.h>
+#include 
+#include 
+#include 
+#include 
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#  pragma GCC system_header
+#endif
+
+#ifndef _LIBCPP_IN_MOVE_ONLY_FUNCTION_H
+#  error This header should only be included from move_only_function.h
+#endif
+
+#ifndef _LIBCPP_MOVE_ONLY_FUNCTION_CV
+#  define _LIBCPP_MOVE_ONLY_FUNCTION_CV
+#endif
+
+#ifndef _LIBCPP_MOVE_ONLY_FUNCTION_REF

EricWF wrote:

I really dislike this. It produces terrible diagnostics for users.

I feel like we could find another way to represent the function type so we can 
limit the duplication.

If we strip the qualifiers and turn them into an enumeration like 
`_Const|_RValue|_Noexcept`, we could use a traits class to produce the correct 
function types as needed.

We still have to spell out the top level `move_only_function` class a few 
times, but we can implement everything in a base that takes this enumeration 
and the desugared type.

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


[llvm-branch-commits] [libcxx] [libc++] Implement std::move_only_function (P0288R9) (PR #94670)



@@ -0,0 +1,80 @@
+//===--===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#ifndef MOVE_ONLY_FUNCTION_COMMON_H
+#define MOVE_ONLY_FUNCTION_COMMON_H
+
+#include 
+#include 
+
+inline bool called;
+inline void call_func() noexcept { called = true; }
+
+struct MoveCounter {
+  int* counter_;
+  MoveCounter(int* counter) : counter_(counter) {}
+  MoveCounter(MoveCounter&& other) : counter_(other.counter_) { ++*counter_; }
+};
+
+struct TriviallyDestructible {
+  TriviallyDestructible() = default;
+  TriviallyDestructible(MoveCounter) {}
+  TriviallyDestructible(std::initializer_list, MoveCounter) {}
+  void operator()() const noexcept { called = true; }
+  int operator()(int i) const noexcept { return i; }
+};
+
+struct TriviallyDestructibleTooLarge {
+  TriviallyDestructibleTooLarge() = default;
+  TriviallyDestructibleTooLarge(MoveCounter) {}
+  TriviallyDestructibleTooLarge(std::initializer_list, MoveCounter) {}
+  void operator()() const noexcept { called = true; }
+  int operator()(int i) const noexcept { return i; }
+  char a[5 * sizeof(void*)];
+};
+
+struct NonTrivial {
+  NonTrivial() = default;
+  NonTrivial(MoveCounter) {}
+  NonTrivial(std::initializer_list&, MoveCounter) {}
+  NonTrivial(NonTrivial&&) noexcept(false) {}
+  ~NonTrivial() {}
+
+  void operator()() const noexcept { called = true; }
+  int operator()(int i) const noexcept { return i; }
+};
+
+inline int get_val(int i) noexcept { return i; }
+
+enum class CallType {
+  None,
+  LValue,
+  RValue,
+  ConstLValue,
+  ConstRValue,
+};
+
+struct CallTypeChecker {
+  CallType* type;
+  using enum CallType;

EricWF wrote:

Nice types.

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


[llvm-branch-commits] [libcxx] [libc++] Implement std::move_only_function (P0288R9) (PR #94670)



@@ -0,0 +1,233 @@
+//===--===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+// This header is unguarded on purpose. This header is an implementation 
detail of move_only_function.h
+// and generates multiple versions of std::move_only_function
+
+#include <__config>
+#include <__functional/invoke.h>
+#include <__functional/move_only_function_common.h>
+#include <__type_traits/is_trivially_destructible.h>
+#include <__utility/exchange.h>
+#include <__utility/forward.h>
+#include <__utility/in_place.h>
+#include <__utility/move.h>
+#include <__utility/pointer_int_pair.h>
+#include <__utility/small_buffer.h>
+#include <__utility/swap.h>
+#include 
+#include 
+#include 
+#include 
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#  pragma GCC system_header
+#endif
+
+#ifndef _LIBCPP_IN_MOVE_ONLY_FUNCTION_H
+#  error This header should only be included from move_only_function.h
+#endif
+
+#ifndef _LIBCPP_MOVE_ONLY_FUNCTION_CV
+#  define _LIBCPP_MOVE_ONLY_FUNCTION_CV
+#endif
+
+#ifndef _LIBCPP_MOVE_ONLY_FUNCTION_REF
+#  define _LIBCPP_MOVE_ONLY_FUNCTION_REF
+#  define _LIBCPP_MOVE_ONLY_FUNCTION_INVOKE_QUALS 
_LIBCPP_MOVE_ONLY_FUNCTION_CV&
+#else
+#  define _LIBCPP_MOVE_ONLY_FUNCTION_INVOKE_QUALS 
_LIBCPP_MOVE_ONLY_FUNCTION_CV _LIBCPP_MOVE_ONLY_FUNCTION_REF
+#endif
+
+#ifndef _LIBCPP_MOVE_ONLY_FUNCTION_NOEXCEPT
+#  define _LIBCPP_MOVE_ONLY_FUNCTION_NOEXCEPT false
+#endif
+
+#define _LIBCPP_MOVE_ONLY_FUNCTION_CVREF _LIBCPP_MOVE_ONLY_FUNCTION_CV 
_LIBCPP_MOVE_ONLY_FUNCTION_REF
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+#ifdef _LIBCPP_ABI_MOVE_ONLY_FUNCTION_TRIVIAL_ABI
+#  define _LIBCPP_MOVE_ONLY_FUNCTION_TRIVIAL_ABI [[_Clang::__trivial_abi__]]
+#else
+#  define _LIBCPP_MOVE_ONLY_FUNCTION_TRIVIAL_ABI
+#endif
+
+template 
+class move_only_function;
+
+template 
+class _LIBCPP_MOVE_ONLY_FUNCTION_TRIVIAL_ABI move_only_function<_ReturnT(
+_ArgTypes...) _LIBCPP_MOVE_ONLY_FUNCTION_CVREF 
noexcept(_LIBCPP_MOVE_ONLY_FUNCTION_NOEXCEPT)> {
+private:
+  static constexpr size_t __buffer_size_  = 3 * sizeof(void*);
+  static constexpr size_t __buffer_alignment_ = alignof(void*);
+  using _BufferT  = __small_buffer<__buffer_size_, 
__buffer_alignment_>;
+
+  using _TrivialVTable= _MoveOnlyFunctionTrivialVTable<_BufferT, _ReturnT, 
_ArgTypes...>;
+  using _NonTrivialVTable = _MoveOnlyFunctionNonTrivialVTable<_BufferT, 
_ReturnT, _ArgTypes...>;
+
+  template 
+  static constexpr _TrivialVTable __trivial_vtable_ = {
+  .__call_ = [](_BufferT& __buffer, _ArgTypes... __args) 
noexcept(_LIBCPP_MOVE_ONLY_FUNCTION_NOEXCEPT) -> _ReturnT {
+return std::invoke_r<_ReturnT>(
+static_cast<_Functor 
_LIBCPP_MOVE_ONLY_FUNCTION_INVOKE_QUALS>(*__buffer.__get<_Functor>()),
+std::forward<_ArgTypes>(__args)...);
+  }};
+
+  template 
+  static constexpr _NonTrivialVTable __non_trivial_vtable_{
+  __trivial_vtable_<_Functor>,
+  [](_BufferT& __buffer) noexcept -> void {
+std::destroy_at(__buffer.__get<_Functor>());
+__buffer.__dealloc<_Functor>();
+  },
+  };
+
+  template 
+  _LIBCPP_HIDE_FROM_ABI __pointer_bool_pair 
__get_vptr() {
+if constexpr (_BufferT::__fits_in_buffer<_Functor> && 
is_trivially_destructible_v<_Functor>) {
+  return {&__trivial_vtable_<_Functor>, false};
+} else {
+  return {&__non_trivial_vtable_<_Functor>, true};
+}
+  }
+
+  template 
+  static constexpr bool __is_callable_from = [] {
+using _DVT = decay_t<_VT>;
+if (_LIBCPP_MOVE_ONLY_FUNCTION_NOEXCEPT) {
+  return is_nothrow_invocable_r_v<_ReturnT, _DVT 
_LIBCPP_MOVE_ONLY_FUNCTION_CVREF, _ArgTypes...> &&
+ is_nothrow_invocable_r_v<_ReturnT, _DVT 
_LIBCPP_MOVE_ONLY_FUNCTION_INVOKE_QUALS, _ArgTypes...>;
+} else {
+  return is_invocable_r_v<_ReturnT, _DVT _LIBCPP_MOVE_ONLY_FUNCTION_CVREF, 
_ArgTypes...> &&
+ is_invocable_r_v<_ReturnT, _DVT 
_LIBCPP_MOVE_ONLY_FUNCTION_INVOKE_QUALS, _ArgTypes...>;
+}
+  }();
+
+  template 
+  _LIBCPP_HIDE_FROM_ABI void __construct(_Args&&... __args) {
+static_assert(is_constructible_v, _Func>);
+
+using _StoredFunc = decay_t<_Func>;
+__vtable_ = __get_vptr<_StoredFunc>();
+__buffer_.__construct<_StoredFunc>(std::forward<_Args>(__args)...);
+  }
+
+  _LIBCPP_HIDE_FROM_ABI void __reset() {
+if (__vtable_.__get_value())

EricWF wrote:

```if (__vtable_->__destroy)  {
  __vtable_->__destroy(__buffer_);
}
```

https://github.com/llvm/llvm-project/pull/94670
___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mai

[llvm-branch-commits] [libcxx] [libc++] Implement std::move_only_function (P0288R9) (PR #94670)



@@ -0,0 +1,46 @@
+//===--===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#ifndef _LIBCPP___FUNCTIONAL_MOVE_ONLY_FUNCTION_COMMON_H
+#define _LIBCPP___FUNCTIONAL_MOVE_ONLY_FUNCTION_COMMON_H
+
+#include <__config>
+#include <__type_traits/integral_constant.h>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#  pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+template 
+class move_only_function;
+
+template 
+struct __is_move_only_function : false_type {};
+
+template 
+struct __is_move_only_function> : true_type {};
+
+template 
+struct _MoveOnlyFunctionTrivialVTable {
+  using _CallFunc = _ReturnT(_BufferT&, _ArgTypes...);
+
+  _CallFunc* __call_;
+};
+
+template 
+struct _MoveOnlyFunctionNonTrivialVTable : 
_MoveOnlyFunctionTrivialVTable<_BufferT, _ReturnT, _ArgTypes...> {

EricWF wrote:

We don't need to instantiate this type with `_ReturnT` or `_ArgTypes...`.

That's  alot of template bloat. 

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


[llvm-branch-commits] [libcxx] [libc++] Implement std::move_only_function (P0288R9) (PR #94670)



@@ -0,0 +1,233 @@
+//===--===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+// This header is unguarded on purpose. This header is an implementation 
detail of move_only_function.h
+// and generates multiple versions of std::move_only_function
+
+#include <__config>
+#include <__functional/invoke.h>
+#include <__functional/move_only_function_common.h>
+#include <__type_traits/is_trivially_destructible.h>
+#include <__utility/exchange.h>
+#include <__utility/forward.h>
+#include <__utility/in_place.h>
+#include <__utility/move.h>
+#include <__utility/pointer_int_pair.h>
+#include <__utility/small_buffer.h>
+#include <__utility/swap.h>
+#include 
+#include 
+#include 
+#include 
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#  pragma GCC system_header
+#endif
+
+#ifndef _LIBCPP_IN_MOVE_ONLY_FUNCTION_H
+#  error This header should only be included from move_only_function.h
+#endif
+
+#ifndef _LIBCPP_MOVE_ONLY_FUNCTION_CV
+#  define _LIBCPP_MOVE_ONLY_FUNCTION_CV
+#endif
+
+#ifndef _LIBCPP_MOVE_ONLY_FUNCTION_REF

EricWF wrote:

Here's what I'm imagining...

```c++
#ifndef _LIBCPP___FUNCTIONAL_MOVE_ONLY_FUNCTION_H
#define _LIBCPP___FUNCTIONAL_MOVE_ONLY_FUNCTION_H

#include <__assert>
#include <__config>
#include <__functional/invoke.h>
#include <__type_traits/decay.h>
#include <__type_traits/invoke.h>
#include <__type_traits/is_function.h>
#include <__type_traits/is_member_function_pointer.h>
#include <__type_traits/is_pointer.h>
#include <__type_traits/is_same.h>
#include <__type_traits/is_trivially_constructible.h>
#include <__type_traits/is_trivially_destructible.h>
#include <__type_traits/remove_cvref.h>
#include <__type_traits/remove_pointer.h>
#include <__utility/forward.h>
#include <__utility/in_place.h>
#include <__utility/swap.h>
#include 
#include 
#include 

#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#  pragma GCC system_header
#endif

_LIBCPP_BEGIN_NAMESPACE_STD

enum class _Quals : unsigned {
  _None = 0,
  _Const= 1,
  _RVRef= 2,
  _LVRef= 4,
  _NoExcept = 8,
};

constexpr _Quals operator|(_Quals __x, _Quals __y) {
  return static_cast<_Quals>(static_cast(__x) | 
static_cast(__y));
}
constexpr _Quals operator&(_Quals __x, _Quals __y) {
  return static_cast<_Quals>(static_cast(__x) & 
static_cast(__y));
}
constexpr _Quals operator^(_Quals __x, _Quals __y) {
  return static_cast<_Quals>(static_cast(__x) ^ 
static_cast(__y));
}
constexpr _Quals operator~(_Quals __x) { return 
static_cast<_Quals>(~static_cast(__x)); }

constexpr bool operator==(const _Quals __x, const _Quals __y) {
  return static_cast(__x) == static_cast(__y);
}
constexpr bool operator!=(const _Quals __x, const _Quals __y) {
  return static_cast(__x) != static_cast(__y);
}

constexpr _Quals __cvref_quals(_Quals __q) { return __q & (_Quals::_Const | 
_Quals::_RVRef | _Quals::_LVRef); }

constexpr bool __is_noexcept(_Quals __q) { return (__q & _Quals::_NoExcept) == 
_Quals::_NoExcept; }

constexpr _Quals __ref_quals(_Quals __q) { return __q & (_Quals::_RVRef | 
_Quals::_LVRef); }

template 
struct __unqualify_type;

template 
struct __unqualify_type<_Ret(_Args...)> {
  using type = _Ret(_Args...);
  static constexpr _Quals __qual = _Quals::_None;
};

template 
struct __unqualify_type<_Ret(_Args...) const> {
  using type = _Ret(_Args...);
  static constexpr _Quals __qual = _Quals::_Const;
};

template 
struct __unqualify_type<_Ret(_Args...)&> {
  using type = _Ret(_Args...);
  static constexpr _Quals __qual = _Quals::_None | _Quals::_LVRef;
};

template 
struct __unqualify_type<_Ret(_Args...) const&> {
  using type = _Ret(_Args...);
  static constexpr _Quals __qual = _Quals::_Const | _Quals::_LVRef;
};

template 
struct __unqualify_type<_Ret(_Args...) &&> {
  using type = _Ret(_Args...);
  static constexpr _Quals __qual = _Quals::_None | _Quals::_RVRef;
};

template 
struct __unqualify_type<_Ret(_Args...) const&&> {
  using type = _Ret(_Args...);
  static constexpr _Quals __qual = _Quals::_Const | _Quals::_RVRef;
};

template 
struct __unqualify_type<_Ret(_Args...) noexcept> {
  using type = _Ret(_Args...);
  static constexpr _Quals __qual = _Quals::_None | _Quals::_NoExcept;
};

template 
struct __unqualify_type<_Ret(_Args...) const noexcept> {
  using type = _Ret(_Args...);
  static constexpr _Quals __qual = _Quals::_Const | _Quals::_NoExcept;
};

template 
struct __unqualify_type<_Ret(_Args...) & noexcept> {
  using type = _Ret(_Args...);
  static constexpr _Quals __qual = _Qual

[llvm-branch-commits] [libcxx] [libc++] Implement std::move_only_function (P0288R9) (PR #94670)


https://github.com/EricWF edited https://github.com/llvm/llvm-project/pull/94670
___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [libcxx] [libc++] Implement std::move_only_function (P0288R9) (PR #94670)


https://github.com/EricWF edited https://github.com/llvm/llvm-project/pull/94670
___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [libcxx] [libc++] Implement std::move_only_function (P0288R9) (PR #94670)


https://github.com/EricWF edited https://github.com/llvm/llvm-project/pull/94670
___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [libcxx] [libc++] Implement std::move_only_function (P0288R9) (PR #94670)


https://github.com/EricWF edited https://github.com/llvm/llvm-project/pull/94670
___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [libcxx] [libc++] Implement std::move_only_function (P0288R9) (PR #94670)



@@ -0,0 +1,46 @@
+//===--===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#ifndef _LIBCPP___FUNCTIONAL_MOVE_ONLY_FUNCTION_COMMON_H
+#define _LIBCPP___FUNCTIONAL_MOVE_ONLY_FUNCTION_COMMON_H
+
+#include <__config>
+#include <__type_traits/integral_constant.h>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#  pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+template 
+class move_only_function;
+
+template 
+struct __is_move_only_function : false_type {};
+
+template 
+struct __is_move_only_function> : true_type {};
+
+template 
+struct _MoveOnlyFunctionTrivialVTable {
+  using _CallFunc = _ReturnT(_BufferT&, _ArgTypes...);
+
+  _CallFunc* __call_;
+};
+
+template 
+struct _MoveOnlyFunctionNonTrivialVTable : 
_MoveOnlyFunctionTrivialVTable<_BufferT, _ReturnT, _ArgTypes...> {

EricWF wrote:

You either don't need the inheritance, or you don't need to give the "destruct" 
base class all the arguments, you only need that for the call.

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


[llvm-branch-commits] [libcxx] [libc++] Implement std::move_only_function (P0288R9) (PR #94670)



@@ -0,0 +1,233 @@
+//===--===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+// This header is unguarded on purpose. This header is an implementation 
detail of move_only_function.h
+// and generates multiple versions of std::move_only_function
+
+#include <__config>
+#include <__functional/invoke.h>
+#include <__functional/move_only_function_common.h>
+#include <__type_traits/is_trivially_destructible.h>
+#include <__utility/exchange.h>
+#include <__utility/forward.h>
+#include <__utility/in_place.h>
+#include <__utility/move.h>
+#include <__utility/pointer_int_pair.h>
+#include <__utility/small_buffer.h>
+#include <__utility/swap.h>
+#include 
+#include 
+#include 
+#include 
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#  pragma GCC system_header
+#endif
+
+#ifndef _LIBCPP_IN_MOVE_ONLY_FUNCTION_H
+#  error This header should only be included from move_only_function.h
+#endif
+
+#ifndef _LIBCPP_MOVE_ONLY_FUNCTION_CV
+#  define _LIBCPP_MOVE_ONLY_FUNCTION_CV
+#endif
+
+#ifndef _LIBCPP_MOVE_ONLY_FUNCTION_REF

EricWF wrote:

Huh, so I stand corrected here.

Normally, the way the terrible diagnostics come about is through the diagnostic 
caret pointing at a macro expansion. For example, were an invalid expression 
formed via a macro expansion, it would produce a diagnostic like:
https://godbolt.org/z/dKr1nzPd9
```
:12:1: error: no matching function for call to 'invoke'
   12 | EXPAND
```

However, since we never actually expand any of the expressions fully from a 
macro, and none of the macros lead an expression (where the caret might point, 
`_VSTD` was notorious for this), the diagnostics produced by your 
implementation don't get all muddy.

Neither do they really appear to hide too much information. I was worried it 
would be hard to tell the actual CV, ref, and noexcept qualifiers were  present 
from a particular diagnostic. And while you can't see what's used from the 
source, the clang diagnostics always seem to provide enough information to 
figure out which specialization your in. But that also seems to work:

```
/home/eric/llvm-project/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/call/rvalue_const_noexcept.pass.cpp:51:5:
 error: no matching function for call to object of type 
'std::move_only_function'
  51 | f();
   | ^
 
/home/eric/llvm-project/libcxx/include/__functional/move_only_function_impl.h:200:34:
 note: candidate function not viable: expects an rvalue for object argument
   200 |   _LIBCPP_HIDE_FROM_ABI _ReturnT operator()(_ArgTypes... __args) 
_LIBCPP_MOVE_ONLY_FUNCTION_CVREF
```

Now I still hate using the preprocessor, and dislike creating non-modular 
re-includable headers. And I have a strong aversion to its use. But diagnostics 
don't appear to be an issue here.

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


[llvm-branch-commits] [libcxx] [libc++] Implement std::move_only_function (P0288R9) (PR #94670)


EricWF wrote:

After implementing a version myself, I think there's a bunch of unneeded 
complexity in this type.
I compared the two implementations on a personal compiler-explorer which is set 
up to compare libc++ patches (I'm working to provide to other developers).

The use of `__libcpp_allocate` and `__libcpp_deallocate` allow the compiler to 
optimize away the allocations in mine, but not in this implementation. The 
result is the difference between each test optimizing to basically zero code vs 
a bunch of code.

This is the codegen for one of the `call` tests

```asm
test(): # @test()
  push rax
  lea rax, [rip + std::__2::move_only_function::__trivial_vtable_]
  cmp rax, 7
  jbe .LBB0_8
  lea rax, [rip + std::__2::move_only_function::__trivial_vtable_]
  cmp rax, 7
  jbe .LBB0_8
  mov byte ptr [rip + called], 0
  mov edi, 40
  mov esi, 1
  call operator new[](unsigned long, std::align_val_t)@PLT
  lea rcx, [rip + std::__2::move_only_function::__non_trivial_vtable_]
  cmp rcx, 7
  jbe .LBB0_8
  mov byte ptr [rip + called], 1
  mov esi, 40
  mov edx, 1
  mov rdi, rax
  call operator delete[](void*, unsigned long, std::align_val_t)@PLT
  mov byte ptr [rip + called], 0
  mov edi, 1
  mov esi, 1
  call operator new[](unsigned long, std::align_val_t)@PLT
  lea rcx, [rip + std::__2::move_only_function::__non_trivial_vtable_]
  cmp rcx, 7
  jbe .LBB0_8
  mov byte ptr [rip + called], 1
  mov esi, 1
  mov edx, 1
  mov rdi, rax
  call operator delete[](void*, unsigned long, std::align_val_t)@PLT
  lea rax, [rip + std::__2::move_only_function::__trivial_vtable_]
  cmp rax, 7
  jbe .LBB0_11
  lea rax, [rip + std::__2::move_only_function::__trivial_vtable_]
  cmp rax, 7
  jbe .LBB0_8
  pop rax
  ret
.LBB0_8:
  ud2
.LBB0_11:
  lea rdi, [rip + .L.str.2]
  lea rsi, [rip + .L.str.1]
  lea rcx, [rip + .L__PRETTY_FUNCTION__.test()]
  mov edx, 56
  call __assert_fail@PLT
  mov rdi, rax
  call __clang_call_terminate
  mov rdi, rax
  call __clang_call_terminate
test_return(): # @test_return()
  push rax
  lea rax, [rip + std::__2::move_only_function::__trivial_vtable_]
  cmp rax, 7
  jbe .LBB1_9
  lea rax, [rip + std::__2::move_only_function::__trivial_vtable_]
  cmp rax, 7
  jbe .LBB1_9
  mov byte ptr [rip + called], 0
  mov edi, 40
  mov esi, 1
  call operator new[](unsigned long, std::align_val_t)@PLT
  lea rcx, [rip + std::__2::move_only_function::__non_trivial_vtable_]
  cmp rcx, 7
  jbe .LBB1_9
  cmp byte ptr [rip + called], 1
  je .LBB1_11
  mov esi, 40
  mov edx, 1
  mov rdi, rax
  call operator delete[](void*, unsigned long, std::align_val_t)@PLT
  mov byte ptr [rip + called], 0
  mov edi, 1
  mov esi, 1
  call operator new[](unsigned long, std::align_val_t)@PLT
  lea rcx, [rip + std::__2::move_only_function::__non_trivial_vtable_]
  cmp rcx, 7
  jbe .LBB1_9
  cmp byte ptr [rip + called], 1
  je .LBB1_13
  mov esi, 1
  mov edx, 1
  mov rdi, rax
  pop rax
  jmp operator delete[](void*, unsigned long, std::align_val_t)@PLT # TAILCALL
.LBB1_9:
  ud2
.LBB1_11:
  lea rdi, [rip + .L.str.6]
  lea rsi, [rip + .L.str.1]
  lea rcx, [rip + .L__PRETTY_FUNCTION__.test_return()]
  mov edx, 89
  call __assert_fail@PLT
.LBB1_13:
  lea rdi, [rip + .L.str.6]
  lea rsi, [rip + .L.str.1]
  lea rcx, [rip + .L__PRETTY_FUNCTION__.test_return()]
  mov edx, 95
  call __assert_fail@PLT
  mov rdi, rax
  call __clang_call_terminate
  mov rdi, rax
  call __clang_call_terminate
main: # @main
  push rax
  call test_return()
  call test()
  xor eax, eax
  pop rcx
  ret
__clang_call_terminate: # @__clang_call_terminate
  push rax
  call __cxa_begin_catch@PLT
  call std::terminate()@PLT
std::__2::move_only_function::__trivial_vtable_::{lambda(std::__2::__small_buffer<24ul, 
8ul>&)#1}::__invoke(std::__2::__small_buffer<24ul, 8ul>&): # 
@std::__2::move_only_function::__trivial_vtable_::{lambda(std::__2::__small_buffer<24ul, 
8ul>&)#1}::__invoke(std::__2::__small_buffer<24ul, 8ul>&)
  jmp qword ptr [rdi] # TAILCALL
std::__2::move_only_function::__trivial_vtable_::{lambda(std::__2::__small_buffer<24ul,
 8ul>&)#1}::__invoke(std::__2::__small_buffer<24ul, 8ul>&): # 
@std::__2::move_only_function::__trivial_vtable_::{lambda(std::__2::__small_buffer<24ul,
 8ul>&)#1}::__invoke(std::__2::__small_buffer<24ul, 8ul>&)
  mov byte ptr [rip + called], 1
  ret
std::__2::move_only_function::__trivial_vtable_::{lambda(std::__2::__small_buffer<24ul,
 8ul>&)#1}::__invoke(std::__2::__small_buffer<24ul, 8ul>&): # 
@std::__2::move_only_function::__trivial_vtable_::{lambda(std::__2::__small_buffer<24ul,
 8ul>&)#1}::__invoke(std::__2::__small_buffer<24ul, 8ul>&)
  mov byte ptr [rip + called], 1
  ret
std::__2::move_only_function::__non_trivial_vtable_::{lambda(std::__2::__small_buffer<24ul,
 8ul>&)#1}::__invoke(std::__2::__small_buffer<24ul, 8ul>&): # 
@std::__2::move_only_function::__non_trivial_vtable_::{lambda(std::__2::__small_buffer<24ul,
 8ul>&)#1}::__invoke(std::__2::__small_buffer<24ul, 8ul>&)
  mov rdi, qword ptr [rdi]
  mov esi, 40
  mov edx, 1
  jmp operator

[llvm-branch-commits] [libcxx] [libc++] Implement std::move_only_function (P0288R9) (PR #94670)


https://github.com/EricWF requested changes to this pull request.

Please see the previous comment for the requested changes.

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


  1   2   3   4   5   6   7   8   9   10   >