[llvm-branch-commits] [llvm] release/19.x: [Inliner] Don't propagate access attr to byval params (#112256) (PR #112365)
https://github.com/nikic approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/112365 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [flang] [Flang] Split runtime headers in preparation for cross-compilation. NFC. (PR #112188)
@@ -0,0 +1,73 @@ +//===-- include/flang/Runtime/descriptor-consts.h ---*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===--===// + +#ifndef FORTRAN_RUNTIME_DESCRIPTOR_CONSTS_H_ +#define FORTRAN_RUNTIME_DESCRIPTOR_CONSTS_H_ + +#include "flang/Common/api-attrs.h" +#include "flang/ISO_Fortran_binding_wrapper.h" +#include +#include + +// Value of the addendum presence flag. +#define _CFI_ADDENDUM_FLAG 1 +// Number of bits needed to be shifted when manipulating the allocator index. +#define _CFI_ALLOCATOR_IDX_SHIFT 1 +// Allocator index mask. +#define _CFI_ALLOCATOR_IDX_MASK 0b1110 Meinersbur wrote: https://github.com/llvm/llvm-project/blob/70334081f75d67900c6ffa193c60c4d6f4767354/flang/lib/Optimizer/CodeGen/CodeGen.cpp#L1279 https://github.com/llvm/llvm-project/pull/112188 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [flang] [Flang] Split runtime headers in preparation for cross-compilation. NFC. (PR #112188)
https://github.com/Meinersbur edited https://github.com/llvm/llvm-project/pull/112188 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [flang] [llvm] [Flang] Move runtime library files to clang-rt. NFC (PR #110298)
https://github.com/Meinersbur edited https://github.com/llvm/llvm-project/pull/110298 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] [Serialization] Code cleanups and polish 83233 (PR #83237)
ilya-biryukov wrote: Sorry for loosing track of this, we'll run another round of tests and get back to you. https://github.com/llvm/llvm-project/pull/83237 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [mlir] de3695a - Revert "[MLIR][TableGen] Use const pointers for various `Init` objects (#112316)"
Author: Mehdi Amini Date: 2024-10-16T11:08:55+02:00 New Revision: de3695a393727344232af81765aaeb7f9dd33e18 URL: https://github.com/llvm/llvm-project/commit/de3695a393727344232af81765aaeb7f9dd33e18 DIFF: https://github.com/llvm/llvm-project/commit/de3695a393727344232af81765aaeb7f9dd33e18.diff LOG: Revert "[MLIR][TableGen] Use const pointers for various `Init` objects (#112316)" This reverts commit 1ae9fe5ea0c502195f0c857759e2277ba9c8b338. Added: Modified: mlir/include/mlir/TableGen/AttrOrTypeDef.h mlir/include/mlir/TableGen/Dialect.h mlir/include/mlir/TableGen/Operator.h mlir/lib/TableGen/AttrOrTypeDef.cpp mlir/lib/TableGen/Attribute.cpp mlir/lib/TableGen/Dialect.cpp mlir/lib/TableGen/Interfaces.cpp mlir/lib/TableGen/Operator.cpp mlir/lib/TableGen/Pattern.cpp mlir/lib/TableGen/Type.cpp mlir/lib/Tools/mlir-tblgen/MlirTblgenMain.cpp mlir/tools/mlir-tblgen/BytecodeDialectGen.cpp mlir/tools/mlir-tblgen/DialectGen.cpp mlir/tools/mlir-tblgen/OmpOpGen.cpp Removed: diff --git a/mlir/include/mlir/TableGen/AttrOrTypeDef.h b/mlir/include/mlir/TableGen/AttrOrTypeDef.h index c3d730e42ef70e8..36744c85bc70865 100644 --- a/mlir/include/mlir/TableGen/AttrOrTypeDef.h +++ b/mlir/include/mlir/TableGen/AttrOrTypeDef.h @@ -105,7 +105,7 @@ class AttrOrTypeParameter { std::optional getDefaultValue() const; /// Return the underlying def of this parameter. - const llvm::Init *getDef() const; + llvm::Init *getDef() const; /// The parameter is pointer-comparable. bool operator==(const AttrOrTypeParameter &other) const { diff --git a/mlir/include/mlir/TableGen/Dialect.h b/mlir/include/mlir/TableGen/Dialect.h index ea8f40555e4451b..3530d240c976c64 100644 --- a/mlir/include/mlir/TableGen/Dialect.h +++ b/mlir/include/mlir/TableGen/Dialect.h @@ -92,7 +92,7 @@ class Dialect { /// dialect. bool usePropertiesForAttributes() const; - const llvm::DagInit *getDiscardableAttributes() const; + llvm::DagInit *getDiscardableAttributes() const; const llvm::Record *getDef() const { return def; } diff --git a/mlir/include/mlir/TableGen/Operator.h b/mlir/include/mlir/TableGen/Operator.h index 9e570373d9cd327..768291a3a7267b2 100644 --- a/mlir/include/mlir/TableGen/Operator.h +++ b/mlir/include/mlir/TableGen/Operator.h @@ -119,15 +119,14 @@ class Operator { /// A utility iterator over a list of variable decorators. struct VariableDecoratorIterator - : public llvm::mapped_iterator { + : public llvm::mapped_iterator { /// Initializes the iterator to the specified iterator. -VariableDecoratorIterator(const llvm::Init *const *it) -: llvm::mapped_iterator( - it, &unwrap) {} -static VariableDecorator unwrap(const llvm::Init *init); +VariableDecoratorIterator(llvm::Init *const *it) +: llvm::mapped_iterator(it, + &unwrap) {} +static VariableDecorator unwrap(llvm::Init *init); }; using var_decorator_iterator = VariableDecoratorIterator; using var_decorator_range = llvm::iterator_range; diff --git a/mlir/lib/TableGen/AttrOrTypeDef.cpp b/mlir/lib/TableGen/AttrOrTypeDef.cpp index e72ca155bcf7654..9b9d9fd2317d992 100644 --- a/mlir/lib/TableGen/AttrOrTypeDef.cpp +++ b/mlir/lib/TableGen/AttrOrTypeDef.cpp @@ -40,7 +40,7 @@ AttrOrTypeDef::AttrOrTypeDef(const llvm::Record *def) : def(def) { auto *builderList = dyn_cast_or_null(def->getValueInit("builders")); if (builderList && !builderList->empty()) { -for (const llvm::Init *init : builderList->getValues()) { +for (llvm::Init *init : builderList->getValues()) { AttrOrTypeBuilder builder(cast(init)->getDef(), def->getLoc()); @@ -58,8 +58,8 @@ AttrOrTypeDef::AttrOrTypeDef(const llvm::Record *def) : def(def) { if (auto *traitList = def->getValueAsListInit("traits")) { SmallPtrSet traitSet; traits.reserve(traitSet.size()); -llvm::unique_function processTraitList = -[&](const llvm::ListInit *traitList) { +llvm::unique_function processTraitList = +[&](llvm::ListInit *traitList) { for (auto *traitInit : *traitList) { if (!traitSet.insert(traitInit).second) continue; @@ -335,9 +335,7 @@ std::optional AttrOrTypeParameter::getDefaultValue() const { return result && !result->empty() ? result : std::nullopt; } -const llvm::Init *AttrOrTypeParameter::getDef() const { - return def->getArg(index); -} +llvm::Init *AttrOrTypeParameter::getDef() const { return def->getArg(index); } std::optional AttrOrTypeParameter::getConstraint() const { if (auto *param = dyn_cast(getDef())) @@ -351,7 +349,7 @@ std::optional AttrOrTypeParameter::getConstraint() const { //===--===//
[llvm-branch-commits] [llvm] [CodeGen][NewPM] Port machine trace metrics analysis to new pass manager. (PR #108507)
cdevadas wrote: ### Merge activity * **Oct 16, 3:38 AM EDT**: A user started a stack merge that includes this pull request via [Graphite](https://app.graphite.dev/github/pr/llvm/llvm-project/108507). https://github.com/llvm/llvm-project/pull/108507 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [AMDGPU][NewPM] Fill out addILPOpts. (PR #108514)
cdevadas wrote: ### Merge activity * **Oct 16, 3:38 AM EDT**: A user started a stack merge that includes this pull request via [Graphite](https://app.graphite.dev/github/pr/llvm/llvm-project/108514). https://github.com/llvm/llvm-project/pull/108514 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [CodeGen][NewPM] Port EarlyIfConversion pass to NPM. (PR #108508)
cdevadas wrote: ### Merge activity * **Oct 16, 3:38 AM EDT**: A user started a stack merge that includes this pull request via [Graphite](https://app.graphite.dev/github/pr/llvm/llvm-project/108508). https://github.com/llvm/llvm-project/pull/108508 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] clang/HIP: Remove REQUIRES windows from a test (PR #112411)
https://github.com/arsenm updated https://github.com/llvm/llvm-project/pull/112411 >From ecb52547f59aae09e36f7f80a3171d7c1a2de16f Mon Sep 17 00:00:00 2001 From: Matt Arsenault Date: Tue, 15 Oct 2024 22:01:28 +0400 Subject: [PATCH 1/2] clang/HIP: Remove REQUIRES windows from a test --- clang/test/Driver/hip-runtime-libs-msvc.hip | 2 -- 1 file changed, 2 deletions(-) diff --git a/clang/test/Driver/hip-runtime-libs-msvc.hip b/clang/test/Driver/hip-runtime-libs-msvc.hip index 8085e77d457e56..943cd0569f4fd1 100644 --- a/clang/test/Driver/hip-runtime-libs-msvc.hip +++ b/clang/test/Driver/hip-runtime-libs-msvc.hip @@ -1,5 +1,3 @@ -// REQUIRES: system-windows - // RUN: touch %t.o // Test HIP runtime lib args specified by --rocm-path. >From 29b0bcfbb016aac5cac4dbd75039299ca368d479 Mon Sep 17 00:00:00 2001 From: Matt Arsenault Date: Wed, 16 Oct 2024 16:01:54 +0400 Subject: [PATCH 2/2] Try to fix windows --- clang/test/Driver/hip-temps-linux.hip | 5 +++-- clang/test/Driver/linker-wrapper.c| 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/clang/test/Driver/hip-temps-linux.hip b/clang/test/Driver/hip-temps-linux.hip index c04121268bf697..12968ebdd024c7 100644 --- a/clang/test/Driver/hip-temps-linux.hip +++ b/clang/test/Driver/hip-temps-linux.hip @@ -4,8 +4,9 @@ // Check no temporary files or directores are left after compilation. // RUN: rm -rf %t%{fs-sep}mytmp // RUN: mkdir -p %t%{fs-sep}mytmp -// RUN: env TMPDIR="%t/mytmp" %clang --target=x86_64-linux-gnu -nogpulib -nogpuinc \ -// RUN: --rocm-path=%S/Inputs/rocm -nostdinc -nostdlib -c \ +// RUN: env TMPDIR="%t/mytmp" TMP="%t/mytmp" %clang --target=x86_64-linux-gnu \ +// RUN: -nogpulib -nogpuinc -nostdinc -nostdlib \ +// RUN: --rocm-path=%S/Inputs/rocm -c \ // RUN: --offload-arch=gfx1030 -emit-llvm -v %s 2>&1 | \ // RUN: FileCheck -DTMPDIR=%t%{fs-sep}mytmp%{fs-sep} %s // RUN: ls %t/mytmp >%t/mytmp.txt 2>&1 diff --git a/clang/test/Driver/linker-wrapper.c b/clang/test/Driver/linker-wrapper.c index 976f7c170fdd69..89492ee9574cb8 100644 --- a/clang/test/Driver/linker-wrapper.c +++ b/clang/test/Driver/linker-wrapper.c @@ -118,7 +118,7 @@ __attribute__((visibility("protected"), used)) int x; // HIP: clang{{.*}} -o [[IMG_GFX90A:.+]] --target=amdgcn-amd-amdhsa -mcpu=gfx90a // HIP: clang{{.*}} -o [[IMG_GFX908:.+]] --target=amdgcn-amd-amdhsa -mcpu=gfx908 -// HIP: clang-offload-bundler{{.*}}-type=o -bundle-align=4096 -compress -compression-level=6 -targets=host-x86_64-unknown-linux,hip-amdgcn-amd-amdhsa--gfx90a,hip-amdgcn-amd-amdhsa--gfx908 -input=/dev/null -input=[[IMG_GFX90A]] -input=[[IMG_GFX908]] -output={{.*}}.hipfb +// HIP: clang-offload-bundler{{.*}}-type=o -bundle-align=4096 -compress -compression-level=6 -targets=host-x86_64-unknown-linux,hip-amdgcn-amd-amdhsa--gfx90a,hip-amdgcn-amd-amdhsa--gfx908 -input={{/dev/null|NUL}} -input=[[IMG_GFX90A]] -input=[[IMG_GFX908]] -output={{.*}}.hipfb // RUN: clang-offload-packager -o %t.out \ // RUN: --image=file=%t.elf.o,kind=openmp,triple=amdgcn-amd-amdhsa,arch=gfx908 \ @@ -209,7 +209,7 @@ __attribute__((visibility("protected"), used)) int x; // RUN: %t.o -o a.out 2>&1 | FileCheck %s --check-prefix=RELOCATABLE-LINK-HIP // RELOCATABLE-LINK-HIP: clang{{.*}} -o {{.*}}.img --target=amdgcn-amd-amdhsa -// RELOCATABLE-LINK-HIP: clang-offload-bundler{{.*}} -type=o -bundle-align=4096 -targets=host-x86_64-unknown-linux,hip-amdgcn-amd-amdhsa--gfx90a -input=/dev/null -input={{.*}} -output={{.*}} +// RELOCATABLE-LINK-HIP: clang-offload-bundler{{.*}} -type=o -bundle-align=4096 -targets=host-x86_64-unknown-linux,hip-amdgcn-amd-amdhsa--gfx90a -input={{/dev/null|NUL}} -input={{.*}} -output={{.*}} // RELOCATABLE-LINK-HIP: /usr/bin/ld.lld{{.*}}-r // RELOCATABLE-LINK-HIP: llvm-objcopy{{.*}}a.out --remove-section .llvm.offloading ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] clang/HIP: Remove REQUIRES libgcc from a test (PR #112412)
https://github.com/arsenm updated https://github.com/llvm/llvm-project/pull/112412 >From 5c35d9bb7ff982d4e0f99fd77550e8d615ec5d1f Mon Sep 17 00:00:00 2001 From: Matt Arsenault Date: Tue, 15 Oct 2024 22:02:18 +0400 Subject: [PATCH] clang/HIP: Remove REQUIRES libgcc from a test --- clang/test/Driver/hip-include-path.hip | 1 - 1 file changed, 1 deletion(-) diff --git a/clang/test/Driver/hip-include-path.hip b/clang/test/Driver/hip-include-path.hip index 1b4179e65c0b97..52f5ce0d5b 100644 --- a/clang/test/Driver/hip-include-path.hip +++ b/clang/test/Driver/hip-include-path.hip @@ -1,4 +1,3 @@ -// REQUIRES: libgcc // UNSUPPORTED: system-windows // RUN: %clang -c -### --target=x86_64-unknown-linux-gnu --cuda-gpu-arch=gfx900 \ ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [flang] [Flang] Split runtime headers in preparation for cross-compilation. NFC. (PR #112188)
klausler wrote: On what targets would the size or member byte offsets in a descriptor differ? https://github.com/llvm/llvm-project/pull/112188 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [flang] [Flang] Split runtime headers in preparation for cross-compilation. NFC. (PR #112188)
https://github.com/Meinersbur updated https://github.com/llvm/llvm-project/pull/112188 >From 42e5abb5b291e78aeb152d7c636c75fe4d90492a Mon Sep 17 00:00:00 2001 From: Michael Kruse Date: Mon, 14 Oct 2024 13:55:16 +0200 Subject: [PATCH 1/3] Split headers in preparation for cross-compilation. NFC. --- flang/include/flang/Lower/Allocatable.h | 2 +- .../flang/Optimizer/Builder/MutableBox.h | 2 +- .../flang/Optimizer/CodeGen/DescriptorModel.h | 2 +- flang/include/flang/Runtime/CUDA/allocator.h | 2 +- flang/include/flang/Runtime/CUDA/descriptor.h | 2 +- .../flang/Runtime/allocator-registry-consts.h | 20 + .../flang/Runtime/allocator-registry.h| 9 +-- .../flang/Runtime/array-constructor-consts.h | 54 + .../include/flang/Runtime/array-constructor.h | 80 +++ .../include/flang/Runtime/descriptor-consts.h | 72 + flang/include/flang/Runtime/descriptor.h | 15 +--- flang/include/flang/Runtime/io-api-funcs.h| 39 + flang/include/flang/Runtime/io-api.h | 3 - flang/include/flang/Runtime/iostat-funcs.h| 23 ++ flang/include/flang/Runtime/iostat.h | 2 - flang/lib/Lower/ConvertVariable.cpp | 2 +- .../Builder/Runtime/ArrayConstructor.cpp | 6 +- flang/lib/Optimizer/CodeGen/CodeGen.cpp | 18 ++--- flang/lib/Semantics/compute-offsets.cpp | 8 +- flang/runtime/environment-default-list.h | 0 flang/runtime/extensions.cpp | 2 +- flang/runtime/internal-unit.cpp | 2 + flang/runtime/io-api-common.h | 2 +- flang/runtime/io-api-minimal.cpp | 2 +- flang/runtime/io-api.cpp | 2 +- flang/runtime/io-error.h | 2 +- flang/runtime/io-stmt.h | 2 +- flang/runtime/iostat.cpp | 2 +- flang/runtime/namelist.cpp| 2 +- .../Builder/Runtime/AllocatableTest.cpp | 2 +- 30 files changed, 254 insertions(+), 127 deletions(-) create mode 100644 flang/include/flang/Runtime/allocator-registry-consts.h create mode 100644 flang/include/flang/Runtime/array-constructor-consts.h create mode 100644 flang/include/flang/Runtime/descriptor-consts.h create mode 100644 flang/include/flang/Runtime/io-api-funcs.h create mode 100644 flang/include/flang/Runtime/iostat-funcs.h mode change 100755 => 100644 flang/runtime/environment-default-list.h diff --git a/flang/include/flang/Lower/Allocatable.h b/flang/include/flang/Lower/Allocatable.h index 1209b157ed1f41..0e89af94af40f6 100644 --- a/flang/include/flang/Lower/Allocatable.h +++ b/flang/include/flang/Lower/Allocatable.h @@ -15,7 +15,7 @@ #include "flang/Lower/AbstractConverter.h" #include "flang/Optimizer/Builder/MutableBox.h" -#include "flang/Runtime/allocator-registry.h" +#include "flang/Runtime/allocator-registry-consts.h" #include "llvm/ADT/StringRef.h" namespace mlir { diff --git a/flang/include/flang/Optimizer/Builder/MutableBox.h b/flang/include/flang/Optimizer/Builder/MutableBox.h index fea7c7204837b4..39657ddaf6e03a 100644 --- a/flang/include/flang/Optimizer/Builder/MutableBox.h +++ b/flang/include/flang/Optimizer/Builder/MutableBox.h @@ -14,7 +14,7 @@ #define FORTRAN_OPTIMIZER_BUILDER_MUTABLEBOX_H #include "flang/Optimizer/Builder/BoxValue.h" -#include "flang/Runtime/allocator-registry.h" +#include "flang/Runtime/allocator-registry-consts.h" #include "llvm/ADT/StringRef.h" namespace mlir { diff --git a/flang/include/flang/Optimizer/CodeGen/DescriptorModel.h b/flang/include/flang/Optimizer/CodeGen/DescriptorModel.h index ff0cf29e8073e6..9cccf8db87270e 100644 --- a/flang/include/flang/Optimizer/CodeGen/DescriptorModel.h +++ b/flang/include/flang/Optimizer/CodeGen/DescriptorModel.h @@ -23,7 +23,7 @@ #define OPTIMIZER_DESCRIPTOR_MODEL_H #include "flang/ISO_Fortran_binding_wrapper.h" -#include "flang/Runtime/descriptor.h" +#include "flang/Runtime/descriptor-consts.h" #include "mlir/Dialect/LLVMIR/LLVMTypes.h" #include "mlir/IR/BuiltinTypes.h" #include "llvm/Support/ErrorHandling.h" diff --git a/flang/include/flang/Runtime/CUDA/allocator.h b/flang/include/flang/Runtime/CUDA/allocator.h index 4527c9f18fa054..cc88896b1f0bd6 100644 --- a/flang/include/flang/Runtime/CUDA/allocator.h +++ b/flang/include/flang/Runtime/CUDA/allocator.h @@ -9,7 +9,7 @@ #ifndef FORTRAN_RUNTIME_CUDA_ALLOCATOR_H_ #define FORTRAN_RUNTIME_CUDA_ALLOCATOR_H_ -#include "flang/Runtime/descriptor.h" +#include "flang/Runtime/descriptor-consts.h" #include "flang/Runtime/entry-names.h" #define CUDA_REPORT_IF_ERROR(expr) \ diff --git a/flang/include/flang/Runtime/CUDA/descriptor.h b/flang/include/flang/Runtime/CUDA/descriptor.h index d593989420420f..501a834f43bd42 100644 --- a/flang/include/flang/Runtime/CUDA/descriptor.h +++ b/flang/include/flang/Runtime/CUDA/descriptor.h @@ -9,7 +9,7 @@ #ifndef FORTRAN_RUNTIME_CUDA_DESCRIPTOR_H_ #define FORTRAN_RUNTIME_CUD
[llvm-branch-commits] [flang] [Flang] Split runtime headers in preparation for cross-compilation. NFC. (PR #112188)
@@ -42,77 +43,14 @@ struct ArrayConstructorVector { private: unsigned char useValueLengthParameters_ : 1; }; +static_assert(sizeof(Fortran::runtime::ArrayConstructorVector) <= +MaxArrayConstructorVectorSizeInBytes, +"ABI requires sizeof(ArrayConstructorVector) to be smaller than " +"MaxArrayConstructorVectorSizeInBytes"); +static_assert(alignof(Fortran::runtime::ArrayConstructorVector) <= +MaxArrayConstructorVectorAlignInBytes, +"ABI requires alignof(ArrayConstructorVector) to be smaller than " +"MaxArrayConstructorVectorAlignInBytes"); -// This file defines an API to "push" an evaluated array constructor value -// "from" into some storage "to" of an array constructor. It can be seen as a -// form of std::vector::push_back() implementation for Fortran array -// constructors. In the APIs and ArrayConstructorVector struct above: -// -// - "to" is a ranked-1 descriptor whose declared type is already set to the -// array constructor derived type. It may be already allocated, even before the -// first call to this API, or it may be unallocated. "to" extent is increased -// every time a "from" is pushed past its current extent. At this end of the -// API calls, its extent is the extent of the array constructor. If "to" is -// unallocated and its extent is not null, it is assumed this is the final array -// constructor extent value, and the first allocation already "reserves" storage -// space accordingly to avoid reallocations. -// - "from" is a scalar or array descriptor for the evaluated array -// constructor value that must be copied into the storage of "to" at -// "nextValuePosition". -// - "useValueLengthParameters" must be set to true if the array constructor -// has length parameters and no type spec. If it is true and "to" is -// unallocated, "to" will take the length parameters of "from". If it is true -// and "to" is an allocated character array constructor, it will be checked -// that "from" length matches the one from "to". When it is false, the -// character length must already be set in "to" before the first call to this -// API and "from" character lengths are allowed to mismatch from "to". -// - "nextValuePosition" is the zero based sequence position of "from" in the -// array constructor. It is updated after this call by the number of "from" -// elements. It should be set to zero by the caller of this API before the first -// call. -// - "actualAllocationSize" is the current allocation size of "to" storage. It -// may be bigger than "to" extent for reallocation optimization purposes, but -// should never be smaller, unless this is the first call and "to" is -// unallocated. It is updated by the runtime after each successful allocation or -// reallocation. It should be set to "to" extent if "to" is allocated before the -// first call of this API, and can be left undefined otherwise. -// -// Note that this API can be used with "to" being a variable (that can be -// discontiguous). This can be done when the variable is the left hand side of -// an assignment from an array constructor as long as: -// - none of the ac-value overlaps with the variable, -// - this is an intrinsic assignment that is not a whole allocatable -// assignment, *and* for a type that has no components requiring user defined -// assignments, -// - the variable is properly finalized before using this API if its need to, -// - "useValueLengthParameters" should be set to false in this case, even if -// the array constructor has no type-spec, since the variable may have a -// different character length than the array constructor values. Meinersbur wrote: The removal was unintentional, possibly happened because it is just between the definitions split between the headers. I restored it into `array-constructor-consts.h` containing the runtime function API definitions shared between Flang and Flang-RT. Thanks for noticing. https://github.com/llvm/llvm-project/pull/112188 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [flang] [Flang] Split runtime headers in preparation for cross-compilation. NFC. (PR #112188)
@@ -29,8 +29,8 @@ mlir::Value fir::runtime::genInitArrayConstructorVector( // the target. The "cookieSize" argument is used to validate this wild // assumption until runtime interfaces are improved. jeanPerier wrote: It seems like you can get rid of the cookieSize argument and comments since the validations are done via the added static_assert inside the runtime (which seems better, thanks). https://github.com/llvm/llvm-project/pull/112188 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [flang] [Flang] Split runtime headers in preparation for cross-compilation. NFC. (PR #112188)
@@ -42,77 +43,14 @@ struct ArrayConstructorVector { private: unsigned char useValueLengthParameters_ : 1; }; +static_assert(sizeof(Fortran::runtime::ArrayConstructorVector) <= +MaxArrayConstructorVectorSizeInBytes, +"ABI requires sizeof(ArrayConstructorVector) to be smaller than " +"MaxArrayConstructorVectorSizeInBytes"); +static_assert(alignof(Fortran::runtime::ArrayConstructorVector) <= +MaxArrayConstructorVectorAlignInBytes, +"ABI requires alignof(ArrayConstructorVector) to be smaller than " +"MaxArrayConstructorVectorAlignInBytes"); -// This file defines an API to "push" an evaluated array constructor value -// "from" into some storage "to" of an array constructor. It can be seen as a -// form of std::vector::push_back() implementation for Fortran array -// constructors. In the APIs and ArrayConstructorVector struct above: -// -// - "to" is a ranked-1 descriptor whose declared type is already set to the -// array constructor derived type. It may be already allocated, even before the -// first call to this API, or it may be unallocated. "to" extent is increased -// every time a "from" is pushed past its current extent. At this end of the -// API calls, its extent is the extent of the array constructor. If "to" is -// unallocated and its extent is not null, it is assumed this is the final array -// constructor extent value, and the first allocation already "reserves" storage -// space accordingly to avoid reallocations. -// - "from" is a scalar or array descriptor for the evaluated array -// constructor value that must be copied into the storage of "to" at -// "nextValuePosition". -// - "useValueLengthParameters" must be set to true if the array constructor -// has length parameters and no type spec. If it is true and "to" is -// unallocated, "to" will take the length parameters of "from". If it is true -// and "to" is an allocated character array constructor, it will be checked -// that "from" length matches the one from "to". When it is false, the -// character length must already be set in "to" before the first call to this -// API and "from" character lengths are allowed to mismatch from "to". -// - "nextValuePosition" is the zero based sequence position of "from" in the -// array constructor. It is updated after this call by the number of "from" -// elements. It should be set to zero by the caller of this API before the first -// call. -// - "actualAllocationSize" is the current allocation size of "to" storage. It -// may be bigger than "to" extent for reallocation optimization purposes, but -// should never be smaller, unless this is the first call and "to" is -// unallocated. It is updated by the runtime after each successful allocation or -// reallocation. It should be set to "to" extent if "to" is allocated before the -// first call of this API, and can be left undefined otherwise. -// -// Note that this API can be used with "to" being a variable (that can be -// discontiguous). This can be done when the variable is the left hand side of -// an assignment from an array constructor as long as: -// - none of the ac-value overlaps with the variable, -// - this is an intrinsic assignment that is not a whole allocatable -// assignment, *and* for a type that has no components requiring user defined -// assignments, -// - the variable is properly finalized before using this API if its need to, -// - "useValueLengthParameters" should be set to false in this case, even if -// the array constructor has no type-spec, since the variable may have a -// different character length than the array constructor values. jeanPerier wrote: Please keep this documentation, this is a non trivial runtime where many things could happen differently, especially with Fortran entity with non trivial types. https://github.com/llvm/llvm-project/pull/112188 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] release/19.x: [NFC] fix build failure (#100993) (PR #112551)
mgorny wrote: CC @chenzheng1030 @aaronpuchert https://github.com/llvm/llvm-project/pull/112551 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] release/19.x: [NFC] fix build failure (#100993) (PR #112551)
llvmbot wrote: @arsenm What do you think about merging this PR to the release branch? https://github.com/llvm/llvm-project/pull/112551 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] release/19.x: [NFC] fix build failure (#100993) (PR #112551)
https://github.com/llvmbot milestoned https://github.com/llvm/llvm-project/pull/112551 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] release/19.x: [NFC] fix build failure (#100993) (PR #112551)
https://github.com/llvmbot created https://github.com/llvm/llvm-project/pull/112551 Backport 40b4fd7a3e81d32b29364a1b15337bcf817659c0 Requested by: @mgorny >From f20d1951e2c1d7636f8d8806354cd2a26fd829c4 Mon Sep 17 00:00:00 2001 From: Chen Zheng Date: Tue, 30 Jul 2024 09:02:07 +0800 Subject: [PATCH] [NFC] fix build failure (#100993) Fix the build failure caused by https://github.com/llvm/llvm-project/pull/94944 Fixes https://github.com/llvm/llvm-project/issues/100296 (cherry picked from commit 40b4fd7a3e81d32b29364a1b15337bcf817659c0) --- llvm/lib/Analysis/ConstantFolding.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/llvm/lib/Analysis/ConstantFolding.cpp b/llvm/lib/Analysis/ConstantFolding.cpp index df75745645e049..ff30fece5fce93 100644 --- a/llvm/lib/Analysis/ConstantFolding.cpp +++ b/llvm/lib/Analysis/ConstantFolding.cpp @@ -1784,8 +1784,8 @@ Constant *ConstantFoldFP(double (*NativeFP)(double), const APFloat &V, } #if defined(HAS_IEE754_FLOAT128) && defined(HAS_LOGF128) -Constant *ConstantFoldFP128(long double (*NativeFP)(long double), -const APFloat &V, Type *Ty) { +Constant *ConstantFoldFP128(float128 (*NativeFP)(float128), const APFloat &V, +Type *Ty) { llvm_fenv_clearexcept(); float128 Result = NativeFP(V.convertToQuad()); if (llvm_fenv_testexcept()) { ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] release/19.x: [NFC] fix build failure (#100993) (PR #112551)
https://github.com/arsenm commented: I'm assuming this isn't an ABI break in any cases where this builds? https://github.com/llvm/llvm-project/pull/112551 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] release/19.x: [NFC] fix build failure (#100993) (PR #112551)
llvmbot wrote: @llvm/pr-subscribers-llvm-analysis Author: None (llvmbot) Changes Backport 40b4fd7a3e81d32b29364a1b15337bcf817659c0 Requested by: @mgorny --- Full diff: https://github.com/llvm/llvm-project/pull/112551.diff 1 Files Affected: - (modified) llvm/lib/Analysis/ConstantFolding.cpp (+2-2) ``diff diff --git a/llvm/lib/Analysis/ConstantFolding.cpp b/llvm/lib/Analysis/ConstantFolding.cpp index df75745645e049..ff30fece5fce93 100644 --- a/llvm/lib/Analysis/ConstantFolding.cpp +++ b/llvm/lib/Analysis/ConstantFolding.cpp @@ -1784,8 +1784,8 @@ Constant *ConstantFoldFP(double (*NativeFP)(double), const APFloat &V, } #if defined(HAS_IEE754_FLOAT128) && defined(HAS_LOGF128) -Constant *ConstantFoldFP128(long double (*NativeFP)(long double), -const APFloat &V, Type *Ty) { +Constant *ConstantFoldFP128(float128 (*NativeFP)(float128), const APFloat &V, +Type *Ty) { llvm_fenv_clearexcept(); float128 Result = NativeFP(V.convertToQuad()); if (llvm_fenv_testexcept()) { `` https://github.com/llvm/llvm-project/pull/112551 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [flang] [Flang] Split runtime headers in preparation for cross-compilation. NFC. (PR #112188)
@@ -0,0 +1,73 @@ +//===-- include/flang/Runtime/descriptor-consts.h ---*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===--===// + +#ifndef FORTRAN_RUNTIME_DESCRIPTOR_CONSTS_H_ +#define FORTRAN_RUNTIME_DESCRIPTOR_CONSTS_H_ + +#include "flang/Common/api-attrs.h" +#include "flang/ISO_Fortran_binding_wrapper.h" +#include +#include + +// Value of the addendum presence flag. +#define _CFI_ADDENDUM_FLAG 1 +// Number of bits needed to be shifted when manipulating the allocator index. +#define _CFI_ALLOCATOR_IDX_SHIFT 1 +// Allocator index mask. +#define _CFI_ALLOCATOR_IDX_MASK 0b1110 clementval wrote: My bad! I forgot about this one :-) https://github.com/llvm/llvm-project/pull/112188 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [flang] [llvm] [Flang] Move runtime library files to clang-rt. NFC (PR #110298)
@@ -1,13 +1,13 @@ -//===-- include/flang/Runtime/CUDA/allocator.h --*- C++ -*-===// +//===-- include/flang-rt/CufRuntime/allocator.h -*- C++ -*-===// clementval wrote: I would prefer to keep CUDA here rather than CufRuntime. https://github.com/llvm/llvm-project/pull/110298 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [flang] [llvm] [Flang] Move runtime library files to clang-rt. NFC (PR #110298)
@@ -1,4 +1,4 @@ -//===-- include/FortranRuntime/Runtime/array-constructor.h --*- C++ -*-===// +//===-- include/flang-rt/flang_rt/array-constructor.h ---*- C++ -*-===// clementval wrote: Why do we need this double directory with similar names. Can the header just be in `include/flang-rt` and the CUF one in a subdirectory like before? https://github.com/llvm/llvm-project/pull/110298 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] [Serialization] Code cleanups and polish 83233 (PR #83237)
ilya-biryukov wrote: There were some merge conflicts with main, I've managed to resolve them to this: https://github.com/ilya-biryukov/llvm-project/tree/pr83237_merged I am now trying to bootstrap the compiler with that version, but it would be useful if someone rebased this PR against main, in case I've made mistakes during the merging process and the bootstrap/testing will fail because of this. https://github.com/llvm/llvm-project/pull/83237 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [lld] Backport "[ELF] Make shouldAddProvideSym return values consistent when demoted to Undefined" (PR #112136)
https://github.com/DianQK closed https://github.com/llvm/llvm-project/pull/112136 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [lld] Backport "[ELF] Make shouldAddProvideSym return values consistent when demoted to Undefined" (PR #112136)
https://github.com/DianQK demilestoned https://github.com/llvm/llvm-project/pull/112136 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] clang/HIP: Remove REQUIRES windows from a test (PR #112411)
https://github.com/arsenm updated https://github.com/llvm/llvm-project/pull/112411 >From ecb52547f59aae09e36f7f80a3171d7c1a2de16f Mon Sep 17 00:00:00 2001 From: Matt Arsenault Date: Tue, 15 Oct 2024 22:01:28 +0400 Subject: [PATCH 1/3] clang/HIP: Remove REQUIRES windows from a test --- clang/test/Driver/hip-runtime-libs-msvc.hip | 2 -- 1 file changed, 2 deletions(-) diff --git a/clang/test/Driver/hip-runtime-libs-msvc.hip b/clang/test/Driver/hip-runtime-libs-msvc.hip index 8085e77d457e56..943cd0569f4fd1 100644 --- a/clang/test/Driver/hip-runtime-libs-msvc.hip +++ b/clang/test/Driver/hip-runtime-libs-msvc.hip @@ -1,5 +1,3 @@ -// REQUIRES: system-windows - // RUN: touch %t.o // Test HIP runtime lib args specified by --rocm-path. >From 29b0bcfbb016aac5cac4dbd75039299ca368d479 Mon Sep 17 00:00:00 2001 From: Matt Arsenault Date: Wed, 16 Oct 2024 16:01:54 +0400 Subject: [PATCH 2/3] Try to fix windows --- clang/test/Driver/hip-temps-linux.hip | 5 +++-- clang/test/Driver/linker-wrapper.c| 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/clang/test/Driver/hip-temps-linux.hip b/clang/test/Driver/hip-temps-linux.hip index c04121268bf697..12968ebdd024c7 100644 --- a/clang/test/Driver/hip-temps-linux.hip +++ b/clang/test/Driver/hip-temps-linux.hip @@ -4,8 +4,9 @@ // Check no temporary files or directores are left after compilation. // RUN: rm -rf %t%{fs-sep}mytmp // RUN: mkdir -p %t%{fs-sep}mytmp -// RUN: env TMPDIR="%t/mytmp" %clang --target=x86_64-linux-gnu -nogpulib -nogpuinc \ -// RUN: --rocm-path=%S/Inputs/rocm -nostdinc -nostdlib -c \ +// RUN: env TMPDIR="%t/mytmp" TMP="%t/mytmp" %clang --target=x86_64-linux-gnu \ +// RUN: -nogpulib -nogpuinc -nostdinc -nostdlib \ +// RUN: --rocm-path=%S/Inputs/rocm -c \ // RUN: --offload-arch=gfx1030 -emit-llvm -v %s 2>&1 | \ // RUN: FileCheck -DTMPDIR=%t%{fs-sep}mytmp%{fs-sep} %s // RUN: ls %t/mytmp >%t/mytmp.txt 2>&1 diff --git a/clang/test/Driver/linker-wrapper.c b/clang/test/Driver/linker-wrapper.c index 976f7c170fdd69..89492ee9574cb8 100644 --- a/clang/test/Driver/linker-wrapper.c +++ b/clang/test/Driver/linker-wrapper.c @@ -118,7 +118,7 @@ __attribute__((visibility("protected"), used)) int x; // HIP: clang{{.*}} -o [[IMG_GFX90A:.+]] --target=amdgcn-amd-amdhsa -mcpu=gfx90a // HIP: clang{{.*}} -o [[IMG_GFX908:.+]] --target=amdgcn-amd-amdhsa -mcpu=gfx908 -// HIP: clang-offload-bundler{{.*}}-type=o -bundle-align=4096 -compress -compression-level=6 -targets=host-x86_64-unknown-linux,hip-amdgcn-amd-amdhsa--gfx90a,hip-amdgcn-amd-amdhsa--gfx908 -input=/dev/null -input=[[IMG_GFX90A]] -input=[[IMG_GFX908]] -output={{.*}}.hipfb +// HIP: clang-offload-bundler{{.*}}-type=o -bundle-align=4096 -compress -compression-level=6 -targets=host-x86_64-unknown-linux,hip-amdgcn-amd-amdhsa--gfx90a,hip-amdgcn-amd-amdhsa--gfx908 -input={{/dev/null|NUL}} -input=[[IMG_GFX90A]] -input=[[IMG_GFX908]] -output={{.*}}.hipfb // RUN: clang-offload-packager -o %t.out \ // RUN: --image=file=%t.elf.o,kind=openmp,triple=amdgcn-amd-amdhsa,arch=gfx908 \ @@ -209,7 +209,7 @@ __attribute__((visibility("protected"), used)) int x; // RUN: %t.o -o a.out 2>&1 | FileCheck %s --check-prefix=RELOCATABLE-LINK-HIP // RELOCATABLE-LINK-HIP: clang{{.*}} -o {{.*}}.img --target=amdgcn-amd-amdhsa -// RELOCATABLE-LINK-HIP: clang-offload-bundler{{.*}} -type=o -bundle-align=4096 -targets=host-x86_64-unknown-linux,hip-amdgcn-amd-amdhsa--gfx90a -input=/dev/null -input={{.*}} -output={{.*}} +// RELOCATABLE-LINK-HIP: clang-offload-bundler{{.*}} -type=o -bundle-align=4096 -targets=host-x86_64-unknown-linux,hip-amdgcn-amd-amdhsa--gfx90a -input={{/dev/null|NUL}} -input={{.*}} -output={{.*}} // RELOCATABLE-LINK-HIP: /usr/bin/ld.lld{{.*}}-r // RELOCATABLE-LINK-HIP: llvm-objcopy{{.*}}a.out --remove-section .llvm.offloading >From 2bf91dd78a1ad955d27970fc78ed3b4bddf618f0 Mon Sep 17 00:00:00 2001 From: Matt Arsenault Date: Wed, 16 Oct 2024 17:47:51 +0400 Subject: [PATCH 3/3] Try to fix windows --- clang/test/Driver/hip-temps-linux.hip | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/clang/test/Driver/hip-temps-linux.hip b/clang/test/Driver/hip-temps-linux.hip index 12968ebdd024c7..387ea81e25fce0 100644 --- a/clang/test/Driver/hip-temps-linux.hip +++ b/clang/test/Driver/hip-temps-linux.hip @@ -1,10 +1,11 @@ // REQUIRES: x86-registered-target // REQUIRES: amdgpu-registered-target -// Check no temporary files or directores are left after compilation. +// Check no temporary files or directories are left after compilation. + // RUN: rm -rf %t%{fs-sep}mytmp // RUN: mkdir -p %t%{fs-sep}mytmp -// RUN: env TMPDIR="%t/mytmp" TMP="%t/mytmp" %clang --target=x86_64-linux-gnu \ +// RUN: env TMPDIR="%t/mytmp" TEMP="%t/mytmp" TMP="%t/mytmp" %clang --target=x86_64-linux-gnu \ // RUN: -nogpulib -nogpuinc -nostdinc -nostdlib \ // RUN: --rocm-path=%S/Inputs/rocm -c \ // RUN: --offload-arch=gfx1030 -emit-llvm -v %s 2>&1 | \
[llvm-branch-commits] [clang] clang/HIP: Remove REQUIRES libgcc from a test (PR #112412)
https://github.com/arsenm updated https://github.com/llvm/llvm-project/pull/112412 >From 6287e8fa3c0bf3589bd270ceee3a44c1b64255a1 Mon Sep 17 00:00:00 2001 From: Matt Arsenault Date: Tue, 15 Oct 2024 22:02:18 +0400 Subject: [PATCH] clang/HIP: Remove REQUIRES libgcc from a test --- clang/test/Driver/hip-include-path.hip | 1 - 1 file changed, 1 deletion(-) diff --git a/clang/test/Driver/hip-include-path.hip b/clang/test/Driver/hip-include-path.hip index 1b4179e65c0b97..52f5ce0d5b 100644 --- a/clang/test/Driver/hip-include-path.hip +++ b/clang/test/Driver/hip-include-path.hip @@ -1,4 +1,3 @@ -// REQUIRES: libgcc // UNSUPPORTED: system-windows // RUN: %clang -c -### --target=x86_64-unknown-linux-gnu --cuda-gpu-arch=gfx900 \ ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] [flang] [lld] [llvm] [Flang] LLVM_ENABLE_RUNTIMES=FortranRuntime (PR #110217)
@@ -11,8 +11,11 @@ using namespace Fortran::parser::literals; + klausler wrote: why are these new blank lines necessary? https://github.com/llvm/llvm-project/pull/110217 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [CGData][llvm-cgdata] Support for stable function map (PR #112664)
https://github.com/kyulee-com updated https://github.com/llvm/llvm-project/pull/112664 >From 3b73ee558d57434ee1f8447ac2509db371d95d8f Mon Sep 17 00:00:00 2001 From: Kyungwoo Lee Date: Mon, 9 Sep 2024 19:38:05 -0700 Subject: [PATCH] [CGData][llvm-cgdata] Support for stable function map This introduces a new cgdata format for stable function maps. The raw data is embedded in the __llvm_merge section during compile time. This data can be read and merged using the llvm-cgdata tool, into an indexed cgdata file. Consequently, the tool is now capable of handling either outlined hash trees, stable function maps, or both, as they are orthogonal. --- llvm/docs/CommandGuide/llvm-cgdata.rst| 16 ++-- llvm/include/llvm/CGData/CodeGenData.h| 24 +- llvm/include/llvm/CGData/CodeGenData.inc | 12 ++- llvm/include/llvm/CGData/CodeGenDataReader.h | 29 ++- llvm/include/llvm/CGData/CodeGenDataWriter.h | 17 +++- llvm/lib/CGData/CodeGenData.cpp | 30 --- llvm/lib/CGData/CodeGenDataReader.cpp | 63 +- llvm/lib/CGData/CodeGenDataWriter.cpp | 30 ++- llvm/test/tools/llvm-cgdata/empty.test| 8 +- llvm/test/tools/llvm-cgdata/error.test| 13 +-- .../merge-combined-funcmap-hashtree.test | 66 +++ .../llvm-cgdata/merge-funcmap-archive.test| 83 +++ .../llvm-cgdata/merge-funcmap-concat.test | 78 + .../llvm-cgdata/merge-funcmap-double.test | 79 ++ .../llvm-cgdata/merge-funcmap-single.test | 36 ...chive.test => merge-hashtree-archive.test} | 8 +- ...concat.test => merge-hashtree-concat.test} | 6 +- ...double.test => merge-hashtree-double.test} | 8 +- ...single.test => merge-hashtree-single.test} | 4 +- llvm/tools/llvm-cgdata/llvm-cgdata.cpp| 46 +++--- 20 files changed, 572 insertions(+), 84 deletions(-) create mode 100644 llvm/test/tools/llvm-cgdata/merge-combined-funcmap-hashtree.test create mode 100644 llvm/test/tools/llvm-cgdata/merge-funcmap-archive.test create mode 100644 llvm/test/tools/llvm-cgdata/merge-funcmap-concat.test create mode 100644 llvm/test/tools/llvm-cgdata/merge-funcmap-double.test create mode 100644 llvm/test/tools/llvm-cgdata/merge-funcmap-single.test rename llvm/test/tools/llvm-cgdata/{merge-archive.test => merge-hashtree-archive.test} (91%) rename llvm/test/tools/llvm-cgdata/{merge-concat.test => merge-hashtree-concat.test} (93%) rename llvm/test/tools/llvm-cgdata/{merge-double.test => merge-hashtree-double.test} (90%) rename llvm/test/tools/llvm-cgdata/{merge-single.test => merge-hashtree-single.test} (92%) diff --git a/llvm/docs/CommandGuide/llvm-cgdata.rst b/llvm/docs/CommandGuide/llvm-cgdata.rst index f592e1508844ee..0670decd087e39 100644 --- a/llvm/docs/CommandGuide/llvm-cgdata.rst +++ b/llvm/docs/CommandGuide/llvm-cgdata.rst @@ -11,15 +11,13 @@ SYNOPSIS DESCRIPTION --- -The :program:llvm-cgdata utility parses raw codegen data embedded -in compiled binary files and merges them into a single .cgdata file. -It can also inspect and manipulate .cgdata files. -Currently, the tool supports saving and restoring outlined hash trees, -enabling global function outlining across modules, allowing for more -efficient function outlining in subsequent compilations. -The design is extensible, allowing for the incorporation of additional -codegen summaries and optimization techniques, such as global function -merging, in the future. +The :program:llvm-cgdata utility parses raw codegen data embedded in compiled +binary files and merges them into a single .cgdata file. It can also inspect +and manipulate .cgdata files. Currently, the tool supports saving and restoring +outlined hash trees and stable function maps, allowing for more efficient +function outlining and function merging across modules in subsequent +compilations. The design is extensible, allowing for the incorporation of +additional codegen summaries and optimization techniques. COMMANDS diff --git a/llvm/include/llvm/CGData/CodeGenData.h b/llvm/include/llvm/CGData/CodeGenData.h index 53550beeae1f83..5d7c74725ccef1 100644 --- a/llvm/include/llvm/CGData/CodeGenData.h +++ b/llvm/include/llvm/CGData/CodeGenData.h @@ -19,6 +19,7 @@ #include "llvm/Bitcode/BitcodeReader.h" #include "llvm/CGData/OutlinedHashTree.h" #include "llvm/CGData/OutlinedHashTreeRecord.h" +#include "llvm/CGData/StableFunctionMapRecord.h" #include "llvm/IR/Module.h" #include "llvm/Object/ObjectFile.h" #include "llvm/Support/Caching.h" @@ -41,7 +42,9 @@ enum class CGDataKind { Unknown = 0x0, // A function outlining info. FunctionOutlinedHashTree = 0x1, - LLVM_MARK_AS_BITMASK_ENUM(/*LargestValue=*/FunctionOutlinedHashTree) + // A function merging info. + StableFunctionMergingMap = 0x2, + LLVM_MARK_AS_BITMASK_ENUM(/*LargestValue=*/StableFunctionMergingMap) }; const std::error_category &cgdata_category(); @@ -108,6 +111,8
[llvm-branch-commits] [nfc][lsan] Extract significant part of the loop into a function (PR #112610)
https://github.com/vitalybuka updated https://github.com/llvm/llvm-project/pull/112610 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [nfc][lsan] Extract significant part of the loop into a function (PR #112610)
https://github.com/vitalybuka updated https://github.com/llvm/llvm-project/pull/112610 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [sanitizer] Add TryMemCpy (PR #112668)
https://github.com/vitalybuka created https://github.com/llvm/llvm-project/pull/112668 For posix implementation is similar to `IsAccessibleMemoryRange`, using `pipe`. We need this because we can't rely on non-atomic `IsAccessibleMemoryRange` + `memcpy`, as the protection or mapping may change and we may crash. ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [sanitizer] Add TryMemCpy (PR #112668)
llvmbot wrote: @llvm/pr-subscribers-compiler-rt-sanitizer Author: Vitaly Buka (vitalybuka) Changes For posix implementation is similar to `IsAccessibleMemoryRange`, using `pipe`. We need this because we can't rely on non-atomic `IsAccessibleMemoryRange` + `memcpy`, as the protection or mapping may change and we may crash. --- Full diff: https://github.com/llvm/llvm-project/pull/112668.diff 5 Files Affected: - (modified) compiler-rt/lib/sanitizer_common/sanitizer_common.h (+4) - (modified) compiler-rt/lib/sanitizer_common/sanitizer_fuchsia.cpp (+5) - (modified) compiler-rt/lib/sanitizer_common/sanitizer_posix_libcdep.cpp (+38) - (modified) compiler-rt/lib/sanitizer_common/sanitizer_win.cpp (+5) - (modified) compiler-rt/lib/sanitizer_common/tests/sanitizer_posix_test.cpp (+41-4) ``diff diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_common.h b/compiler-rt/lib/sanitizer_common/sanitizer_common.h index 082d2158e579bd..9b1e58f5e7a61d 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_common.h +++ b/compiler-rt/lib/sanitizer_common/sanitizer_common.h @@ -268,7 +268,11 @@ class ScopedErrorReportLock { extern uptr stoptheworld_tracer_pid; extern uptr stoptheworld_tracer_ppid; +// Returns true if we can read a memory range. bool IsAccessibleMemoryRange(uptr beg, uptr size); +// Returns true if we can read a memory range starting at `src`, and copies +// content into `dest`. +bool TryMemCpy(void *dest, const void *src, uptr n); // Error report formatting. const char *StripPathPrefix(const char *filepath, diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_fuchsia.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_fuchsia.cpp index 75dcf546729f6e..c2ace46c946587 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_fuchsia.cpp +++ b/compiler-rt/lib/sanitizer_common/sanitizer_fuchsia.cpp @@ -444,6 +444,11 @@ bool IsAccessibleMemoryRange(uptr beg, uptr size) { return status == ZX_OK; } +bool TryMemCpy(void *dest, const void *src, uptr n) { + // TODO: implement. + return false; +} + // FIXME implement on this platform. void GetMemoryProfile(fill_profile_f cb, uptr *stats) {} diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_posix_libcdep.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_posix_libcdep.cpp index f87af4bb3a5a6a..80b36efc3ef627 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_posix_libcdep.cpp +++ b/compiler-rt/lib/sanitizer_common/sanitizer_posix_libcdep.cpp @@ -325,6 +325,44 @@ bool IsAccessibleMemoryRange(uptr beg, uptr size) { return true; } +bool TryMemCpy(void *dest, const void *src, uptr n) { + int sock_pair[2]; + if (pipe(sock_pair)) +return false; + + auto cleanup = at_scope_exit([&]() { +internal_close(sock_pair[0]); +internal_close(sock_pair[1]); + }); + + SetNonBlock(sock_pair[0]); + SetNonBlock(sock_pair[1]); + + char *d = static_cast(dest); + const char *s = static_cast(src); + + while (n) { +int e; +uptr w = internal_write(sock_pair[1], s, n); +if (internal_iserror(w, &e)) { + CHECK_EQ(EFAULT, e); + return false; +} +s += w; +n -= w; + +while (w) { + uptr r = internal_read(sock_pair[0], d, w); + CHECK(!internal_iserror(r, &e)); + + d += r; + w -= r; +} + } + + return true; +} + void PlatformPrepareForSandboxing(void *args) { // Some kinds of sandboxes may forbid filesystem access, so we won't be able // to read the file mappings from /proc/self/maps. Luckily, neither the diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_win.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_win.cpp index 6fb947aa6d6c26..ea513d5f263fe2 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_win.cpp +++ b/compiler-rt/lib/sanitizer_common/sanitizer_win.cpp @@ -968,6 +968,11 @@ bool IsAccessibleMemoryRange(uptr beg, uptr size) { return true; } +bool TryMemCpy(void *dest, const void *src, uptr n) { + // TODO: implement. + return false; +} + bool SignalContext::IsStackOverflow() const { return (DWORD)GetType() == EXCEPTION_STACK_OVERFLOW; } diff --git a/compiler-rt/lib/sanitizer_common/tests/sanitizer_posix_test.cpp b/compiler-rt/lib/sanitizer_common/tests/sanitizer_posix_test.cpp index 9feb1f005e..d641567d2b5964 100644 --- a/compiler-rt/lib/sanitizer_common/tests/sanitizer_posix_test.cpp +++ b/compiler-rt/lib/sanitizer_common/tests/sanitizer_posix_test.cpp @@ -13,11 +13,14 @@ #include "sanitizer_common/sanitizer_platform.h" #if SANITIZER_POSIX -#include "sanitizer_common/sanitizer_common.h" -#include "gtest/gtest.h" +# include +# include -#include -#include +# include + +# include "gmock/gmock.h" +# include "gtest/gtest.h" +# include "sanitizer_common/sanitizer_common.h" namespace __sanitizer { @@ -93,6 +96,40 @@ TEST(SanitizerCommon, IsAccessibleMemoryRangeLarge) { munmap((void *)mem, size); } +TEST(SanitizerCommon, TryMemCpy) { + std::vector src(1000); + std::iota(src.begin(),
[llvm-branch-commits] [llvm] [AMDGPU] Still set up the two SGPRs for queue ptr even it is COV5 (PR #112403)
arsenm wrote: > The only test failure is `CodeGen/AMDGPU/call-args-inreg.ll`. It crashes when > lowering function `test_call_external_void_func_a15i32_inreg`. > > https://github.com/llvm/llvm-project/blob/8d13e7b8c382499c1cf0c2a3184b483e760f266b/llvm/lib/Target/AMDGPU/SIFrameLowering.cpp#L905 Something is wrong with how inreg is interacting with special arguments at callsites. The special arguments shouldn't be changing the number of registers available for user arguments. https://github.com/llvm/llvm-project/pull/112403 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [CGData] Stable Function Map (PR #112662)
https://github.com/kyulee-com created https://github.com/llvm/llvm-project/pull/112662 These define the main data structures to represent stable functions and group similar functions in a function map. Serialization is supported in a binary or yaml form. >From e7272c3a0293a0b2972e893335d652cc1ea27ebc Mon Sep 17 00:00:00 2001 From: Kyungwoo Lee Date: Sat, 7 Sep 2024 22:48:17 -0700 Subject: [PATCH] [CGData] Stable Function Map These define the main data structures to represent stable functions and group similar functions in a function map. Serialization is supported in a binary or yaml form. --- llvm/include/llvm/CGData/StableFunctionMap.h | 139 .../llvm/CGData/StableFunctionMapRecord.h | 64 ++ llvm/lib/CGData/CMakeLists.txt| 2 + llvm/lib/CGData/StableFunctionMap.cpp | 167 +++ llvm/lib/CGData/StableFunctionMapRecord.cpp | 197 ++ llvm/unittests/CGData/CMakeLists.txt | 2 + .../CGData/StableFunctionMapRecordTest.cpp| 131 .../CGData/StableFunctionMapTest.cpp | 146 + 8 files changed, 848 insertions(+) create mode 100644 llvm/include/llvm/CGData/StableFunctionMap.h create mode 100644 llvm/include/llvm/CGData/StableFunctionMapRecord.h create mode 100644 llvm/lib/CGData/StableFunctionMap.cpp create mode 100644 llvm/lib/CGData/StableFunctionMapRecord.cpp create mode 100644 llvm/unittests/CGData/StableFunctionMapRecordTest.cpp create mode 100644 llvm/unittests/CGData/StableFunctionMapTest.cpp diff --git a/llvm/include/llvm/CGData/StableFunctionMap.h b/llvm/include/llvm/CGData/StableFunctionMap.h new file mode 100644 index 00..1dbc4257af1340 --- /dev/null +++ b/llvm/include/llvm/CGData/StableFunctionMap.h @@ -0,0 +1,139 @@ +//===- StableFunctionMap.h -*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===-===// +// +// TODO +// +//===-===// + +#ifndef LLVM_CGDATA_STABLEFUNCTIONMAP_H +#define LLVM_CGDATA_STABLEFUNCTIONMAP_H + +#include "llvm/ADT/DenseMap.h" +#include "llvm/ADT/StableHashing.h" +#include "llvm/ADT/StringMap.h" +#include "llvm/IR/StructuralHash.h" +#include "llvm/ObjectYAML/YAML.h" +#include "llvm/Support/raw_ostream.h" + +#include +#include + +namespace llvm { + +using IndexPairHash = std::pair; +using IndexOperandHashVecType = SmallVector; + +/// A stable function is a function with a stable hash while tracking the +/// locations of ignored operands and their hashes. +struct StableFunction { + /// The combined stable hash of the function. + stable_hash Hash; + /// The name of the function. + std::string FunctionName; + /// The name of the module the function is in. + std::string ModuleName; + /// The number of instructions. + unsigned InstCount; + /// A vector of pairs of IndexPair and operand hash which was skipped. + IndexOperandHashVecType IndexOperandHashes; + + StableFunction(stable_hash Hash, const std::string FunctionName, + const std::string ModuleName, unsigned InstCount, + IndexOperandHashVecType &&IndexOperandHashes) + : Hash(Hash), FunctionName(FunctionName), ModuleName(ModuleName), +InstCount(InstCount), +IndexOperandHashes(std::move(IndexOperandHashes)) {} + StableFunction() = default; +}; + +/// An efficient form of StableFunction for fast look-up +struct StableFunctionEntry { + /// The combined stable hash of the function. + stable_hash Hash; + /// Id of the function name. + unsigned FunctionNameId; + /// Id of the module name. + unsigned ModuleNameId; + /// The number of instructions. + unsigned InstCount; + /// A map from an IndexPair to a stable_hash which was skipped. + std::unique_ptr IndexOperandHashMap; + + StableFunctionEntry( + stable_hash Hash, unsigned FunctionNameId, unsigned ModuleNameId, + unsigned InstCount, + std::unique_ptr IndexOperandHashMap) + : Hash(Hash), FunctionNameId(FunctionNameId), ModuleNameId(ModuleNameId), +InstCount(InstCount), +IndexOperandHashMap(std::move(IndexOperandHashMap)) {} +}; + +using HashFuncsMapType = +DenseMap>>; + +class StableFunctionMap { + /// A map from a stable_hash to a vector of functions with that hash. + HashFuncsMapType HashToFuncs; + /// A vector of strings to hold names. + SmallVector IdToName; + /// A map from StringRef (name) to an ID. + StringMap NameToId; + /// True if the function map is finalized with minimal content. + bool Finalized = false; + +public: + /// Get the HashToFuncs map for serialization. + const HashFuncsMapType &getFunctionMap() const { return HashToFuncs; } + + /// Get the N
[llvm-branch-commits] [clang] [Serialization] Code cleanups and polish 83233 (PR #83237)
https://github.com/ChuanqiXu9 updated https://github.com/llvm/llvm-project/pull/83237 >From 5df9f526236cff3b2212088bf6bf52c6802044e2 Mon Sep 17 00:00:00 2001 From: Chuanqi Xu Date: Wed, 28 Feb 2024 11:41:53 +0800 Subject: [PATCH] [Serialization] Code cleanups and polish 83233 fmt load specializations before writing specialization decls address comments Revert "load specializations before writing specialization decls" This reverts commit 61c451d2cce4d9b613de93aedd3f3fd4dcc296ee. Do not omit data from imported modules with same key Handle merging spec info manually --- clang/include/clang/AST/DeclTemplate.h| 39 +- clang/include/clang/AST/ExternalASTSource.h | 8 +- .../clang/Sema/MultiplexExternalSemaSource.h | 4 +- .../include/clang/Serialization/ASTBitCodes.h | 2 + clang/include/clang/Serialization/ASTReader.h | 4 +- clang/lib/AST/DeclTemplate.cpp| 85 ++-- clang/lib/AST/ExternalASTSource.cpp | 10 +- clang/lib/AST/ODRHash.cpp | 10 - .../lib/Sema/MultiplexExternalSemaSource.cpp | 13 +- clang/lib/Serialization/ASTCommon.h | 1 - clang/lib/Serialization/ASTReader.cpp | 41 +- clang/lib/Serialization/ASTReaderDecl.cpp | 80 +--- clang/lib/Serialization/ASTReaderInternals.h | 3 +- clang/lib/Serialization/ASTWriter.cpp | 49 +-- clang/lib/Serialization/ASTWriterDecl.cpp | 53 +-- clang/lib/Serialization/CMakeLists.txt| 1 + .../Serialization/TemplateArgumentHasher.cpp | 405 ++ .../Serialization/TemplateArgumentHasher.h| 34 ++ clang/test/Modules/cxx-templates.cpp | 8 +- .../Modules/recursive-instantiations.cppm | 40 ++ .../test/OpenMP/target_parallel_ast_print.cpp | 4 - clang/test/OpenMP/target_teams_ast_print.cpp | 4 - clang/test/OpenMP/task_ast_print.cpp | 4 - clang/test/OpenMP/teams_ast_print.cpp | 4 - 24 files changed, 612 insertions(+), 294 deletions(-) create mode 100644 clang/lib/Serialization/TemplateArgumentHasher.cpp create mode 100644 clang/lib/Serialization/TemplateArgumentHasher.h create mode 100644 clang/test/Modules/recursive-instantiations.cppm diff --git a/clang/include/clang/AST/DeclTemplate.h b/clang/include/clang/AST/DeclTemplate.h index 5ee373a0db5027..7526e83a60f903 100644 --- a/clang/include/clang/AST/DeclTemplate.h +++ b/clang/include/clang/AST/DeclTemplate.h @@ -256,9 +256,6 @@ class TemplateArgumentList final TemplateArgumentList(const TemplateArgumentList &) = delete; TemplateArgumentList &operator=(const TemplateArgumentList &) = delete; - /// Create hash for the given arguments. - static unsigned ComputeODRHash(ArrayRef Args); - /// Create a new template argument list that copies the given set of /// template arguments. static TemplateArgumentList *CreateCopy(ASTContext &Context, @@ -732,25 +729,6 @@ class RedeclarableTemplateDecl : public TemplateDecl, } void anchor() override; - struct LazySpecializationInfo { -GlobalDeclID DeclID = GlobalDeclID(); -unsigned ODRHash = ~0U; -bool IsPartial = false; -LazySpecializationInfo(GlobalDeclID ID, unsigned Hash = ~0U, - bool Partial = false) -: DeclID(ID), ODRHash(Hash), IsPartial(Partial) {} -LazySpecializationInfo() {} -bool operator<(const LazySpecializationInfo &Other) const { - return DeclID < Other.DeclID; -} -bool operator==(const LazySpecializationInfo &Other) const { - assert((DeclID != Other.DeclID || ODRHash == Other.ODRHash) && - "Hashes differ!"); - assert((DeclID != Other.DeclID || IsPartial == Other.IsPartial) && - "Both must be the same kinds!"); - return DeclID == Other.DeclID; -} - }; protected: template struct SpecEntryTraits { @@ -794,16 +772,20 @@ class RedeclarableTemplateDecl : public TemplateDecl, void loadLazySpecializationsImpl(bool OnlyPartial = false) const; - void loadLazySpecializationsImpl(llvm::ArrayRef Args, + bool loadLazySpecializationsImpl(llvm::ArrayRef Args, TemplateParameterList *TPL = nullptr) const; - Decl *loadLazySpecializationImpl(LazySpecializationInfo &LazySpecInfo) const; - template typename SpecEntryTraits::DeclType* findSpecializationImpl(llvm::FoldingSetVector &Specs, void *&InsertPos, ProfileArguments &&...ProfileArgs); + template + typename SpecEntryTraits::DeclType * + findSpecializationLocally(llvm::FoldingSetVector &Specs, +void *&InsertPos, +ProfileArguments &&...ProfileArgs); + template void addSpecializationImpl(llvm::FoldingSetVector &Specs, EntryType *Entry, void *InsertPos); @@ -815,13 +797,6 @@ class RedeclarableTemplateDecl : public TemplateDecl, /// directly instantiated (or null). RedeclarableTemplateDecl *InstantiatedFromMem
[llvm-branch-commits] [clang] [Serialization] Introduce OnDiskHashTable for specializations (PR #83233)
https://github.com/ChuanqiXu9 updated https://github.com/llvm/llvm-project/pull/83233 >From b61bcaafa3700b0797772df58710158eb44eaa69 Mon Sep 17 00:00:00 2001 From: Chuanqi Xu Date: Wed, 28 Feb 2024 11:41:53 +0800 Subject: [PATCH] [Serialization] Introduce OnDiskHashTable for specializations Following up for https://github.com/llvm/llvm-project/pull/83108 This follows the suggestion literally from https://github.com/llvm/llvm-project/pull/76774#issuecomment-1951172457 which introduces OnDiskHashTable for specializations based on D41416. Note that I didn't polish this patch to reduce the diff from D41416 to it easier to review. I'll make the polishing patch later. So that we can focus what we're doing in this patch and focus on the style in the next patch. --- clang/include/clang/AST/ExternalASTSource.h | 11 + .../clang/Sema/MultiplexExternalSemaSource.h | 6 + .../include/clang/Serialization/ASTBitCodes.h | 6 + clang/include/clang/Serialization/ASTReader.h | 34 ++- clang/include/clang/Serialization/ASTWriter.h | 15 + clang/lib/AST/DeclTemplate.cpp| 17 ++ clang/lib/AST/ExternalASTSource.cpp | 5 + .../lib/Sema/MultiplexExternalSemaSource.cpp | 12 + clang/lib/Serialization/ASTReader.cpp | 145 +- clang/lib/Serialization/ASTReaderDecl.cpp | 27 ++ clang/lib/Serialization/ASTReaderInternals.h | 124 + clang/lib/Serialization/ASTWriter.cpp | 174 +++- clang/lib/Serialization/ASTWriterDecl.cpp | 32 ++- clang/unittests/Serialization/CMakeLists.txt | 1 + .../Serialization/LoadSpecLazilyTest.cpp | 260 ++ 15 files changed, 856 insertions(+), 13 deletions(-) create mode 100644 clang/unittests/Serialization/LoadSpecLazilyTest.cpp diff --git a/clang/include/clang/AST/ExternalASTSource.h b/clang/include/clang/AST/ExternalASTSource.h index 385c32edbae0fd..24c4490d160f3f 100644 --- a/clang/include/clang/AST/ExternalASTSource.h +++ b/clang/include/clang/AST/ExternalASTSource.h @@ -150,6 +150,17 @@ class ExternalASTSource : public RefCountedBase { virtual bool FindExternalVisibleDeclsByName(const DeclContext *DC, DeclarationName Name); + /// Load all the external specializations for the Decl \param D if \param + /// OnlyPartial is false. Otherwise, load all the external **partial** + /// specializations for the \param D. + virtual void LoadExternalSpecializations(const Decl *D, bool OnlyPartial); + + /// Load all the specializations for the Decl \param D with the same template + /// args specified by \param TemplateArgs. + virtual void + LoadExternalSpecializations(const Decl *D, + ArrayRef TemplateArgs); + /// Ensures that the table of all visible declarations inside this /// context is up to date. /// diff --git a/clang/include/clang/Sema/MultiplexExternalSemaSource.h b/clang/include/clang/Sema/MultiplexExternalSemaSource.h index 3d1906d8699265..78bbbaf2d7b5c6 100644 --- a/clang/include/clang/Sema/MultiplexExternalSemaSource.h +++ b/clang/include/clang/Sema/MultiplexExternalSemaSource.h @@ -97,6 +97,12 @@ class MultiplexExternalSemaSource : public ExternalSemaSource { bool FindExternalVisibleDeclsByName(const DeclContext *DC, DeclarationName Name) override; + void LoadExternalSpecializations(const Decl *D, bool OnlyPartial) override; + + void + LoadExternalSpecializations(const Decl *D, + ArrayRef TemplateArgs) override; + /// Ensures that the table of all visible declarations inside this /// context is up to date. void completeVisibleDeclsMap(const DeclContext *DC) override; diff --git a/clang/include/clang/Serialization/ASTBitCodes.h b/clang/include/clang/Serialization/ASTBitCodes.h index 4b79d4b7711905..712ab2ecc86c18 100644 --- a/clang/include/clang/Serialization/ASTBitCodes.h +++ b/clang/include/clang/Serialization/ASTBitCodes.h @@ -734,6 +734,9 @@ enum ASTRecordTypes { /// Record code for Sema's vector of functions/blocks with effects to /// be verified. DECLS_WITH_EFFECTS_TO_VERIFY = 72, + + /// Record code for updated specialization + UPDATE_SPECIALIZATION = 73, }; /// Record types used within a source manager block. @@ -1500,6 +1503,9 @@ enum DeclCode { /// A HLSLBufferDecl record. DECL_HLSL_BUFFER, + // A decls specilization record. + DECL_SPECIALIZATIONS, + /// An ImplicitConceptSpecializationDecl record. DECL_IMPLICIT_CONCEPT_SPECIALIZATION, diff --git a/clang/include/clang/Serialization/ASTReader.h b/clang/include/clang/Serialization/ASTReader.h index ee4e897b248882..879584a7a11003 100644 --- a/clang/include/clang/Serialization/ASTReader.h +++ b/clang/include/clang/Serialization/ASTReader.h @@ -352,6 +352,9 @@ class ASTIdentifierLookupTrait; /// The on-disk hash table(s) used for DeclContext name lookup. struct DeclContextLookupTable; +/// The on-disk hash table(s) used for specialization decls. +
[llvm-branch-commits] [clang] [Serialization] Code cleanups and polish 83233 (PR #83237)
ChuanqiXu9 wrote: > There were some merge conflicts with main, I've managed to resolve them to > this: https://github.com/ilya-biryukov/llvm-project/tree/pr83237_merged > > I am now trying to bootstrap the compiler with that version, but it would be > useful if someone rebased this PR against main, in case I've made mistakes > during the merging process and the bootstrap/testing will fail because of > this. I've tried to rebase on the main. Hope this helps. https://github.com/llvm/llvm-project/pull/83237 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] [Serialization] Introduce OnDiskHashTable for specializations (PR #83233)
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 a2cac54ad725c18827226f74675312ace0239fa3 b61bcaafa3700b0797772df58710158eb44eaa69 --extensions cpp,h -- clang/unittests/Serialization/LoadSpecLazilyTest.cpp clang/include/clang/AST/ExternalASTSource.h clang/include/clang/Sema/MultiplexExternalSemaSource.h clang/include/clang/Serialization/ASTBitCodes.h clang/include/clang/Serialization/ASTReader.h clang/include/clang/Serialization/ASTWriter.h clang/lib/AST/DeclTemplate.cpp clang/lib/AST/ExternalASTSource.cpp clang/lib/Sema/MultiplexExternalSemaSource.cpp clang/lib/Serialization/ASTReader.cpp clang/lib/Serialization/ASTReaderDecl.cpp clang/lib/Serialization/ASTReaderInternals.h clang/lib/Serialization/ASTWriter.cpp clang/lib/Serialization/ASTWriterDecl.cpp `` View the diff from clang-format here. ``diff diff --git a/clang/lib/Serialization/ASTReader.cpp b/clang/lib/Serialization/ASTReader.cpp index 080ca274a5..60f0fbbc05 100644 --- a/clang/lib/Serialization/ASTReader.cpp +++ b/clang/lib/Serialization/ASTReader.cpp @@ -1321,8 +1321,9 @@ void LazySpecializationInfoLookupTrait::ReadDataInto(internal_key_type, for (unsigned NumDecls = DataLen / serialization::reader::LazySpecializationInfo::Length; NumDecls; --NumDecls) { -LocalDeclID LocalID = -LocalDeclID::get(Reader, F, endian::readNext(d)); +LocalDeclID LocalID = LocalDeclID::get( +Reader, F, +endian::readNext(d)); const bool IsPartial = endian::readNext(d); Val.insert({Reader.getGlobalDeclID(F, LocalID), IsPartial}); diff --git a/clang/lib/Serialization/ASTWriter.cpp b/clang/lib/Serialization/ASTWriter.cpp index 8c48f8bbfe..16b14a9541 100644 --- a/clang/lib/Serialization/ASTWriter.cpp +++ b/clang/lib/Serialization/ASTWriter.cpp @@ -4150,10 +4150,10 @@ public: for (auto *D : C) { bool IsPartial = isa(D); - NamedDecl *ND = getDeclForLocalLookup( - Writer.getLangOpts(), const_cast(D)); - Specs.push_back({GlobalDeclID(Writer.GetDeclRef(ND).getRawValue()), - IsPartial}); + NamedDecl *ND = getDeclForLocalLookup(Writer.getLangOpts(), +const_cast(D)); + Specs.push_back( + {GlobalDeclID(Writer.GetDeclRef(ND).getRawValue()), IsPartial}); } return std::make_pair(Start, Specs.size()); } @@ -5815,7 +5815,7 @@ void ASTWriter::WriteDeclAndTypes(ASTContext &Context) { // Keep writing types, declarations, and declaration update records // until we've emitted all of them. RecordData DeclUpdatesOffsetsRecord; - Stream.EnterSubblock(DECLTYPES_BLOCK_ID, /*bits for abbreviations*/6); + Stream.EnterSubblock(DECLTYPES_BLOCK_ID, /*bits for abbreviations*/ 6); DeclTypesBlockStartOffset = Stream.GetCurrentBitNo(); WriteTypeAbbrevs(); WriteDeclAbbrevs(); @@ -5950,7 +5950,8 @@ void ASTWriter::WriteSpecializationsUpdates() { LookupTable); // Write the lookup table -RecordData::value_type Record[] = {UPDATE_SPECIALIZATION, getDeclID(D).getRawValue()}; +RecordData::value_type Record[] = {UPDATE_SPECIALIZATION, + getDeclID(D).getRawValue()}; Stream.EmitRecordWithBlob(UpdateSpecializationAbbrev, Record, LookupTable); } } `` https://github.com/llvm/llvm-project/pull/83233 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] [Serialization] Code cleanups and polish 83233 (PR #83237)
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 b61bcaafa3700b0797772df58710158eb44eaa69 5df9f526236cff3b2212088bf6bf52c6802044e2 --extensions h,cpp,cppm -- clang/lib/Serialization/TemplateArgumentHasher.cpp clang/lib/Serialization/TemplateArgumentHasher.h clang/test/Modules/recursive-instantiations.cppm clang/include/clang/AST/DeclTemplate.h clang/include/clang/AST/ExternalASTSource.h clang/include/clang/Sema/MultiplexExternalSemaSource.h clang/include/clang/Serialization/ASTBitCodes.h clang/include/clang/Serialization/ASTReader.h clang/lib/AST/DeclTemplate.cpp clang/lib/AST/ExternalASTSource.cpp clang/lib/AST/ODRHash.cpp clang/lib/Sema/MultiplexExternalSemaSource.cpp clang/lib/Serialization/ASTCommon.h clang/lib/Serialization/ASTReader.cpp clang/lib/Serialization/ASTReaderDecl.cpp clang/lib/Serialization/ASTReaderInternals.h clang/lib/Serialization/ASTWriter.cpp clang/lib/Serialization/ASTWriterDecl.cpp clang/test/Modules/cxx-templates.cpp clang/test/OpenMP/target_parallel_ast_print.cpp clang/test/OpenMP/target_teams_ast_print.cpp clang/test/OpenMP/task_ast_print.cpp clang/test/OpenMP/teams_ast_print.cpp `` View the diff from clang-format here. ``diff diff --git a/clang/include/clang/Serialization/ASTBitCodes.h b/clang/include/clang/Serialization/ASTBitCodes.h index 3c9a652052..496242b138 100644 --- a/clang/include/clang/Serialization/ASTBitCodes.h +++ b/clang/include/clang/Serialization/ASTBitCodes.h @@ -737,7 +737,7 @@ enum ASTRecordTypes { /// Record code for updated specialization UPDATE_SPECIALIZATION = 73, - + CXX_ADDED_TEMPLATE_SPECIALIZATION = 74, }; diff --git a/clang/lib/Serialization/ASTWriter.cpp b/clang/lib/Serialization/ASTWriter.cpp index 76190177ad..b7974e9073 100644 --- a/clang/lib/Serialization/ASTWriter.cpp +++ b/clang/lib/Serialization/ASTWriter.cpp @@ -4146,7 +4146,8 @@ public: explicit LazySpecializationInfoLookupTrait(ASTWriter &Writer) : Writer(Writer) {} - template data_type getData(Col &&C, Col2 &ExistingInfo) { + template + data_type getData(Col &&C, Col2 &ExistingInfo) { unsigned Start = Specs.size(); for (auto *D : C) { bool IsPartial = isagetLoadedSpecializationsLookupTables(D) : nullptr; for (auto &[HashValue, Specs] : SpecializationMaps) { -SmallVector ExisitingSpecs; -// We have to merge the lookup table manually here. We can't depend on the merge mechanism -// offered by clang::serialization::MultiOnDiskHashTableGenerator since that generator +SmallVector +ExisitingSpecs; +// We have to merge the lookup table manually here. We can't depend on the +// merge mechanism offered by +// clang::serialization::MultiOnDiskHashTableGenerator since that generator // assumes the we'll get the same value with the same key. -// And also underlying llvm::OnDiskChainedHashTableGenerator assumes that we won't insert -// the values with the same key twice. -// So we have to merge the lookup table here manually. +// And also underlying llvm::OnDiskChainedHashTableGenerator assumes that we +// won't insert the values with the same key twice. So we have to merge the +// lookup table here manually. if (Lookups) ExisitingSpecs = Lookups->Table.find(HashValue); `` https://github.com/llvm/llvm-project/pull/83237 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [nfc][lsan] Extract significant part of the loop into a function (PR #112610)
https://github.com/vitalybuka created https://github.com/llvm/llvm-project/pull/112610 None ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] [flang] [lld] [llvm] [Flang] LLVM_ENABLE_RUNTIMES=FortranRuntime (PR #110217)
@@ -24,7 +24,7 @@ list(INSERT CMAKE_MODULE_PATH 0 # We order libraries to mirror roughly how they are layered, except that compiler-rt can depend # on libc++, so we put it after. set(LLVM_DEFAULT_RUNTIMES "libc;libunwind;libcxxabi;pstl;libcxx;compiler-rt;openmp;offload") -set(LLVM_SUPPORTED_RUNTIMES "${LLVM_DEFAULT_RUNTIMES};llvm-libgcc") +set(LLVM_SUPPORTED_RUNTIMES "${LLVM_DEFAULT_RUNTIMES};llvm-libgcc;flang-rt") ldionne wrote: Any reason why `flang-rt` shouldn't be built by default? https://github.com/llvm/llvm-project/pull/110217 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] [flang] [lld] [llvm] [Flang] LLVM_ENABLE_RUNTIMES=FortranRuntime (PR #110217)
@@ -34,6 +34,8 @@ endfunction() # llvm_ExternalProject_Add(name source_dir ... +# ENABLE_FORTRAN +# External project requires the Flang compiler ldionne wrote: Ah, I see now, `clang` is being added implicitly if you don't specify any required toolchain tools. I don't love adding a new parameter, but after consideration I can't think of any other simple solution. https://github.com/llvm/llvm-project/pull/110217 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] [flang] [lld] [llvm] [Flang] LLVM_ENABLE_RUNTIMES=FortranRuntime (PR #110217)
@@ -261,6 +263,7 @@ function(runtime_default_target) llvm_ExternalProject_Add(runtimes ${CMAKE_CURRENT_SOURCE_DIR}/../../runtimes DEPENDS ${ARG_DEPENDS} + ${enable_fortran} ldionne wrote: I think `ENABLE_FORTRAN` could be passed below using the `EXTRA_ARGS` mechanism instead. That would be cleaner than using this "global-but-defined-only-later" `${enable_fortran}` variable. https://github.com/llvm/llvm-project/pull/110217 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [nfc][lsan] Extract significant part of the loop into a function (PR #112610)
llvmbot wrote: @llvm/pr-subscribers-compiler-rt-sanitizer Author: Vitaly Buka (vitalybuka) Changes --- Full diff: https://github.com/llvm/llvm-project/pull/112610.diff 1 Files Affected: - (modified) compiler-rt/lib/lsan/lsan_common.cpp (+108-101) ``diff diff --git a/compiler-rt/lib/lsan/lsan_common.cpp b/compiler-rt/lib/lsan/lsan_common.cpp index a1a15bf98a1183..721db7872cce83 100644 --- a/compiler-rt/lib/lsan/lsan_common.cpp +++ b/compiler-rt/lib/lsan/lsan_common.cpp @@ -399,6 +399,112 @@ static void ProcessThreadRegistry(Frontier *frontier) { } // Scans thread data (stacks and TLS) for heap pointers. +static void ProcessThread(tid_t os_id, uptr sp, + const InternalMmapVector ®isters, + InternalMmapVector &extra_ranges, + Frontier *frontier) { + // `extra_ranges` is outside of the function and the loop to reused mapped + // memory. + CHECK(extra_ranges.empty()); + LOG_THREADS("Processing thread %llu.\n", os_id); + uptr stack_begin, stack_end, tls_begin, tls_end, cache_begin, cache_end; + DTLS *dtls; + bool thread_found = + GetThreadRangesLocked(os_id, &stack_begin, &stack_end, &tls_begin, +&tls_end, &cache_begin, &cache_end, &dtls); + if (!thread_found) { +// If a thread can't be found in the thread registry, it's probably in the +// process of destruction. Log this event and move on. +LOG_THREADS("Thread %llu not found in registry.\n", os_id); +return; + } + + if (!sp) +sp = stack_begin; + + if (flags()->use_registers) { +uptr registers_begin = reinterpret_cast(registers.data()); +uptr registers_end = +reinterpret_cast(registers.data() + registers.size()); +ScanRangeForPointers(registers_begin, registers_end, frontier, "REGISTERS", + kReachable); + } + + if (flags()->use_stacks) { +LOG_THREADS("Stack at %p-%p (SP = %p).\n", (void *)stack_begin, +(void *)stack_end, (void *)sp); +if (sp < stack_begin || sp >= stack_end) { + // SP is outside the recorded stack range (e.g. the thread is running a + // signal handler on alternate stack, or swapcontext was used). + // Again, consider the entire stack range to be reachable. + LOG_THREADS("WARNING: stack pointer not in stack range.\n"); + uptr page_size = GetPageSizeCached(); + int skipped = 0; + while (stack_begin < stack_end && + !IsAccessibleMemoryRange(stack_begin, 1)) { +skipped++; +stack_begin += page_size; + } + LOG_THREADS("Skipped %d guard page(s) to obtain stack %p-%p.\n", skipped, + (void *)stack_begin, (void *)stack_end); +} else { + // Shrink the stack range to ignore out-of-scope values. + stack_begin = sp; +} +ScanRangeForPointers(stack_begin, stack_end, frontier, "STACK", kReachable); +GetThreadExtraStackRangesLocked(os_id, &extra_ranges); +ScanExtraStackRanges(extra_ranges, frontier); + } + + if (flags()->use_tls) { +if (tls_begin) { + LOG_THREADS("TLS at %p-%p.\n", (void *)tls_begin, (void *)tls_end); + // If the tls and cache ranges don't overlap, scan full tls range, + // otherwise, only scan the non-overlapping portions + if (cache_begin == cache_end || tls_end < cache_begin || + tls_begin > cache_end) { +ScanRangeForPointers(tls_begin, tls_end, frontier, "TLS", kReachable); + } else { +if (tls_begin < cache_begin) + ScanRangeForPointers(tls_begin, cache_begin, frontier, "TLS", + kReachable); +if (tls_end > cache_end) + ScanRangeForPointers(cache_end, tls_end, frontier, "TLS", kReachable); + } +} +#if SANITIZER_ANDROID +auto *cb = +[](void *dtls_begin, void *dtls_end, uptr /*dso_idd*/, + void *arg) -> void { + ScanRangeForPointers( + reinterpret_cast(dtls_begin), reinterpret_cast(dtls_end), + reinterpret_cast(arg), "DTLS", kReachable); +}; + +// FIXME: There might be a race-condition here (and in Bionic) if the +// thread is suspended in the middle of updating its DTLS. IOWs, we +// could scan already freed memory. (probably fine for now) +__libc_iterate_dynamic_tls(os_id, cb, frontier); +#else +if (dtls && !DTLSInDestruction(dtls)) { + ForEachDVT(dtls, [&](const DTLS::DTV &dtv, int id) { +uptr dtls_beg = dtv.beg; +uptr dtls_end = dtls_beg + dtv.size; +if (dtls_beg < dtls_end) { + LOG_THREADS("DTLS %d at %p-%p.\n", id, (void *)dtls_beg, + (void *)dtls_end); + ScanRangeForPointers(dtls_beg, dtls_end, frontier, "DTLS", + kReachable); +} + }); +} else { + // We are handling a thread with DTLS under destruction. Log about + // this and continue. + LOG_THREADS("Thread %l
[llvm-branch-commits] [flang] [llvm] [Flang] Move runtime library files to clang-rt. NFC (PR #110298)
@@ -1,13 +1,13 @@ -//===-- include/flang/Runtime/CUDA/allocator.h --*- C++ -*-===// +//===-- include/flang-rt/CufRuntime/allocator.h -*- C++ -*-===// clementval wrote: As @klausler mentioned, this is the "CUDA" part of the Fortran runtime so the initial name seems fine. I don't see a place that mentions the lib name should be salted to the directory name. If that's the case then I would rather change the lib name. https://github.com/llvm/llvm-project/pull/110298 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [flang] [llvm] [Flang] Move runtime library files to clang-rt. NFC (PR #110298)
@@ -1,4 +1,4 @@ -//===-- include/FortranRuntime/Runtime/array-constructor.h --*- C++ -*-===// +//===-- include/flang-rt/flang_rt/array-constructor.h ---*- C++ -*-===// clementval wrote: That feels strange to me. I hope we can come out with a better solution. https://github.com/llvm/llvm-project/pull/110298 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [flang] [llvm] [Flang] Move runtime library files to clang-rt. NFC (PR #110298)
https://github.com/clementval edited https://github.com/llvm/llvm-project/pull/110298 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [flang] [llvm] [Flang] Move runtime library files to clang-rt. NFC (PR #110298)
https://github.com/clementval requested changes to this pull request. See comment about CUDA Fortran directory name https://github.com/llvm/llvm-project/pull/110298 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [flang] [llvm] [Flang] Move runtime library files to clang-rt. NFC (PR #110298)
https://github.com/clementval edited https://github.com/llvm/llvm-project/pull/110298 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [AMDGPU] Still set up the two SGPRs for queue ptr even it is COV5 (PR #112403)
https://github.com/shiltian ready_for_review https://github.com/llvm/llvm-project/pull/112403 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [StructuralHash] Support Differences (PR #112638)
https://github.com/kyulee-com created https://github.com/llvm/llvm-project/pull/112638 This comutes a structural hash while allowing for selective ignoring of certain operands based on a custom function that is provided. Instead of a single hash value, it now returns FunctionHashInfo which includes a hash value, an instruction mapping, and a map to track the operand location and its corresponding hash value that is ignored. >From 6225d74229d41068c57109a24b063f6fcba13985 Mon Sep 17 00:00:00 2001 From: Kyungwoo Lee Date: Wed, 16 Oct 2024 17:09:07 -0700 Subject: [PATCH] [StructuralHash] Support Differences This comutes a structural hash while allowing for selective ignoring of certain operands based on a custom function that is provided. Instead of a single hash value, it now returns FunctionHashInfo which includes a hash value, an instruction mapping, and a map to track the operand location and its corresponding hash value that is ignored. --- llvm/include/llvm/IR/StructuralHash.h| 46 ++ llvm/lib/IR/StructuralHash.cpp | 188 +-- llvm/unittests/IR/StructuralHashTest.cpp | 55 +++ 3 files changed, 275 insertions(+), 14 deletions(-) diff --git a/llvm/include/llvm/IR/StructuralHash.h b/llvm/include/llvm/IR/StructuralHash.h index aa292bc3446799..bc82c204c4d1f6 100644 --- a/llvm/include/llvm/IR/StructuralHash.h +++ b/llvm/include/llvm/IR/StructuralHash.h @@ -14,7 +14,9 @@ #ifndef LLVM_IR_STRUCTURALHASH_H #define LLVM_IR_STRUCTURALHASH_H +#include "llvm/ADT/MapVector.h" #include "llvm/ADT/StableHashing.h" +#include "llvm/IR/Instruction.h" #include namespace llvm { @@ -23,6 +25,7 @@ class Function; class Module; using IRHash = stable_hash; +using OpndHash = stable_hash; /// Returns a hash of the function \p F. /// \param F The function to hash. @@ -37,6 +40,49 @@ IRHash StructuralHash(const Function &F, bool DetailedHash = false); /// composed the module hash. IRHash StructuralHash(const Module &M, bool DetailedHash = false); +/// The pair of an instruction index and a operand index. +using IndexPair = std::pair; + +/// A map from an instruction index to an instruction pointer. +using IndexInstrMap = MapVector; + +/// A map from an IndexPair to an OpndHash. +using IndexOperandHashMapType = DenseMap; + +/// A function that takes an instruction and an operand index and returns true +/// if the operand should be ignored in the function hash computation. +using IgnoreOperandFunc = std::function; + +struct FunctionHashInfo { + /// A hash value representing the structural content of the function + IRHash FunctionHash; + /// A mapping from instruction indices to instruction pointers + std::unique_ptr IndexInstruction; + /// A mapping from pairs of instruction indices and operand indices + /// to the hashes of the operands. This can be used to analyze or + /// reconstruct the differences in ignored operands + std::unique_ptr IndexOperandHashMap; + + FunctionHashInfo(IRHash FuntionHash, + std::unique_ptr IndexInstruction, + std::unique_ptr IndexOperandHashMap) + : FunctionHash(FuntionHash), +IndexInstruction(std::move(IndexInstruction)), +IndexOperandHashMap(std::move(IndexOperandHashMap)) {} +}; + +/// Computes a structural hash of a given function, considering the structure +/// and content of the function's instructions while allowing for selective +/// ignoring of certain operands based on custom criteria. This hash can be used +/// to identify functions that are structurally similar or identical, which is +/// useful in optimizations, deduplication, or analysis tasks. +/// \param F The function to hash. +/// \param IgnoreOp A callable that takes an instruction and an operand index, +/// and returns true if the operand should be ignored in the hash computation. +/// \return A FunctionHashInfo structure +FunctionHashInfo StructuralHashWithDifferences(const Function &F, + IgnoreOperandFunc IgnoreOp); + } // end namespace llvm #endif diff --git a/llvm/lib/IR/StructuralHash.cpp b/llvm/lib/IR/StructuralHash.cpp index a1fabab77d52b2..6e0af666010a05 100644 --- a/llvm/lib/IR/StructuralHash.cpp +++ b/llvm/lib/IR/StructuralHash.cpp @@ -28,6 +28,19 @@ class StructuralHashImpl { bool DetailedHash; + /// IgnoreOp is a function that returns true if the operand should be ignored. + IgnoreOperandFunc IgnoreOp = nullptr; + /// A mapping from instruction indices to instruction pointers. + /// The index represents the position of an instruction based on the order in + /// which it is first encountered. + std::unique_ptr IndexInstruction = nullptr; + /// A mapping from pairs of instruction indices and operand indices + /// to the hashes of the operands. + std::unique_ptr IndexOperandHashMap = nullptr; + + /// Assign a unique ID to each Value in the order they are first seen. + DenseMap ValueToId; + // This will produce diff
[llvm-branch-commits] [llvm] [AMDGPU] Still set up the two SGPRs for queue ptr even it is COV5 (PR #112403)
shiltian wrote: The only test failure is `CodeGen/AMDGPU/call-args-inreg.ll`. It crashes when lowering function `test_call_external_void_func_a15i32_inreg`. https://github.com/llvm/llvm-project/blob/8d13e7b8c382499c1cf0c2a3184b483e760f266b/llvm/lib/Target/AMDGPU/SIFrameLowering.cpp#L905 https://github.com/llvm/llvm-project/pull/112403 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [AMDGPU] Still set up the two SGPRs for queue ptr even it is COV5 (PR #112403)
@@ -4,12 +4,12 @@ define amdgpu_kernel void @s_clear_msb(ptr addrspace(1) %out, i32 %in) { ; SI-LABEL: s_clear_msb: ; SI: ; %bb.0: -; SI-NEXT:s_load_dword s4, s[2:3], 0xb -; SI-NEXT:s_load_dwordx2 s[0:1], s[2:3], 0x9 +; SI-NEXT:s_load_dword s6, s[4:5], 0xb +; SI-NEXT:s_load_dwordx2 s[0:1], s[4:5], 0x9 ; SI-NEXT:s_mov_b32 s3, 0xf000 ; SI-NEXT:s_mov_b32 s2, -1 ; SI-NEXT:s_waitcnt lgkmcnt(0) -; SI-NEXT:s_bitset0_b32 s4, 31 +; SI-NEXT:s_and_b32 s4, s6, 0x7fff shiltian wrote: Okay, then I guess we can just leave as it is for now. https://github.com/llvm/llvm-project/pull/112403 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [nfc][lsan] Restructure loop in ProcessThreads (PR #112609)
https://github.com/vitalybuka updated https://github.com/llvm/llvm-project/pull/112609 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [nfc][lsan] Restructure loop in ProcessThreads (PR #112609)
https://github.com/vitalybuka updated https://github.com/llvm/llvm-project/pull/112609 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [CGData][llvm-cgdata] Support for stable function map (PR #112664)
https://github.com/kyulee-com created https://github.com/llvm/llvm-project/pull/112664 This introduces a new cgdata format for stable function maps. The raw data is embedded in the __llvm_merge section during compile time. This data can be read and merged using the llvm-cgdata tool, into an indexed cgdata file. Consequently, the tool is now capable of handling either outlined hash trees, stable function maps, or both, as they are orthogonal. >From af5931f2a7aa020afed0ad474b6e6a7e4c564703 Mon Sep 17 00:00:00 2001 From: Kyungwoo Lee Date: Mon, 9 Sep 2024 19:38:05 -0700 Subject: [PATCH] [CGData][llvm-cgdata] Support for stable function map This introduces a new cgdata format for stable function maps. The raw data is embedded in the __llvm_merge section during compile time. This data can be read and merged using the llvm-cgdata tool, into an indexed cgdata file. Consequently, the tool is now capable of handling either outlined hash trees, stable function maps, or both, as they are orthogonal. --- llvm/docs/CommandGuide/llvm-cgdata.rst| 16 ++-- llvm/include/llvm/CGData/CodeGenData.h| 24 +- llvm/include/llvm/CGData/CodeGenData.inc | 12 ++- llvm/include/llvm/CGData/CodeGenDataReader.h | 29 ++- llvm/include/llvm/CGData/CodeGenDataWriter.h | 17 +++- llvm/lib/CGData/CodeGenData.cpp | 30 --- llvm/lib/CGData/CodeGenDataReader.cpp | 63 +- llvm/lib/CGData/CodeGenDataWriter.cpp | 30 ++- llvm/test/tools/llvm-cgdata/empty.test| 8 +- llvm/test/tools/llvm-cgdata/error.test| 13 +-- .../merge-combined-funcmap-hashtree.test | 66 +++ .../llvm-cgdata/merge-funcmap-archive.test| 83 +++ .../llvm-cgdata/merge-funcmap-concat.test | 78 + .../llvm-cgdata/merge-funcmap-double.test | 79 ++ .../llvm-cgdata/merge-funcmap-single.test | 36 ...chive.test => merge-hashtree-archive.test} | 8 +- ...concat.test => merge-hashtree-concat.test} | 6 +- ...double.test => merge-hashtree-double.test} | 8 +- ...single.test => merge-hashtree-single.test} | 4 +- llvm/tools/llvm-cgdata/llvm-cgdata.cpp| 46 +++--- 20 files changed, 572 insertions(+), 84 deletions(-) create mode 100644 llvm/test/tools/llvm-cgdata/merge-combined-funcmap-hashtree.test create mode 100644 llvm/test/tools/llvm-cgdata/merge-funcmap-archive.test create mode 100644 llvm/test/tools/llvm-cgdata/merge-funcmap-concat.test create mode 100644 llvm/test/tools/llvm-cgdata/merge-funcmap-double.test create mode 100644 llvm/test/tools/llvm-cgdata/merge-funcmap-single.test rename llvm/test/tools/llvm-cgdata/{merge-archive.test => merge-hashtree-archive.test} (91%) rename llvm/test/tools/llvm-cgdata/{merge-concat.test => merge-hashtree-concat.test} (93%) rename llvm/test/tools/llvm-cgdata/{merge-double.test => merge-hashtree-double.test} (90%) rename llvm/test/tools/llvm-cgdata/{merge-single.test => merge-hashtree-single.test} (92%) diff --git a/llvm/docs/CommandGuide/llvm-cgdata.rst b/llvm/docs/CommandGuide/llvm-cgdata.rst index f592e1508844ee..0670decd087e39 100644 --- a/llvm/docs/CommandGuide/llvm-cgdata.rst +++ b/llvm/docs/CommandGuide/llvm-cgdata.rst @@ -11,15 +11,13 @@ SYNOPSIS DESCRIPTION --- -The :program:llvm-cgdata utility parses raw codegen data embedded -in compiled binary files and merges them into a single .cgdata file. -It can also inspect and manipulate .cgdata files. -Currently, the tool supports saving and restoring outlined hash trees, -enabling global function outlining across modules, allowing for more -efficient function outlining in subsequent compilations. -The design is extensible, allowing for the incorporation of additional -codegen summaries and optimization techniques, such as global function -merging, in the future. +The :program:llvm-cgdata utility parses raw codegen data embedded in compiled +binary files and merges them into a single .cgdata file. It can also inspect +and manipulate .cgdata files. Currently, the tool supports saving and restoring +outlined hash trees and stable function maps, allowing for more efficient +function outlining and function merging across modules in subsequent +compilations. The design is extensible, allowing for the incorporation of +additional codegen summaries and optimization techniques. COMMANDS diff --git a/llvm/include/llvm/CGData/CodeGenData.h b/llvm/include/llvm/CGData/CodeGenData.h index 53550beeae1f83..5d7c74725ccef1 100644 --- a/llvm/include/llvm/CGData/CodeGenData.h +++ b/llvm/include/llvm/CGData/CodeGenData.h @@ -19,6 +19,7 @@ #include "llvm/Bitcode/BitcodeReader.h" #include "llvm/CGData/OutlinedHashTree.h" #include "llvm/CGData/OutlinedHashTreeRecord.h" +#include "llvm/CGData/StableFunctionMapRecord.h" #include "llvm/IR/Module.h" #include "llvm/Object/ObjectFile.h" #include "llvm/Support/Caching.h" @@ -41,7 +42,9 @@ enum class CGDataKind {
[llvm-branch-commits] [nfc][lsan] Move up vectors cleanup (PR #112608)
llvmbot wrote: @llvm/pr-subscribers-compiler-rt-sanitizer Author: Vitaly Buka (vitalybuka) Changes --- Full diff: https://github.com/llvm/llvm-project/pull/112608.diff 1 Files Affected: - (modified) compiler-rt/lib/lsan/lsan_common.cpp (+2-1) ``diff diff --git a/compiler-rt/lib/lsan/lsan_common.cpp b/compiler-rt/lib/lsan/lsan_common.cpp index 329e29477d0723..6510e0ac3bf6ab 100644 --- a/compiler-rt/lib/lsan/lsan_common.cpp +++ b/compiler-rt/lib/lsan/lsan_common.cpp @@ -405,6 +405,8 @@ static void ProcessThreads(SuspendedThreadsList const &suspended_threads, InternalMmapVector registers; InternalMmapVector extra_ranges; for (uptr i = 0; i < suspended_threads.ThreadCount(); i++) { +registers.clear(); +extra_ranges.clear(); const tid_t os_id = static_cast(suspended_threads.GetThreadID(i)); LOG_THREADS("Processing thread %llu.\n", os_id); uptr stack_begin, stack_end, tls_begin, tls_end, cache_begin, cache_end; @@ -463,7 +465,6 @@ static void ProcessThreads(SuspendedThreadsList const &suspended_threads, } ScanRangeForPointers(stack_begin, stack_end, frontier, "STACK", kReachable); - extra_ranges.clear(); GetThreadExtraStackRangesLocked(os_id, &extra_ranges); ScanExtraStackRanges(extra_ranges, frontier); } `` https://github.com/llvm/llvm-project/pull/112608 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [NFC][lsan] Restructure loop in ProcessThreads (PR #112609)
llvmbot wrote: @llvm/pr-subscribers-compiler-rt-sanitizer Author: Vitaly Buka (vitalybuka) Changes The goal is to move `SuspendedThreadsList` into the begining of the loop, and prepare for extraction the rest of the loop body into a function. --- Full diff: https://github.com/llvm/llvm-project/pull/112609.diff 1 Files Affected: - (modified) compiler-rt/lib/lsan/lsan_common.cpp (+17-11) ``diff diff --git a/compiler-rt/lib/lsan/lsan_common.cpp b/compiler-rt/lib/lsan/lsan_common.cpp index 6510e0ac3bf6ab..a1a15bf98a1183 100644 --- a/compiler-rt/lib/lsan/lsan_common.cpp +++ b/compiler-rt/lib/lsan/lsan_common.cpp @@ -407,7 +407,20 @@ static void ProcessThreads(SuspendedThreadsList const &suspended_threads, for (uptr i = 0; i < suspended_threads.ThreadCount(); i++) { registers.clear(); extra_ranges.clear(); + const tid_t os_id = static_cast(suspended_threads.GetThreadID(i)); +uptr sp = 0; +PtraceRegistersStatus have_registers = +suspended_threads.GetRegistersAndSP(i, ®isters, &sp); +if (have_registers != REGISTERS_AVAILABLE) { + Report("Unable to get registers from thread %llu.\n", os_id); + // If unable to get SP, consider the entire stack to be reachable unless + // GetRegistersAndSP failed with ESRCH. + if (have_registers == REGISTERS_UNAVAILABLE_FATAL) +continue; + sp = 0; +} + LOG_THREADS("Processing thread %llu.\n", os_id); uptr stack_begin, stack_end, tls_begin, tls_end, cache_begin, cache_end; DTLS *dtls; @@ -420,20 +433,13 @@ static void ProcessThreads(SuspendedThreadsList const &suspended_threads, LOG_THREADS("Thread %llu not found in registry.\n", os_id); continue; } -uptr sp; -PtraceRegistersStatus have_registers = -suspended_threads.GetRegistersAndSP(i, ®isters, &sp); -if (have_registers != REGISTERS_AVAILABLE) { - Report("Unable to get registers from thread %llu.\n", os_id); - // If unable to get SP, consider the entire stack to be reachable unless - // GetRegistersAndSP failed with ESRCH. - if (have_registers == REGISTERS_UNAVAILABLE_FATAL) -continue; - sp = stack_begin; -} + if (os_id == caller_tid) sp = caller_sp; +if (!sp) + sp = stack_begin; + if (flags()->use_registers && have_registers) { uptr registers_begin = reinterpret_cast(registers.data()); uptr registers_end = `` https://github.com/llvm/llvm-project/pull/112609 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [nfc][lsan] Move up vectors cleanup (PR #112608)
https://github.com/vitalybuka created https://github.com/llvm/llvm-project/pull/112608 None ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [NFC][lsan] Restructure loop in ProcessThreads (PR #112609)
https://github.com/vitalybuka created https://github.com/llvm/llvm-project/pull/112609 The goal is to move `SuspendedThreadsList` into the begining of the loop, and prepare for extraction the rest of the loop body into a function. ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [nfc][lsan] Restructure loop in ProcessThreads (PR #112609)
https://github.com/vitalybuka edited https://github.com/llvm/llvm-project/pull/112609 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [NFC][lsan] Restructure loop in ProcessThreads (PR #112609)
https://github.com/vitalybuka edited https://github.com/llvm/llvm-project/pull/112609 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [flang] [llvm] [Flang] Move runtime library files to clang-rt. NFC (PR #110298)
@@ -1,4 +1,4 @@ -//===-- include/FortranRuntime/Runtime/array-constructor.h --*- C++ -*-===// +//===-- include/flang-rt/flang_rt/array-constructor.h ---*- C++ -*-===// Meinersbur wrote: I updated the summary to explain this: The folder structure of flang-rt/include/flang-rt/flang_rt/ can be explained as follows: flang-rt (with hyphen) is the subproject's name. The second occurrence is required so #includes are prefixed with it. flang_rt is the library name (e.g. libflang_rt.a). Other library names are CufRuntime and FortranFloat128Math (which as no non-common public headers). flang-rt follows the convention of subproject, e.g. compiler-rt flang_rt follows the convention of Compiler-RT libraries, e.g. libclang_rt.builtins.a https://github.com/llvm/llvm-project/pull/110298 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [flang] [llvm] [Flang] Move runtime library files to clang-rt. NFC (PR #110298)
@@ -1,13 +1,13 @@ -//===-- include/flang/Runtime/CUDA/allocator.h --*- C++ -*-===// +//===-- include/flang-rt/CufRuntime/allocator.h -*- C++ -*-===// Meinersbur wrote: These are the files linked into a library called `CufRuntime_cuda_${CUDAToolkit_VERSION_MAJOR}`. Using `CufRuntime` seems obvious to me. Why do you prefer CUDA? Would you call the library `libCUDA.a`? https://github.com/llvm/llvm-project/pull/110298 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [flang] [llvm] [Flang] Move runtime library files to clang-rt. NFC (PR #110298)
@@ -1,13 +1,13 @@ -//===-- include/flang/Runtime/CUDA/allocator.h --*- C++ -*-===// +//===-- include/flang-rt/CufRuntime/allocator.h -*- C++ -*-===// klausler wrote: CUDA Fortran is the name of the language. "cuf" is a filename extension. https://github.com/llvm/llvm-project/pull/110298 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [nfc][lsan] Extract significant part of the loop into a function (PR #112610)
https://github.com/fmayer approved this pull request. https://github.com/llvm/llvm-project/pull/112610 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [nfc][lsan] Restructure loop in ProcessThreads (PR #112609)
https://github.com/fmayer approved this pull request. https://github.com/llvm/llvm-project/pull/112609 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [flang] [Flang] Split runtime headers in preparation for cross-compilation. (PR #112188)
https://github.com/Meinersbur edited https://github.com/llvm/llvm-project/pull/112188 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [compiler-rt] release/19.x: Undef _TIME_BITS along with _FILE_OFFSET_BITS (PR #112247)
https://github.com/mgorny approved this pull request. https://github.com/llvm/llvm-project/pull/112247 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [compiler-rt] release/19.x: Undef _TIME_BITS along with _FILE_OFFSET_BITS (PR #112247)
https://github.com/thesamesam approved this pull request. https://github.com/llvm/llvm-project/pull/112247 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [flang] [Flang] Split runtime headers in preparation for cross-compilation. (PR #112188)
@@ -29,8 +29,8 @@ mlir::Value fir::runtime::genInitArrayConstructorVector( // the target. The "cookieSize" argument is used to validate this wild // assumption until runtime interfaces are improved. Meinersbur wrote: Removed in https://github.com/llvm/llvm-project/pull/112188/commits/5ce28b58bf9b1456b8d6039178f80471d09149f6 Also adjusted comments around. This changes the ABI, so I removed the NFC tag from the title. https://github.com/llvm/llvm-project/pull/112188 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [flang] [Flang] Split runtime headers in preparation for cross-compilation. NFC. (PR #112188)
https://github.com/Meinersbur updated https://github.com/llvm/llvm-project/pull/112188 >From 42e5abb5b291e78aeb152d7c636c75fe4d90492a Mon Sep 17 00:00:00 2001 From: Michael Kruse Date: Mon, 14 Oct 2024 13:55:16 +0200 Subject: [PATCH 1/4] Split headers in preparation for cross-compilation. NFC. --- flang/include/flang/Lower/Allocatable.h | 2 +- .../flang/Optimizer/Builder/MutableBox.h | 2 +- .../flang/Optimizer/CodeGen/DescriptorModel.h | 2 +- flang/include/flang/Runtime/CUDA/allocator.h | 2 +- flang/include/flang/Runtime/CUDA/descriptor.h | 2 +- .../flang/Runtime/allocator-registry-consts.h | 20 + .../flang/Runtime/allocator-registry.h| 9 +-- .../flang/Runtime/array-constructor-consts.h | 54 + .../include/flang/Runtime/array-constructor.h | 80 +++ .../include/flang/Runtime/descriptor-consts.h | 72 + flang/include/flang/Runtime/descriptor.h | 15 +--- flang/include/flang/Runtime/io-api-funcs.h| 39 + flang/include/flang/Runtime/io-api.h | 3 - flang/include/flang/Runtime/iostat-funcs.h| 23 ++ flang/include/flang/Runtime/iostat.h | 2 - flang/lib/Lower/ConvertVariable.cpp | 2 +- .../Builder/Runtime/ArrayConstructor.cpp | 6 +- flang/lib/Optimizer/CodeGen/CodeGen.cpp | 18 ++--- flang/lib/Semantics/compute-offsets.cpp | 8 +- flang/runtime/environment-default-list.h | 0 flang/runtime/extensions.cpp | 2 +- flang/runtime/internal-unit.cpp | 2 + flang/runtime/io-api-common.h | 2 +- flang/runtime/io-api-minimal.cpp | 2 +- flang/runtime/io-api.cpp | 2 +- flang/runtime/io-error.h | 2 +- flang/runtime/io-stmt.h | 2 +- flang/runtime/iostat.cpp | 2 +- flang/runtime/namelist.cpp| 2 +- .../Builder/Runtime/AllocatableTest.cpp | 2 +- 30 files changed, 254 insertions(+), 127 deletions(-) create mode 100644 flang/include/flang/Runtime/allocator-registry-consts.h create mode 100644 flang/include/flang/Runtime/array-constructor-consts.h create mode 100644 flang/include/flang/Runtime/descriptor-consts.h create mode 100644 flang/include/flang/Runtime/io-api-funcs.h create mode 100644 flang/include/flang/Runtime/iostat-funcs.h mode change 100755 => 100644 flang/runtime/environment-default-list.h diff --git a/flang/include/flang/Lower/Allocatable.h b/flang/include/flang/Lower/Allocatable.h index 1209b157ed1f41..0e89af94af40f6 100644 --- a/flang/include/flang/Lower/Allocatable.h +++ b/flang/include/flang/Lower/Allocatable.h @@ -15,7 +15,7 @@ #include "flang/Lower/AbstractConverter.h" #include "flang/Optimizer/Builder/MutableBox.h" -#include "flang/Runtime/allocator-registry.h" +#include "flang/Runtime/allocator-registry-consts.h" #include "llvm/ADT/StringRef.h" namespace mlir { diff --git a/flang/include/flang/Optimizer/Builder/MutableBox.h b/flang/include/flang/Optimizer/Builder/MutableBox.h index fea7c7204837b4..39657ddaf6e03a 100644 --- a/flang/include/flang/Optimizer/Builder/MutableBox.h +++ b/flang/include/flang/Optimizer/Builder/MutableBox.h @@ -14,7 +14,7 @@ #define FORTRAN_OPTIMIZER_BUILDER_MUTABLEBOX_H #include "flang/Optimizer/Builder/BoxValue.h" -#include "flang/Runtime/allocator-registry.h" +#include "flang/Runtime/allocator-registry-consts.h" #include "llvm/ADT/StringRef.h" namespace mlir { diff --git a/flang/include/flang/Optimizer/CodeGen/DescriptorModel.h b/flang/include/flang/Optimizer/CodeGen/DescriptorModel.h index ff0cf29e8073e6..9cccf8db87270e 100644 --- a/flang/include/flang/Optimizer/CodeGen/DescriptorModel.h +++ b/flang/include/flang/Optimizer/CodeGen/DescriptorModel.h @@ -23,7 +23,7 @@ #define OPTIMIZER_DESCRIPTOR_MODEL_H #include "flang/ISO_Fortran_binding_wrapper.h" -#include "flang/Runtime/descriptor.h" +#include "flang/Runtime/descriptor-consts.h" #include "mlir/Dialect/LLVMIR/LLVMTypes.h" #include "mlir/IR/BuiltinTypes.h" #include "llvm/Support/ErrorHandling.h" diff --git a/flang/include/flang/Runtime/CUDA/allocator.h b/flang/include/flang/Runtime/CUDA/allocator.h index 4527c9f18fa054..cc88896b1f0bd6 100644 --- a/flang/include/flang/Runtime/CUDA/allocator.h +++ b/flang/include/flang/Runtime/CUDA/allocator.h @@ -9,7 +9,7 @@ #ifndef FORTRAN_RUNTIME_CUDA_ALLOCATOR_H_ #define FORTRAN_RUNTIME_CUDA_ALLOCATOR_H_ -#include "flang/Runtime/descriptor.h" +#include "flang/Runtime/descriptor-consts.h" #include "flang/Runtime/entry-names.h" #define CUDA_REPORT_IF_ERROR(expr) \ diff --git a/flang/include/flang/Runtime/CUDA/descriptor.h b/flang/include/flang/Runtime/CUDA/descriptor.h index d593989420420f..501a834f43bd42 100644 --- a/flang/include/flang/Runtime/CUDA/descriptor.h +++ b/flang/include/flang/Runtime/CUDA/descriptor.h @@ -9,7 +9,7 @@ #ifndef FORTRAN_RUNTIME_CUDA_DESCRIPTOR_H_ #define FORTRAN_RUNTIME_CUD
[llvm-branch-commits] [flang] [Flang] Split runtime headers in preparation for cross-compilation. (PR #112188)
Meinersbur wrote: > On what targets would the size or member byte offsets in a descriptor differ? Any 16- and 32-bit target; x32; 128-bit tagged pointer targets such as CHERI-128. https://github.com/llvm/llvm-project/pull/112188 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits